xmedcon-0.14.1/0000755000175000017510000000000012637632716010251 500000000000000xmedcon-0.14.1/Makefile.am0000644000175000017510000000176712161564241012225 00000000000000## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## filename: Makefile.am ## ## ## ## UTIL Make : Medical Image Conversion Utility ## ## ## ## purpose : main dir Makefile template (automake) ## ## ## ## project : (X)MedCon by Erik Nolf ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## $Id: Makefile.am,v 1.11 2013/06/23 12:22:57 enlf Exp $ AUTOMAKE_OPTIONS = gnu dist-bzip2 dist-zip ACLOCAL_AMFLAGS = -I macros SUBDIRS = libs source etc man macros bin_SCRIPTS = xmedcon-config EXTRA_DIST = \ README \ REMARKS xmedcon-0.14.1/REMARKS0000644000175000017510000002505310673312650011213 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: REMARKS # # # # UTILITY text: Medical Image Conversion Utility # # # # purpose : most important remarks on the code # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: REMARKS,v 1.11 2007/09/16 20:44:24 enlf Exp $ GENERAL: ======= - Hey, wake up! As we would say, "to convert IS to delete" !! ALWAYS PRESERVE YOUR ORIGINAL DATA !! - "Floating exception (core dumped)" with use of (X)MedCon library This can occur on DEC Alpha systems ... 1) You can simply prevent this by adding the following functions to your main code: (see also './source/medcon.c') ... MdcIgnoreSIGFPE() /* ignore signal Floating exception */ ... MdcAcceptSIGFPE() /* accept signal Floating exception */ ... 2) Possible reasons: On a DEC Alpha, floating exceptions are not handled by default, which is just great ... but unwanted in the following cases: 1) Perhaps you read a raw image with type float, but didn't swap the bytes (= wrong endian choice). 2) The headers/images contain bad float values. - pixel types: Int8, Int16, Int32, Int64 Uint8, Uint16, Uint32, Uint64, float, double Most pixel types will be read, internally we want the types: 1) 1-BIT converted to 'Uint8' 2) ASCII converted to 'double' 3) VAX converted to IEEE Quantifications/Calibrations only use the 'float' type! Therefore, 'double' values must be downscalable to 'float', otherwise the integrity of the data can not be guaranteed! - patient/slice orientations: a) Only orthogonal values are supported. b) (X)MedCon allows a simple form of reslicing along columns or rows. - automatic filename creation: The filenames are created automatically with the following sequence: m000-...m999-,mA00-...mAZZ-,mB00-...mZZZ- So a directory listing "ls" will alphabetically show the files in sequence as created. After the sequence, filenames could overlap. (X)MedCon however will *not* overwrite any existing file. - NEGATIVE = ZERO: potential danger reading (RAW) images with negative pixels By "default", (X)MedCon works in its most simplest setting, without support for contrast remapping, quantitation nor negatives. In this mode any "negative" values are put to "zero". An image that seems to have lost a lot of pixel information, can mostly be brought back to the elimination of negative pixel values! 1) supported images ---------------- The program can not see whether negative pixel values are important. This is for the user to figure out. To preserve negative pixels, please use the following settings. command-line: use the '-n' option graphical: select in Options|MedCon => positives & negatives You are free to change the default behaviour of the program from the source code ... (see the file: m-global.c) 2) interactive reading (RAW images) ------------------- When reading unsupported image matrices, the program will change its default behaviour by: - disabling any quantitation (since there is none to be done) - enabling negative pixel values Ofcourse, the user will be notified of this change in settings. Would this be OK? Or should I still persist on the user to implicitly select and allow negative pixel values ... hmmm. A dilemma! Now the user won't be confused by missing pixel info but we lost a certain degree of freedom ... - QUANTITATION Some formats support quantified values, either stored in floats or through integer pixels combined with a float global rescale factor or a float slope & intercept pair; also referred to as linear (a*x) or affine (a*x+b) transformation. For various (un)reasonable motivations, quantitation is not supported by default. It must be selected by the user. From version 0.7.0 quantitation can be combined with negative pixel values. To enable quantitation: command line: use the option '-qs' or '-qc' graphical : see Options||MedCon||Pixels||Values 1. affine transformation (generic = a*x+b) --------------------- /* general code for "affine" rescale to new pixeltype */ { scale = max_new_pixeltype / (max_image_value - min_image_value); new_image_value = scale * (original_image_value - min_image_value); } /* 'max_image_value' and/or 'min_image_value' could be negative! */ In case of negative minimal values however, the above requires a format that supports the slope and intercept concept in order to preserve the quantified float values where: (a) slope = 1/scale; (b) intercept = min_image_value; Until now, only DICOM supports this affine transformation, therefore we give preference to the linear version. 2. linear transformation (specific = a*x) --------------------- The linear transformation is possible whenever the minimal negative value can be transformed within the negative pixel range, using the same scale factor as for the positive pixel range. In other words, the condition for linear transformation support is: scale * min_image_value >= min_new_pixeltype That way, the linear transform can be as simple as: /* general code for "linear" rescale to new pixeltype */ { scale = max_new_pixeltype / max_image_value; new_image_value = scale * original_image_value; } ************* FORMATS: ======= ECAT6: We check the format on the value of 'mh.system_type==ECAT_SYST_TYPE'. Change the value of ECAT_SYST_TYPE to your approriate system type in the source code (see the file: m-ecat64.h). For (X)MedCon however, if DICOM is unsupported, we automatically try to read as ECAT when the format was not found or you can use the option '-fb-ecat' to select ECAT as the fallback read format. The patient/slice orientation (see Acr/Nema) is always considered as MDC_SUPINE_HEADFIRST_TRANSAXIAL ... ************* DICOM: We check the format on the presence of the signature "DICM" (X)MedCon will automatically try to read as DICOM in case the format was not found. So DICOM files without MetaHeader can be read as such. Writing is only supported for reconstructed NM modality and Int16 pixels. For display with contrast remap (window center/width and rescale slope/intercept) you should select the '-contrast' option. (CT,MR) For quantitation (with rescale slope/intercept) you should select the quantification or calibration option '-qs' or '-qc'. (NM,PT) ************* GIF: We found one image that didn't compress well with the original code. See "eNlf: BUG??" notes in the code. Our workaround of (byte_offset >= 253) could perhaps fail on other images! ************* Acr/Nema: We do attempt to preserve some extra (DICOM) tags in our Acr/Nema files concerning the patient/slice orientation and position. ************* InterFile: We try to preserve the patient/slice orientation and position. But the format misses some specifications for slice thickness - Tomographic : all voxel dimensions defineable - Static/Dynamic: loses slice thickness (no format specification) ************* Analyze: We would like to preserve the patient/slice orientation and position, however, the SPM software doesn't seem to interpret the value of 'orient' (patient orientation)! For our main format ECAT this was no problem, except that we had to change the direction of all axis with the use of options '-fv -fh -rs'. Another problem are the "flipped" versions of 'orient': we don't know what the meaning of "flipped" is (feet first instead of head first, or prone instead of supine, or vice versa ...) so we ignore this and always consider the patient orientation as MDC_SUPINE_HEADFIRST_ ... Filenames are no longer truncated to 18 chars for filling up the db_name[18] entry in the header. If you need this, uncomment the line with ANLZ_SHORT_FILENAME (see the file: m-anlz.h) With quantitation support, the default pixel value will be floats. The SPM-like version can be enabled with the '-spm' option. In this case, quantitation will be supported by the global scale factor in combination with integer pixel values. If however quantitation failed because an affine transform with slope/intercept was required, just leave out the option so (X)MedCon will write with normal float values. ************* NIfTI: (NIFTI) The package now contains an integrated version of the C library, as found on the following site: For using your own library version, you must compile/install it first. Afterwards, you can compile (X)MedCon with NIfTI support enabled by performing a proper configure, before the actual make process: $> ./configure --enable-nifti --with-nifti-prefix=/usr/local Quantitation should be preserved; patient orientation is currently lost as we only write Analyze like .nii files. ************* ECAT7: writing First you must compile the libraries "libtpcmisc" and "libtpcimgio" from the Turku PET Centre (TPC): Afterwards, you can compile (X)MedCon with ECAT7 writing enabled, by simply issuing the related configure options: $> ./configure --enable-tpc --with-tpc-prefix=/dir/with/tpc Make sure the prefix directory contains two subdirs, "include" and "lib" with copied header files (.h) and static libraries (.a) respectively. ************* xmedcon-0.14.1/ChangeLog0000644000175000017510000000000011152103401011700 00000000000000xmedcon-0.14.1/configure0000755000175000017510000172707612637622763012125 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for XMedCon 0.14.1. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: enlf-at-users.sf.net about your system, including any $0: error possibly output before this message. Then install $0: a modern shell, or manually run the script under such a $0: shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='XMedCon' PACKAGE_TARNAME='xmedcon' PACKAGE_VERSION='0.14.1' PACKAGE_STRING='XMedCon 0.14.1' PACKAGE_BUGREPORT='enlf-at-users.sf.net' PACKAGE_URL='' ac_default_prefix=/usr/local/xmedcon # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS mdc_cv_enable_lnglng ac_cv_sizeof_long_long ac_cv_sizeof_long ac_cv_sizeof_int ac_cv_sizeof_short mdc_cv_bigendian DECOMPRESS XMDCETC GTKSUPPORTED GTKONE GLIBMDCETC GLIBSUPPORTED mdc_cv_gui mdc_cv_glibsupport mdc_cv_ljpg mdc_cv_include_tpc mdc_cv_include_nifti mdc_cv_include_png mdc_cv_include_dicm mdc_cv_include_anlz mdc_cv_include_intf mdc_cv_include_ecat mdc_cv_include_conc mdc_cv_include_inw mdc_cv_include_acr mdc_cv_include_gif TPC_CFLAGS TPC_LDFLAGS NIFTI_CFLAGS NIFTI_LDFLAGS PNG_LDFLAGS ZLIB_CFLAGS ZLIB_LDFLAGS ENABLE_TPC ENABLE_NIFTI ENABLE_PNG ENABLE_DICM ENABLE_INTF ENABLE_ECAT ENABLE_CONC ENABLE_ANLZ ENABLE_INW ENABLE_GIF ENABLE_ACR XMEDCON_LIBVERS XMEDCON_VERSION XMEDCON_DATE XMEDCON_PRGR XMEDCON_MICRO XMEDCON_MINOR XMEDCON_MAJOR DO_GUI_FALSE DO_GUI_TRUE DO_GLIBSUPPORT_FALSE DO_GLIBSUPPORT_TRUE DO_LJPG_FALSE DO_LJPG_TRUE DO_TPC_INTERNAL_FALSE DO_TPC_INTERNAL_TRUE DO_TPC_FALSE DO_TPC_TRUE DO_NIFTI_INTERNAL_FALSE DO_NIFTI_INTERNAL_TRUE DO_NIFTI_FALSE DO_NIFTI_TRUE DO_PNG_FALSE DO_PNG_TRUE DO_DICM_FALSE DO_DICM_TRUE DO_INTF_FALSE DO_INTF_TRUE DO_ECAT_FALSE DO_ECAT_TRUE DO_CONC_FALSE DO_CONC_TRUE DO_ANLZ_FALSE DO_ANLZ_TRUE DO_INW_FALSE DO_INW_TRUE DO_GIF_FALSE DO_GIF_TRUE DO_ACR_FALSE DO_ACR_TRUE XMEDCON_GTK_LIBS XMEDCON_GTK_CFLAGS XMEDCON_GLIB_LIBS XMEDCON_GLIB_CFLAGS PNG_LIBS PNG_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG PLATFORM_WIN32_FALSE PLATFORM_WIN32_TRUE OS_WIN32_FALSE OS_WIN32_TRUE CPP LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC LIBTOOL OBJDUMP DLLTOOL AS host_os host_vendor host_cpu host build_os build_vendor build_cpu build AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_acr enable_gif enable_inw enable_anlz enable_conc enable_ecat enable_intf enable_dicom enable_png enable_nifti enable_ljpg enable_tpc enable_glib enable_gui enable_llcheck enable_silent_rules enable_shared enable_static with_pic enable_fast_install with_aix_soname enable_dependency_tracking with_gnu_ld with_sysroot enable_libtool_lock with_nifti_prefix with_tpc_prefix ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS LT_SYS_LIBRARY_PATH CPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PNG_CFLAGS PNG_LIBS XMEDCON_GLIB_CFLAGS XMEDCON_GLIB_LIBS XMEDCON_GTK_CFLAGS XMEDCON_GTK_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures XMedCon 0.14.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/xmedcon] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of XMedCon 0.14.1:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-acr enable Acr/Nema 2.0 format (default). --disable-acr disable Acr/Nema 2.0 format. --enable-gif enable Gif87a/89a format (default). --disable-gif disable Gif87a/89a format. --enable-inw enable INW (RUG) format (default). --disable-inw disable INW (RUG) format. --enable-anlz enable Analyze (SPM) format (default). --disable-anlz disable Analyze (SPM) format. --enable-conc enable Concorde microPET format (default). --disable-conc disable Concorde microPET format. --enable-ecat enable CTI ECAT 6/7 format (default). --disable-ecat disable CTI ECAT 6/7 format. --enable-intf enable InterFile 3.3 format (default). --disable-intf disable InterFile 3.3 format. --enable-dicom enable DICOM 3.0 format (default). --disable-dicom disable DICOM 3.0 format. --enable-png enable PNG format (default). --disable-png disable PNG format. --enable-nifti enable NIFTI format (default). --disable-nifti disable NIFTI format. --enable-ljpg enable DICOM lossless jpeg (default). --disable-ljpg disable DICOM lossless jpeg. --enable-tpc enable TPC ecat7 writing support (default). --disable-tpc disable TPC ecat7 writing support. --enable-glib enable glib convience functions (default). --disable-glib disable glib convience functions. --enable-gui enable graphical user interface (default). --disable-gui disable graphical user interface. --enable-llcheck enable long long type check. --disable-llcheck disable long long type check (default). --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --disable-libtool-lock avoid locking (might break parallel builds) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-nifti-prefix=PFX Prefix where NIFTI library is installed (optional) --with-tpc-prefix=PFX Prefix where TPC library is installed (optional) Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory LT_SYS_LIBRARY_PATH User-defined run-time library search path. CPP C preprocessor PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path PNG_CFLAGS C compiler flags for PNG, overriding pkg-config PNG_LIBS linker flags for PNG, overriding pkg-config XMEDCON_GLIB_CFLAGS C compiler flags for XMEDCON_GLIB, overriding pkg-config XMEDCON_GLIB_LIBS linker flags for XMEDCON_GLIB, overriding pkg-config XMEDCON_GTK_CFLAGS C compiler flags for XMEDCON_GTK, overriding pkg-config XMEDCON_GTK_LIBS linker flags for XMEDCON_GTK, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF XMedCon configure 0.14.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## ----------------------------------- ## ## Report this to enlf-at-users.sf.net ## ## ----------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid; break else as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=$ac_mid; break else as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid else as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval () { return $2; } static unsigned long int ulongval () { return $2; } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : echo >>conftest.val; read $3 config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by XMedCon $as_me 0.14.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu XMEDCON_MAJOR="0" XMEDCON_MINOR="14" XMEDCON_MICRO="1" XMEDCON_PRGR="(X)MedCon" XMEDCON_DATE="26-dec-2015" XMEDCON_VERSION="${XMEDCON_MAJOR}.${XMEDCON_MINOR}.${XMEDCON_MICRO}" XMEDCON_LIBVERS="${XMEDCON_PRGR} ${XMEDCON_VERSION} by Erik Nolf" echo "" echo "BEGIN SPECIFIC CONFIG:" # Check whether --enable-acr was given. if test "${enable_acr+set}" = set; then : enableval=$enable_acr; case "$enableval" in no) if ${mdc_cv_include_acr+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_acr=no fi ENABLE_ACR=0 ;; *) if ${mdc_cv_include_acr+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_acr=yes fi ENABLE_ACR=1 ;; esac else if ${mdc_cv_include_acr+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_acr=yes fi ENABLE_ACR=1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Format Acr/Nema 2.0 enabled? ${mdc_cv_include_acr}" >&5 $as_echo "Format Acr/Nema 2.0 enabled? ${mdc_cv_include_acr}" >&6; } # Check whether --enable-gif was given. if test "${enable_gif+set}" = set; then : enableval=$enable_gif; case "$enableval" in no) if ${mdc_cv_include_gif+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_gif=no fi ENABLE_GIF=0 ;; *) if ${mdc_cv_include_acr+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_gif=yes fi ENABLE_GIF=1 ;; esac else if ${mdc_cv_include_gif+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_gif=yes fi ENABLE_GIF=1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Format Gif87a/89a enabled? ${mdc_cv_include_gif}" >&5 $as_echo "Format Gif87a/89a enabled? ${mdc_cv_include_gif}" >&6; } # Check whether --enable-inw was given. if test "${enable_inw+set}" = set; then : enableval=$enable_inw; case "$enableval" in no) if ${mdc_cv_include_inw+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_inw=no fi ENABLE_INW=0 ;; *) if ${mdc_cv_include_inw+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_inw=yes fi ENABLE_INW=1 ;; esac else if ${mdc_cv_include_inw+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_inw=yes fi ENABLE_INW=1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Format INW (RUG) enabled? ${mdc_cv_include_inw}" >&5 $as_echo "Format INW (RUG) enabled? ${mdc_cv_include_inw}" >&6; } # Check whether --enable-anlz was given. if test "${enable_anlz+set}" = set; then : enableval=$enable_anlz; case "$enableval" in no) if ${mdc_cv_include_anlz+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_anlz=no fi ENABLE_ANLZ=0 ;; *) if ${mdc_cv_include_anlz+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_anlz=yes fi ENABLE_ANLZ=1 ;; esac else if ${mdc_cv_include_anlz+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_anlz=yes fi ENABLE_ANLZ=1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Format Analyze (SPM) enabled? ${mdc_cv_include_anlz}" >&5 $as_echo "Format Analyze (SPM) enabled? ${mdc_cv_include_anlz}" >&6; } # Check whether --enable-conc was given. if test "${enable_conc+set}" = set; then : enableval=$enable_conc; case "$enableval" in no) if ${mdc_cv_include_conc+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_conc=no fi ENABLE_CONC=0 ;; *) if ${mdc_cv_include_conc+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_conc=yes fi ENABLE_CONC=1 ;; esac else if ${mdc_cv_include_conc+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_conc=yes fi ENABLE_CONC=1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Format Concorde uPET enabled? ${mdc_cv_include_conc}" >&5 $as_echo "Format Concorde uPET enabled? ${mdc_cv_include_conc}" >&6; } # Check whether --enable-ecat was given. if test "${enable_ecat+set}" = set; then : enableval=$enable_ecat; case "$enableval" in no) if ${mdc_cv_include_ecat+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_ecat=no fi ENABLE_ECAT=0 ;; *) if ${mdc_cv_include_ecat+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_ecat=yes fi ENABLE_ECAT=1 ;; esac else if ${mdc_cv_include_ecat+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_ecat=yes fi ENABLE_ECAT=1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Format CTI ECAT 6/7 enabled? ${mdc_cv_include_ecat}" >&5 $as_echo "Format CTI ECAT 6/7 enabled? ${mdc_cv_include_ecat}" >&6; } # Check whether --enable-intf was given. if test "${enable_intf+set}" = set; then : enableval=$enable_intf; case "$enableval" in no) if ${mdc_cv_include_intf+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_intf=no fi ENABLE_INTF=0 ;; *) if ${mdc_cv_include_intf+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_intf=yes fi ENABLE_INTF=1 ;; esac else if ${mdc_cv_include_intf+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_intf=yes fi ENABLE_INTF=1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Format InterFile 3.3 enabled? ${mdc_cv_include_intf}" >&5 $as_echo "Format InterFile 3.3 enabled? ${mdc_cv_include_intf}" >&6; } # Check whether --enable-dicom was given. if test "${enable_dicom+set}" = set; then : enableval=$enable_dicom; case "$enableval" in no) if ${mdc_cv_include_dicm+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_dicm=no fi ENABLE_DICM=0 ;; *) if ${mdc_cv_include_dicm+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_dicm=yes fi ENABLE_DICM=1 ;; esac else if ${mdc_cv_include_dicm+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_dicm=yes fi ENABLE_DICM=1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Format DICOM 3.0 enabled? ${mdc_cv_include_dicm}" >&5 $as_echo "Format DICOM 3.0 enabled? ${mdc_cv_include_dicm}" >&6; } if test x"$mdc_cv_include_dicm" = xyes; then if test x"$mdc_cv_include_acr" != xyes; then echo "***" echo "*** Oeps. DICOM needs Acr/Nema to be enabled." echo "*** Therefore rerun configure to do so ..." echo "***" rm -f config.cache exit 1 fi fi # Check whether --enable-png was given. if test "${enable_png+set}" = set; then : enableval=$enable_png; case "$enableval" in no) if ${mdc_cv_include_png+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_png=no fi ENABLE_PNG=0 ;; *) if ${mdc_cv_include_png+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_png=yes fi ENABLE_PNG=1 ;; esac else if ${mdc_cv_include_png+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_png=yes fi ENABLE_PNG=1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Format PNG enabled? ${mdc_cv_include_png}" >&5 $as_echo "Format PNG enabled? ${mdc_cv_include_png}" >&6; } # Check whether --enable-nifti was given. if test "${enable_nifti+set}" = set; then : enableval=$enable_nifti; case "$enableval" in no) if ${mdc_cv_include_nifti+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_nifti=no fi ENABLE_NIFTI=0 ;; *) if ${mdc_cv_include_nifti+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_nifti=yes fi ENABLE_NIFTI=1 ;; esac else if ${mdc_cv_include_nifti+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_nifti=yes fi ENABLE_NIFTI=1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Format NIFTI enabled? ${mdc_cv_include_nifti}" >&5 $as_echo "Format NIFTI enabled? ${mdc_cv_include_nifti}" >&6; } if test x"$mdc_cv_include_dicm" = xyes; then # Check whether --enable-ljpg was given. if test "${enable_ljpg+set}" = set; then : enableval=$enable_ljpg; case "$enableval" in no) if ${mdc_cv_ljpg+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_ljpg=no fi ;; *) if ${mdc_cv_ljpg+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_ljpg=yes fi ;; esac else if ${mdc_cv_ljpg+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_ljpg=yes fi fi else if ${mdc_cv_ljpg+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_ljpg=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Enable DICOM 3.0 lossless jpeg ? ${mdc_cv_ljpg}" >&5 $as_echo "Enable DICOM 3.0 lossless jpeg ? ${mdc_cv_ljpg}" >&6; } # Check whether --enable-tpc was given. if test "${enable_tpc+set}" = set; then : enableval=$enable_tpc; case "$enableval" in no) if ${mdc_cv_include_tpc+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_tpc=no fi ENABLE_TPC=0 ;; *) if ${mdc_cv_include_tpc+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_tpc=yes fi ENABLE_TPC=1 ;; esac else if ${mdc_cv_include_tpc+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_include_tpc=yes fi ENABLE_TPC=1 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Enable TPC ecat7 write support ? ${mdc_cv_include_tpc}" >&5 $as_echo "Enable TPC ecat7 write support ? ${mdc_cv_include_tpc}" >&6; } # Check whether --enable-glib was given. if test "${enable_glib+set}" = set; then : enableval=$enable_glib; case "$enableval" in no) if ${mdc_cv_glibsupport+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_glibsupport=no fi ;; *) if ${mdc_cv_glibsupport+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_glibsupport=yes fi ;; esac else if ${mdc_cv_glibsupport+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_glibsupport=yes fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Enable glib convenience func's ? ${mdc_cv_glibsupport}" >&5 $as_echo "Enable glib convenience func's ? ${mdc_cv_glibsupport}" >&6; } # Check whether --enable-gui was given. if test "${enable_gui+set}" = set; then : enableval=$enable_gui; case "$enableval" in no) if ${mdc_cv_gui+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_gui=no fi ;; *) if ${mdc_cv_gui+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_gui=yes fi ;; esac else if ${mdc_cv_gui+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_gui=yes fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Enable graphical user interface? ${mdc_cv_gui}" >&5 $as_echo "Enable graphical user interface? ${mdc_cv_gui}" >&6; } #dnl use version 1 of glib/gtk #AC_ARG_ENABLE(gtk1, #[ # --enable-gtk1 compile with older glib/gtk version 1 instead of 2. ], #[ # case "$enableval" in # yes) # AC_CACHE_VAL(mdc_cv_gtk_one,mdc_cv_gtk_one=yes) # ;; # *) # AC_CACHE_VAL(mdc_cv_gtk_one,mdc_cv_gtk_one=no) # ;; # esac ], # AC_CACHE_VAL(mdc_cv_gtk_one, mdc_cv_gtk_one=no) #) #AC_MSG_RESULT([Enable older glib/gtk version 1? ${mdc_cv_gtk_one}]) # Check whether --enable-llcheck was given. if test "${enable_llcheck+set}" = set; then : enableval=$enable_llcheck; case "$enableval" in yes) if ${mdc_cv_lnglngcheck+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_lnglngcheck=yes fi ;; *) if ${mdc_cv_lnglngcheck+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_lnglngcheck=no fi ;; esac else if ${mdc_cv_lnglngcheck+:} false; then : $as_echo_n "(cached) " >&6 else mdc_cv_lnglngcheck=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Enable check for long long type? ${mdc_cv_lnglngcheck}" >&5 $as_echo "Enable check for long long type? ${mdc_cv_lnglngcheck}" >&6; } echo "" echo "BEGIN AUTO CONFIG:" am__api_version='1.13' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='xmedcon' VERSION='0.14.1' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AS"; then ac_cv_prog_AS="$AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AS="${ac_tool_prefix}as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AS=$ac_cv_prog_AS if test -n "$AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 $as_echo "$AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_AS"; then ac_ct_AS=$AS # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AS"; then ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AS="as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AS=$ac_cv_prog_ac_ct_AS if test -n "$ac_ct_AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 $as_echo "$ac_ct_AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_AS" = x; then AS="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AS=$ac_ct_AS fi else AS="$ac_cv_prog_AS" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi ;; esac test -z "$AS" && AS=as test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$OBJDUMP" && OBJDUMP=objdump case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.6' macro_revision='2.4.6' ltmain=$ac_aux_dir/ltmain.sh # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case $ECHO in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n "$lt_cv_sys_max_cmd_len"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 $as_echo "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 $as_echo_n "checking for a working dd... " >&6; } if ${ac_cv_path_lt_DD+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in dd; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 $as_echo "$ac_cv_path_lt_DD" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 $as_echo_n "checking how to truncate binary pipes... " >&6; } if ${lt_cv_truncate_bin+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 $as_echo "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else pic_mode=default fi # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac else enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 $as_echo_n "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test "${with_aix_soname+set}" = set; then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else if ${lt_cv_with_aix_soname+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 $as_echo "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o func_cc_basename $compiler cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/${ac_tool_prefix}file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; osf3*) if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi # Handle Gentoo/FreeBSD as it was Linux case $host_vendor in gentoo) version_type=linux ;; *) version_type=freebsd-$objformat ;; esac case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; linux) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' need_lib_prefix=no need_version=no ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen=shl_load else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen=dlopen else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi fi fi fi fi fi ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report what library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC ac_config_commands="$ac_config_commands libtool" # Only expand once: for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for native Win32" >&5 $as_echo_n "checking for native Win32... " >&6; } case "$host" in *-*-mingw*) native_win32=yes ;; *) native_win32=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $native_win32" >&5 $as_echo "$native_win32" >&6; } if test "$native_win32" = yes; then OS_WIN32_TRUE= OS_WIN32_FALSE='#' else OS_WIN32_TRUE='#' OS_WIN32_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Win32 platform in general" >&5 $as_echo_n "checking for Win32 platform in general... " >&6; } case "$host" in *-*-mingw*|*-*-cygwin*) platform_win32=yes ;; *) platform_win32=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $platform_win32" >&5 $as_echo "$platform_win32" >&6; } if test "$platform_win32" = yes; then PLATFORM_WIN32_TRUE= PLATFORM_WIN32_FALSE='#' else PLATFORM_WIN32_TRUE='#' PLATFORM_WIN32_FALSE= fi # Ensure MSVC-compatible struct packing convention is used when # compiling for Win32 with gcc. GTK+ uses this convention, so we must, too. # What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while # gcc2 uses "-fnative-struct". if test x"$native_win32" = xyes; then if test x"$GCC" = xyes; then msnative_struct='' { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to get MSVC-compatible struct packing" >&5 $as_echo_n "checking how to get MSVC-compatible struct packing... " >&6; } if test -z "$ac_cv_prog_CC"; then our_gcc="$CC" else our_gcc="$ac_cv_prog_CC" fi case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in 2.) if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then msnative_struct='-fnative-struct' fi ;; *) if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then msnative_struct='-mms-bitfields' fi ;; esac if test x"$msnative_struct" = x ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no way" >&5 $as_echo "no way" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: produced libraries will be incompatible with prebuilt GTK+ DLLs" >&5 $as_echo "$as_me: WARNING: produced libraries will be incompatible with prebuilt GTK+ DLLs" >&2;} else CFLAGS="$CFLAGS $msnative_struct" { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${msnative_struct}" >&5 $as_echo "${msnative_struct}" >&6; } fi fi fi if test $ENABLE_PNG -gt 0 -o $ENABLE_NIFTI -gt 0; then if test x"$native_win32" = xyes; then ZLIB_LDFLAGS="-L/usr/lib -lz" ZLIB_CLFAGS="-DHAVE_ZLIB" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uncompress in -lz" >&5 $as_echo_n "checking for uncompress in -lz... " >&6; } if ${ac_cv_lib_z_uncompress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char uncompress (); int main () { return uncompress (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_uncompress=yes else ac_cv_lib_z_uncompress=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_uncompress" >&5 $as_echo "$ac_cv_lib_z_uncompress" >&6; } if test "x$ac_cv_lib_z_uncompress" = xyes; then : ZLIB_LDFLAGS="-lz" else ZLIB_LDFLAGS="" fi if test x"$ac_cv_lib_z_uncompress" != xyes; then echo "***" echo "*** Oeps. Couldn't link with zlib required for PNG and NIFTI." echo "*** You will need to rerun the configure script with arguments" echo "*** --disable-png --disable-nifti" echo "***" rm -f config.cache exit 1 else ZLIB_CFLAGS="-DHAVE_ZLIB" fi fi fi if test x"$ZLIB_LDFLAGS" = x; then ENABLE_PNG=0; echo "***" echo "*** WARNING: PNG support disabled. ZLIB not found." echo "***" fi if test $ENABLE_PNG -gt 0; then if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PNG" >&5 $as_echo_n "checking for PNG... " >&6; } if test -n "$PNG_CFLAGS"; then pkg_cv_PNG_CFLAGS="$PNG_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libpng >= 1.2.0 \""; } >&5 ($PKG_CONFIG --exists --print-errors " libpng >= 1.2.0 ") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PNG_CFLAGS=`$PKG_CONFIG --cflags " libpng >= 1.2.0 " 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$PNG_LIBS"; then pkg_cv_PNG_LIBS="$PNG_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" libpng >= 1.2.0 \""; } >&5 ($PKG_CONFIG --exists --print-errors " libpng >= 1.2.0 ") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PNG_LIBS=`$PKG_CONFIG --libs " libpng >= 1.2.0 " 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then PNG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs " libpng >= 1.2.0 " 2>&1` else PNG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs " libpng >= 1.2.0 " 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$PNG_PKG_ERRORS" >&5 HAVE_PNG=no elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } HAVE_PNG=no else PNG_CFLAGS=$pkg_cv_PNG_CFLAGS PNG_LIBS=$pkg_cv_PNG_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } HAVE_PNG=yes fi if test x"$HAVE_PNG" = xno; then echo "***" echo "*** Oeps. Components required for PNG support are missing." echo "*** You will need to rerun the configure script with argument" echo "*** --disable-png" echo "***" rm -f config.cache exit 1 else PNG_LDFLAGS=$PNG_LIBS fi fi prev_LDFLAGS="$LDFLAGS" prev_CPPFLAGS="$CPPFLAGS" # Check whether --with-nifti-prefix was given. if test "${with_nifti_prefix+set}" = set; then : withval=$with_nifti_prefix; nifti_prefix="$withval" else nifti_prefix="" fi if test x"$nifti_prefix" != x; then ZNZ_LDFLAGS="-L$nifti_prefix/lib -lznz" NIFTI_LDFLAGS="-L$nifti_prefix/lib -lniftiio $ZNZ_LDFLAGS" NIFTI_CFLAGS="" as_ac_File=`$as_echo "ac_cv_file_$nifti_prefix/include/nifti/nifti1_io.h" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $nifti_prefix/include/nifti/nifti1_io.h" >&5 $as_echo_n "checking for $nifti_prefix/include/nifti/nifti1_io.h... " >&6; } if eval \${$as_ac_File+:} false; then : $as_echo_n "(cached) " >&6 else test "$cross_compiling" = yes && as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 if test -r "$nifti_prefix/include/nifti/nifti1_io.h"; then eval "$as_ac_File=yes" else eval "$as_ac_File=no" fi fi eval ac_res=\$$as_ac_File { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_File"\" = x"yes"; then : NIFTI_CFLAGS="-I$nifti_prefix/include/nifti" else NIFTI_CFLAGS="-I$nifti_prefix/include" fi LDFLAGS="$LDFLAGS -lm $NIFTI_LDFLAGS $ZLIB_LDFLAGS" CPPFLAGS="$CPPFLAGS $NIFTI_CFLAGS $ZLIB_LDFLAGS" else ZNZ_LDFLAGS="../libs/nifti/libznz.la" NIFTI_LDFLAGS="../libs/nifti/libniftiio.la $ZNZ_LDFLAGS" NIFTI_CFLAGS="-I../libs/nifti" fi if test $ENABLE_NIFTI -gt 0 -a x"$nifti_prefix" != x; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NIFTI support" >&5 $as_echo_n "checking for NIFTI support... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 $as_echo "" >&6; } failed=0; passed=0; ac_fn_c_check_header_mongrel "$LINENO" "nifti1_io.h" "ac_cv_header_nifti1_io_h" "$ac_includes_default" if test "x$ac_cv_header_nifti1_io_h" = xyes; then : passed=`expr $passed + 1` else failed=`expr $failed + 1` fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nifti_read_header in -lniftiio" >&5 $as_echo_n "checking for nifti_read_header in -lniftiio... " >&6; } if ${ac_cv_lib_niftiio_nifti_read_header+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lniftiio $ZNZ_LDFLAGS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char nifti_read_header (); int main () { return nifti_read_header (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_niftiio_nifti_read_header=yes else ac_cv_lib_niftiio_nifti_read_header=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_niftiio_nifti_read_header" >&5 $as_echo "$ac_cv_lib_niftiio_nifti_read_header" >&6; } if test "x$ac_cv_lib_niftiio_nifti_read_header" = xyes; then : passed=`expr $passed + 1` else failed=`expr $failed + 1` fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if NIFTI package is complete" >&5 $as_echo_n "checking if NIFTI package is complete... " >&6; } if test $passed -gt 0 then if test $failed -gt 0 then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ENABLE_NIFTI=0 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } ENABLE_NIFTI=1 fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ENABLE_NIFTI=0 fi if test $ENABLE_NIFTI -lt 1; then echo "***" echo "*** Oeps. Components required for NIFTI support are missing." echo "*** You will need to rerun the configure script with argument" echo "*** --disable-nifti or give a proper value to --with-nifti-prefix." echo "***" rm -f config.cache exit 1 fi fi LDFLAGS="$prev_LDFLAGS" CPPFLAGS="$prev_CPPFLAGS" prev_LDFLAGS="$LDFLAGS" prev_CPPFLAGS="$CPPFLAGS" # Check whether --with-tpc-prefix was given. if test "${with_tpc_prefix+set}" = set; then : withval=$with_tpc_prefix; tpc_prefix="$withval" else tpc_prefix="" fi if test x"$tpc_prefix" != x; then TPC_LDFLAGS="-L$tpc_prefix/lib -ltpcimgio -L$tpc_prefix/lib -ltpcmisc" TPC_CFLAGS="-I$tpc_prefix/include" LDFLAGS="$LDFLAGS $TPC_LDFLAGS" CPPFLAGS="$CPPFLAGS $TPC_CFLAGS" else TPC_LDFLAGS="../libs/tpc/libtpcmisc.la ../libs/tpc/libtpcimgio.la" TPC_CFLAGS="-I../libs/tpc" fi if test $ENABLE_TPC -gt 0 -a x"$tpc_prefix" != x; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TPC ecat7 writing support" >&5 $as_echo_n "checking for TPC ecat7 writing support... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 $as_echo "" >&6; } failed=0; passed=0; ac_fn_c_check_header_mongrel "$LINENO" "ecat7.h" "ac_cv_header_ecat7_h" "$ac_includes_default" if test "x$ac_cv_header_ecat7_h" = xyes; then : passed=`expr $passed + 1` else failed=`expr $failed + 1` fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ecat7Create in -ltpcimgio" >&5 $as_echo_n "checking for ecat7Create in -ltpcimgio... " >&6; } if ${ac_cv_lib_tpcimgio_ecat7Create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltpcimgio $TPC_LDFLAGS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ecat7Create (); int main () { return ecat7Create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_tpcimgio_ecat7Create=yes else ac_cv_lib_tpcimgio_ecat7Create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tpcimgio_ecat7Create" >&5 $as_echo "$ac_cv_lib_tpcimgio_ecat7Create" >&6; } if test "x$ac_cv_lib_tpcimgio_ecat7Create" = xyes; then : passed=`expr $passed + 1` else failed=`expr $failed + 1` fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if TPC library is complete" >&5 $as_echo_n "checking if TPC library is complete... " >&6; } if test $passed -gt 0 then if test $failed -gt 0 then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ENABLE_TPC=0 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } ENABLE_TPC=1 fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ENABLE_TPC=0 fi if test $ENABLE_TPC -lt 1; then echo "***" echo "*** Oeps. Components required for TPC ecat7 writing are missing." echo "*** You will need to rerun the configure script with argument" echo "*** --disable-tpc or give a proper value to --with-tpc-prefix." echo "***" rm -f config.cache exit 1 fi fi LDFLAGS="$prev_LDFLAGS" CPPFLAGS="$prev_CPPFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } if ${ac_cv_type_signal+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_signal=int else ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF for ac_func in strptime do : ac_fn_c_check_func "$LINENO" "strptime" "ac_cv_func_strptime" if test "x$ac_cv_func_strptime" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRPTIME 1 _ACEOF fi done for ac_func in localtime_r do : ac_fn_c_check_func "$LINENO" "localtime_r" "ac_cv_func_localtime_r" if test "x$ac_cv_func_localtime_r" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LOCALTIME_R 1 _ACEOF fi done for ac_func in isnan do : ac_fn_c_check_func "$LINENO" "isnan" "ac_cv_func_isnan" if test "x$ac_cv_func_isnan" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ISNAN 1 _ACEOF fi done for ac_func in isinf do : ac_fn_c_check_func "$LINENO" "isinf" "ac_cv_func_isinf" if test "x$ac_cv_func_isinf" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ISINF 1 _ACEOF fi done if test x"$mdc_cv_glibsupport" = xyes; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XMEDCON_GLIB" >&5 $as_echo_n "checking for XMEDCON_GLIB... " >&6; } if test -n "$XMEDCON_GLIB_CFLAGS"; then pkg_cv_XMEDCON_GLIB_CFLAGS="$XMEDCON_GLIB_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" glib-2.0 >= 2.0.0 \""; } >&5 ($PKG_CONFIG --exists --print-errors " glib-2.0 >= 2.0.0 ") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_XMEDCON_GLIB_CFLAGS=`$PKG_CONFIG --cflags " glib-2.0 >= 2.0.0 " 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$XMEDCON_GLIB_LIBS"; then pkg_cv_XMEDCON_GLIB_LIBS="$XMEDCON_GLIB_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" glib-2.0 >= 2.0.0 \""; } >&5 ($PKG_CONFIG --exists --print-errors " glib-2.0 >= 2.0.0 ") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_XMEDCON_GLIB_LIBS=`$PKG_CONFIG --libs " glib-2.0 >= 2.0.0 " 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then XMEDCON_GLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs " glib-2.0 >= 2.0.0 " 2>&1` else XMEDCON_GLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs " glib-2.0 >= 2.0.0 " 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$XMEDCON_GLIB_PKG_ERRORS" >&5 as_fn_error $? "Package requirements ( glib-2.0 >= 2.0.0 ) were not met: $XMEDCON_GLIB_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables XMEDCON_GLIB_CFLAGS and XMEDCON_GLIB_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables XMEDCON_GLIB_CFLAGS and XMEDCON_GLIB_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else XMEDCON_GLIB_CFLAGS=$pkg_cv_XMEDCON_GLIB_CFLAGS XMEDCON_GLIB_LIBS=$pkg_cv_XMEDCON_GLIB_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi GLIBSUPPORTED=1 else GLIBSUPPORTED=0 fi if test x"$mdc_cv_gui" = xyes; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XMEDCON_GTK" >&5 $as_echo_n "checking for XMEDCON_GTK... " >&6; } if test -n "$XMEDCON_GTK_CFLAGS"; then pkg_cv_XMEDCON_GTK_CFLAGS="$XMEDCON_GTK_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" gdk-pixbuf-2.0 >= 2.0.0 gtk+-2.0 >= 2.0.0 \""; } >&5 ($PKG_CONFIG --exists --print-errors " gdk-pixbuf-2.0 >= 2.0.0 gtk+-2.0 >= 2.0.0 ") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_XMEDCON_GTK_CFLAGS=`$PKG_CONFIG --cflags " gdk-pixbuf-2.0 >= 2.0.0 gtk+-2.0 >= 2.0.0 " 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$XMEDCON_GTK_LIBS"; then pkg_cv_XMEDCON_GTK_LIBS="$XMEDCON_GTK_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \" gdk-pixbuf-2.0 >= 2.0.0 gtk+-2.0 >= 2.0.0 \""; } >&5 ($PKG_CONFIG --exists --print-errors " gdk-pixbuf-2.0 >= 2.0.0 gtk+-2.0 >= 2.0.0 ") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_XMEDCON_GTK_LIBS=`$PKG_CONFIG --libs " gdk-pixbuf-2.0 >= 2.0.0 gtk+-2.0 >= 2.0.0 " 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then XMEDCON_GTK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs " gdk-pixbuf-2.0 >= 2.0.0 gtk+-2.0 >= 2.0.0 " 2>&1` else XMEDCON_GTK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs " gdk-pixbuf-2.0 >= 2.0.0 gtk+-2.0 >= 2.0.0 " 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$XMEDCON_GTK_PKG_ERRORS" >&5 as_fn_error $? "Package requirements ( gdk-pixbuf-2.0 >= 2.0.0 gtk+-2.0 >= 2.0.0 ) were not met: $XMEDCON_GTK_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables XMEDCON_GTK_CFLAGS and XMEDCON_GTK_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables XMEDCON_GTK_CFLAGS and XMEDCON_GTK_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else XMEDCON_GTK_CFLAGS=$pkg_cv_XMEDCON_GTK_CFLAGS XMEDCON_GTK_LIBS=$pkg_cv_XMEDCON_GTK_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi GTKSUPPORTED=1 else GTKSUPPORTED=0 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GUI support" >&5 $as_echo_n "checking for GUI support... " >&6; } if test $GTKSUPPORTED -eq 1; then if test x${prefix} != xNONE ; then XMDCETC=${prefix}/etc else XMDCETC=${ac_default_prefix}/etc fi mdc_cv_gui=yes echo "yes" else XMDCETC="" mdc_cv_gui=no echo "no" fi if test x"$mdc_cv_include_acr" = xyes; then DO_ACR_TRUE= DO_ACR_FALSE='#' else DO_ACR_TRUE='#' DO_ACR_FALSE= fi if test x"$mdc_cv_include_gif" = xyes; then DO_GIF_TRUE= DO_GIF_FALSE='#' else DO_GIF_TRUE='#' DO_GIF_FALSE= fi if test x"$mdc_cv_include_inw" = xyes; then DO_INW_TRUE= DO_INW_FALSE='#' else DO_INW_TRUE='#' DO_INW_FALSE= fi if test x"$mdc_cv_include_anlz" = xyes; then DO_ANLZ_TRUE= DO_ANLZ_FALSE='#' else DO_ANLZ_TRUE='#' DO_ANLZ_FALSE= fi if test x"$mdc_cv_include_conc" = xyes; then DO_CONC_TRUE= DO_CONC_FALSE='#' else DO_CONC_TRUE='#' DO_CONC_FALSE= fi if test x"$mdc_cv_include_ecat" = xyes; then DO_ECAT_TRUE= DO_ECAT_FALSE='#' else DO_ECAT_TRUE='#' DO_ECAT_FALSE= fi if test x"$mdc_cv_include_intf" = xyes; then DO_INTF_TRUE= DO_INTF_FALSE='#' else DO_INTF_TRUE='#' DO_INTF_FALSE= fi if test x"$mdc_cv_include_dicm" = xyes; then DO_DICM_TRUE= DO_DICM_FALSE='#' else DO_DICM_TRUE='#' DO_DICM_FALSE= fi if test x"$mdc_cv_include_png" = xyes; then DO_PNG_TRUE= DO_PNG_FALSE='#' else DO_PNG_TRUE='#' DO_PNG_FALSE= fi if test x"$mdc_cv_include_nifti" = xyes; then DO_NIFTI_TRUE= DO_NIFTI_FALSE='#' else DO_NIFTI_TRUE='#' DO_NIFTI_FALSE= fi if test x"$nifti_prefix" = x; then DO_NIFTI_INTERNAL_TRUE= DO_NIFTI_INTERNAL_FALSE='#' else DO_NIFTI_INTERNAL_TRUE='#' DO_NIFTI_INTERNAL_FALSE= fi if test x"$mdc_cv_include_tpc" = xyes; then DO_TPC_TRUE= DO_TPC_FALSE='#' else DO_TPC_TRUE='#' DO_TPC_FALSE= fi if test x"$tpc_prefix" = x; then DO_TPC_INTERNAL_TRUE= DO_TPC_INTERNAL_FALSE='#' else DO_TPC_INTERNAL_TRUE='#' DO_TPC_INTERNAL_FALSE= fi if test x"$mdc_cv_ljpg" = xyes; then DO_LJPG_TRUE= DO_LJPG_FALSE='#' else DO_LJPG_TRUE='#' DO_LJPG_FALSE= fi if test x"$mdc_cv_glibsupport" = xyes; then DO_GLIBSUPPORT_TRUE= DO_GLIBSUPPORT_FALSE='#' else DO_GLIBSUPPORT_TRUE='#' DO_GLIBSUPPORT_FALSE= fi if test x"$mdc_cv_gui" = xyes; then DO_GUI_TRUE= DO_GUI_FALSE='#' else DO_GUI_TRUE='#' DO_GUI_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac if test x"$ac_cv_c_bigendian" = xyes; then mdc_cv_bigendian=1 else mdc_cv_bigendian=0 fi # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 $as_echo_n "checking size of short... " >&6; } if ${ac_cv_sizeof_short+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : else if test "$ac_cv_type_short" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (short) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_short=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 $as_echo "$ac_cv_sizeof_short" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } if ${ac_cv_sizeof_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : else if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 $as_echo "$ac_cv_sizeof_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } if ${ac_cv_sizeof_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 $as_echo "$ac_cv_sizeof_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF if test x"$mdc_cv_lnglngcheck" = xyes; then # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } if ${ac_cv_sizeof_long_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 $as_echo "$ac_cv_sizeof_long_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF fi for ac_prog in gunzip uncompress do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DECOMPRESS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DECOMPRESS"; then ac_cv_prog_DECOMPRESS="$DECOMPRESS" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DECOMPRESS="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DECOMPRESS=$ac_cv_prog_DECOMPRESS if test -n "$DECOMPRESS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DECOMPRESS" >&5 $as_echo "$DECOMPRESS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DECOMPRESS" && break done test -n "$DECOMPRESS" || DECOMPRESS="none" ac_config_headers="$ac_config_headers source/m-depend.h" if test x"$mdc_cv_lnglngcheck" = xyes; then mdc_cv_enable_lnglng=1 else mdc_cv_enable_lnglng=0 fi ac_config_files="$ac_config_files Makefile xmedcon-config libs/Makefile libs/ljpg/Makefile libs/dicom/Makefile libs/nifti/Makefile libs/tpc/Makefile macros/Makefile source/Makefile source/m-config.h etc/Makefile etc/xmedcon.spec etc/xmedcon-$VERSION-1.iss:etc/xmedcon.iss.in etc/xmedcon-$VERSION-1.info:etc/xmedcon.info.in etc/xmedcon-$VERSION.ebuild:etc/xmedcon.ebuild.in man/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${OS_WIN32_TRUE}" && test -z "${OS_WIN32_FALSE}"; then as_fn_error $? "conditional \"OS_WIN32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${PLATFORM_WIN32_TRUE}" && test -z "${PLATFORM_WIN32_FALSE}"; then as_fn_error $? "conditional \"PLATFORM_WIN32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DO_ACR_TRUE}" && test -z "${DO_ACR_FALSE}"; then as_fn_error $? "conditional \"DO_ACR\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DO_GIF_TRUE}" && test -z "${DO_GIF_FALSE}"; then as_fn_error $? "conditional \"DO_GIF\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DO_INW_TRUE}" && test -z "${DO_INW_FALSE}"; then as_fn_error $? "conditional \"DO_INW\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DO_ANLZ_TRUE}" && test -z "${DO_ANLZ_FALSE}"; then as_fn_error $? "conditional \"DO_ANLZ\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DO_CONC_TRUE}" && test -z "${DO_CONC_FALSE}"; then as_fn_error $? "conditional \"DO_CONC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DO_ECAT_TRUE}" && test -z "${DO_ECAT_FALSE}"; then as_fn_error $? "conditional \"DO_ECAT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DO_INTF_TRUE}" && test -z "${DO_INTF_FALSE}"; then as_fn_error $? "conditional \"DO_INTF\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DO_DICM_TRUE}" && test -z "${DO_DICM_FALSE}"; then as_fn_error $? "conditional \"DO_DICM\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DO_PNG_TRUE}" && test -z "${DO_PNG_FALSE}"; then as_fn_error $? "conditional \"DO_PNG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DO_NIFTI_TRUE}" && test -z "${DO_NIFTI_FALSE}"; then as_fn_error $? "conditional \"DO_NIFTI\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DO_NIFTI_INTERNAL_TRUE}" && test -z "${DO_NIFTI_INTERNAL_FALSE}"; then as_fn_error $? "conditional \"DO_NIFTI_INTERNAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DO_TPC_TRUE}" && test -z "${DO_TPC_FALSE}"; then as_fn_error $? "conditional \"DO_TPC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DO_TPC_INTERNAL_TRUE}" && test -z "${DO_TPC_INTERNAL_FALSE}"; then as_fn_error $? "conditional \"DO_TPC_INTERNAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DO_LJPG_TRUE}" && test -z "${DO_LJPG_FALSE}"; then as_fn_error $? "conditional \"DO_LJPG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DO_GLIBSUPPORT_TRUE}" && test -z "${DO_GLIBSUPPORT_FALSE}"; then as_fn_error $? "conditional \"DO_GLIBSUPPORT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${DO_GUI_TRUE}" && test -z "${DO_GUI_FALSE}"; then as_fn_error $? "conditional \"DO_GUI\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by XMedCon $as_me 0.14.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ XMedCon config.status 0.14.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in AS \ DLLTOOL \ OBJDUMP \ SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "source/m-depend.h") CONFIG_HEADERS="$CONFIG_HEADERS source/m-depend.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "xmedcon-config") CONFIG_FILES="$CONFIG_FILES xmedcon-config" ;; "libs/Makefile") CONFIG_FILES="$CONFIG_FILES libs/Makefile" ;; "libs/ljpg/Makefile") CONFIG_FILES="$CONFIG_FILES libs/ljpg/Makefile" ;; "libs/dicom/Makefile") CONFIG_FILES="$CONFIG_FILES libs/dicom/Makefile" ;; "libs/nifti/Makefile") CONFIG_FILES="$CONFIG_FILES libs/nifti/Makefile" ;; "libs/tpc/Makefile") CONFIG_FILES="$CONFIG_FILES libs/tpc/Makefile" ;; "macros/Makefile") CONFIG_FILES="$CONFIG_FILES macros/Makefile" ;; "source/Makefile") CONFIG_FILES="$CONFIG_FILES source/Makefile" ;; "source/m-config.h") CONFIG_FILES="$CONFIG_FILES source/m-config.h" ;; "etc/Makefile") CONFIG_FILES="$CONFIG_FILES etc/Makefile" ;; "etc/xmedcon.spec") CONFIG_FILES="$CONFIG_FILES etc/xmedcon.spec" ;; "etc/xmedcon-$VERSION-1.iss") CONFIG_FILES="$CONFIG_FILES etc/xmedcon-$VERSION-1.iss:etc/xmedcon.iss.in" ;; "etc/xmedcon-$VERSION-1.info") CONFIG_FILES="$CONFIG_FILES etc/xmedcon-$VERSION-1.info:etc/xmedcon.info.in" ;; "etc/xmedcon-$VERSION.ebuild") CONFIG_FILES="$CONFIG_FILES etc/xmedcon-$VERSION.ebuild:etc/xmedcon.ebuild.in" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG # Assembler program. AS=$lt_AS # DLL creation program. DLLTOOL=$lt_DLLTOOL # Object dumper program. OBJDUMP=$lt_OBJDUMP # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain=$ac_aux_dir/ltmain.sh # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi xmedcon-0.14.1/README0000644000175000017510000001642311442766441011053 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: README # # # # UTILITY text: Medical Image Conversion Utility # # # # purpose : the (X)MedCon 'you-should-read' file # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: README,v 1.25 2010/09/11 20:57:05 enlf Exp $ Introduction: ------------ Here you can read first line information about the configuration, installation and other issues related to (X)MedCon, a medical image conversion utility. License & Copyright notices: --------------------------- 1. Read the files 'COPYING' & 'COPYING.LIB' 2. m-gif.c: a) changed original code GIF reader/writer copyright (c) 1991 Alchemy Mindworks, Inc. b) Unisys Patent License ;-P "No license or license fees are required for non-commercial, not-for-profit GIF-based applications or for non-commercial, not-for-profit GIF-freeware, so long as the LZW capability provided is only for GIF. However, a license is required if freeware is incorporated into, or sold or distributed with a commercial or for-profit product, introduced in 1995 [or later], or enhancements of products that were introduced prior to 1995." 3. m-matrix.h: changed original code 'matrix.h' "2.6 10/19/93 Copyright 1989-1993 CTI PET Systems, Inc." m-matrix.c: changed original code 'matrix.c' "2.2 10/19/93 Copyright 1989-1993 CTI PET Systems, Inc." Most changes applied for host endian independence. 4. m-qmedian.c: code adapted from 'tiffmedian.c' (see http://www.libtiff.org) Copyright (c) 1988-1997 Sam Leffler Copyright (c) 1991-1997 Silicon Graphics, Inc. "Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that (i) the above copyright notices and this permission notice appear in all copies of the software and related documentation, and (ii) the names of Sam Leffler and Silicon Graphics may not be used in any advertising or publicity relating to the software without the specific, prior written permission of Sam Leffler and Silicon Graphics." 5. DICOM 3.0 a) original library (libdicom 0.31 - 1998) ---------------- Contributed by Tony Voet, released under the GNU (L)GPL license. Quite some changes have been made since. b) dictionary (dict-dicom.dic) ---------- Dictionary borrowed from the superb OFFIS DCMTK Toolkit "Copyright (C) 1994-2001, OFFIS" (see http://www.offis.uni-oldenburg.de) For the full copyright & license notices see the "libs/dicom/README" file. c) encapsulated pixeldata (rle, lossless jpeg) ---------------------- Contributed by Jaslet Bertrand, released under the GNU (L)GPL license. However, the lossless jpeg library (LJPG) is based in part on the work of: a) Cornell University LossLess JPEG lib (see ftp://ftp.cs.cornell.edu) Copyright (c) 1993 Cornell University, Kongji Huang All rights reserved. Copyright (c) 1993 The Regents of the University of California, Brian C. Smith. All rights reserved. b) Independent JPEG Group's JPEG software (see http://www.ijg.org) This software is copyright (C) 1991, 1992, Thomas G. Lane. All Rights Reserved. For the full copyright & license notices see the "libs/ljpg/README" file. 6. NIfTI For more information on the code borrowed: See the niftilib webpage at http://niftilib.sourceforge.net/ See the NIfTI webpage at http://nifti.nimh.nih.gov/ "The niftilib code is released into the public domain" 7. Turku PET Centre libraries http://www.turkupetcentre.net/ /** Copyright (c) 2004-2010 by Turku PET Centre This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details: http://www.gnu.org/copyleft/lesser.html You should have received a copy of the GNU Lesser General Public License along with this library/program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Turku PET Centre, Turku, Finland, http://www.turkupetcentre.fi/ **/ What do you need: ---------------- machine OS: Unix/Linux (MingW/Cygwin on MS Windows) compiler : gcc (GNU C Compiler !!) utilities : make (GNU make !!) packages : just for the graphical front-end : Glib/Gdk-Pixbuf/Gtk+2 What to do first: ---------------- When you need GUI support: - Check Glib/Gtk packages are installed and shared libs can be found Configure (X)MedCon project: --------------------------- type: './configure' or 'sh ./configure' The default installation directory is "/usr/local/xmedcon". You can use the option "--prefix" to override this default location. All supported formats are enabled. If you need to, you can disable it by adding an option like "--disable-format". For more information about the autoconf configure script, just type 'configure --help'. Make (X)MedCon project: ---------------------- type: 'make' Install (X)MedCon project: ------------------------- type: 'make install' You must install the project, since the files in the source directory are merely wrapper scripts. If you use the default prefix dir, make sure to become "root" before doing the actual install. For the programs to be found you could make links to them from a bin-directory included in your "PATH" or add the install bin-directory to this environment variable instead. Try to run the newly installed executables. If they can not find a library, make links or add the install lib-directory to your "LD_LIBRARY_PATH" environment variable or something appropriate for your O.S. Uninstall (X)MedCon project: --------------------------- type: 'make uninstall' Libraries & package structure: ----------------------------- The relation between it all, is as follows: Extra (X)MedCon (X)MedCon Packages library programs -------- ------- -------- DICOM - - + + - - - - - - - -> medcon (command-line) (static) | | | | | LJPG | | (static) + - -> libmdc | (static/shared) NIFTI - - + | (static) | | Gtk+ - - - - - - - - + - - - - - - - -> xmedcon (graphical) GdkPixbuf (shared) Contacts: -------- Any problems? e-mail: enlf-at-users.sourceforge.net Where to get? URL : http://xmedcon.sourceforge.net xmedcon-0.14.1/xmedcon-config.in0000755000175000017510000000313110715163525013412 00000000000000#!/bin/sh prefix=@prefix@ exec_prefix=@exec_prefix@ exec_prefix_set=no no_glib=no usage="\ Usage: xmedcon-config [--no-glib] [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags]" if test $# -eq 0; then echo "${usage}" 1>&2 exit 1 fi ENABLE_PNG=@ENABLE_PNG@ ENABLE_NIFTI=@ENABLE_NIFTI@ if test $ENABLE_PNG -eq 1; then PNG_LDFLAGS="@PNG_LDFLAGS@" PNG_CFLAGS="@PNG_CFLAGS@" fi if test $ENABLE_PNG -o $ENABLE_NIFTI; then ZLIB_LDFLAGS="@ZLIB_LDFLAGS@" else ZLIB_LDFLAGS="" fi while test $# -gt 0; do case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac case $1 in --no-glib) no_glib=yes ;; --prefix=*) prefix=$optarg if test $exec_prefix_set = no ; then exec_prefix=$optarg fi ;; --prefix) echo $prefix ;; --exec-prefix=*) exec_prefix=$optarg exec_prefix_set=yes ;; --exec-prefix) echo $exec_prefix ;; --version) echo @XMEDCON_VERSION@ ;; --cflags) if test @includedir@ != /usr/include ; then includes=-I@includedir@ fi if test $no_glib = no ; then echo $includes $PNG_CFLAGS @XMEDCON_GLIB_CFLAGS@ else echo $includes $PNG_CFLAGS fi ;; --libs) libdirs=-L@libdir@ if test $no_glib = no ; then echo $libdirs -lmdc -lm @XMEDCON_GLIB_LIBS@ $ZLIB_LDFLAGS $PNG_LDFLAGS else echo $libdirs -lmdc -lm $ZLIB_LDFLAGS $PNG_LDFLAGS fi ;; *) echo "${usage}" 1>&2 exit 1 ;; esac shift done xmedcon-0.14.1/configure.ac0000755000175000017510000005445612637532010012462 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: configure.ac # # # # UTIL Make : Medical Image Conversion Utility # # # # purpose : configure script template (autoconf) # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: configure.ac,v 1.32 2015/12/26 15:36:40 enlf Exp $ # Copyright (C) 1997-2016 by Erik Nolf # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. AC_INIT([XMedCon], [0.14.1], [enlf-at-users.sf.net], [xmedcon]) XMEDCON_MAJOR="0" XMEDCON_MINOR="14" XMEDCON_MICRO="1" XMEDCON_PRGR="(X)MedCon" XMEDCON_DATE="26-dec-2015" XMEDCON_VERSION="${XMEDCON_MAJOR}.${XMEDCON_MINOR}.${XMEDCON_MICRO}" XMEDCON_LIBVERS="${XMEDCON_PRGR} ${XMEDCON_VERSION} by Erik Nolf" dnl Do not use env variable, not set yet for this. AC_PREFIX_DEFAULT([/usr/local/xmedcon]) dnl Do some specific configurations. echo "" echo "BEGIN SPECIFIC CONFIG:" dnl Format Acr/Nema 2.0. AC_ARG_ENABLE(acr, [ --enable-acr enable Acr/Nema 2.0 format (default). --disable-acr disable Acr/Nema 2.0 format. ], [ case "$enableval" in no) AC_CACHE_VAL(mdc_cv_include_acr,mdc_cv_include_acr=no) ENABLE_ACR=0 ;; *) AC_CACHE_VAL(mdc_cv_include_acr,mdc_cv_include_acr=yes) ENABLE_ACR=1 ;; esac ], AC_CACHE_VAL(mdc_cv_include_acr,mdc_cv_include_acr=yes) ENABLE_ACR=1 ) AC_MSG_RESULT([Format Acr/Nema 2.0 enabled? ${mdc_cv_include_acr}]) dnl Format Gif87a/89a. AC_ARG_ENABLE(gif, [ --enable-gif enable Gif87a/89a format (default). --disable-gif disable Gif87a/89a format. ], [ case "$enableval" in no) AC_CACHE_VAL(mdc_cv_include_gif,mdc_cv_include_gif=no) ENABLE_GIF=0 ;; *) AC_CACHE_VAL(mdc_cv_include_acr,mdc_cv_include_gif=yes) ENABLE_GIF=1 ;; esac ], AC_CACHE_VAL(mdc_cv_include_gif,mdc_cv_include_gif=yes) ENABLE_GIF=1 ) AC_MSG_RESULT([Format Gif87a/89a enabled? ${mdc_cv_include_gif}]) dnl Format INW (RUG). AC_ARG_ENABLE(inw, [ --enable-inw enable INW (RUG) format (default). --disable-inw disable INW (RUG) format. ], [ case "$enableval" in no) AC_CACHE_VAL(mdc_cv_include_inw,mdc_cv_include_inw=no) ENABLE_INW=0 ;; *) AC_CACHE_VAL(mdc_cv_include_inw,mdc_cv_include_inw=yes) ENABLE_INW=1 ;; esac ], AC_CACHE_VAL(mdc_cv_include_inw,mdc_cv_include_inw=yes) ENABLE_INW=1 ) AC_MSG_RESULT([Format INW (RUG) enabled? ${mdc_cv_include_inw}]) dnl Format Analyze (SPM). AC_ARG_ENABLE(anlz, [ --enable-anlz enable Analyze (SPM) format (default). --disable-anlz disable Analyze (SPM) format. ], [ case "$enableval" in no) AC_CACHE_VAL(mdc_cv_include_anlz,mdc_cv_include_anlz=no) ENABLE_ANLZ=0 ;; *) AC_CACHE_VAL(mdc_cv_include_anlz,mdc_cv_include_anlz=yes) ENABLE_ANLZ=1 ;; esac ], AC_CACHE_VAL(mdc_cv_include_anlz,mdc_cv_include_anlz=yes) ENABLE_ANLZ=1 ) AC_MSG_RESULT([Format Analyze (SPM) enabled? ${mdc_cv_include_anlz}]) dnl Format Concorde microPET AC_ARG_ENABLE(conc, [ --enable-conc enable Concorde microPET format (default). --disable-conc disable Concorde microPET format. ], [ case "$enableval" in no) AC_CACHE_VAL(mdc_cv_include_conc,mdc_cv_include_conc=no) ENABLE_CONC=0 ;; *) AC_CACHE_VAL(mdc_cv_include_conc,mdc_cv_include_conc=yes) ENABLE_CONC=1 ;; esac ], AC_CACHE_VAL(mdc_cv_include_conc,mdc_cv_include_conc=yes) ENABLE_CONC=1 ) AC_MSG_RESULT([Format Concorde uPET enabled? ${mdc_cv_include_conc}]) dnl Format CTI ECAT 6/7. AC_ARG_ENABLE(ecat, [ --enable-ecat enable CTI ECAT 6/7 format (default). --disable-ecat disable CTI ECAT 6/7 format. ], [ case "$enableval" in no) AC_CACHE_VAL(mdc_cv_include_ecat,mdc_cv_include_ecat=no) ENABLE_ECAT=0 ;; *) AC_CACHE_VAL(mdc_cv_include_ecat,mdc_cv_include_ecat=yes) ENABLE_ECAT=1 ;; esac ], AC_CACHE_VAL(mdc_cv_include_ecat,mdc_cv_include_ecat=yes) ENABLE_ECAT=1 ) AC_MSG_RESULT([Format CTI ECAT 6/7 enabled? ${mdc_cv_include_ecat}]) dnl Format InterFile 3.3. AC_ARG_ENABLE(intf, [ --enable-intf enable InterFile 3.3 format (default). --disable-intf disable InterFile 3.3 format. ], [ case "$enableval" in no) AC_CACHE_VAL(mdc_cv_include_intf,mdc_cv_include_intf=no) ENABLE_INTF=0 ;; *) AC_CACHE_VAL(mdc_cv_include_intf,mdc_cv_include_intf=yes) ENABLE_INTF=1 ;; esac ], AC_CACHE_VAL(mdc_cv_include_intf,mdc_cv_include_intf=yes) ENABLE_INTF=1 ) AC_MSG_RESULT([Format InterFile 3.3 enabled? ${mdc_cv_include_intf}]) dnl Format DICOM 3.0. AC_ARG_ENABLE(dicom, [ --enable-dicom enable DICOM 3.0 format (default). --disable-dicom disable DICOM 3.0 format. ], [ case "$enableval" in no) AC_CACHE_VAL(mdc_cv_include_dicm,mdc_cv_include_dicm=no) ENABLE_DICM=0 ;; *) AC_CACHE_VAL(mdc_cv_include_dicm,mdc_cv_include_dicm=yes) ENABLE_DICM=1 ;; esac ], AC_CACHE_VAL(mdc_cv_include_dicm,mdc_cv_include_dicm=yes) ENABLE_DICM=1 ) AC_MSG_RESULT([Format DICOM 3.0 enabled? ${mdc_cv_include_dicm}]) dnl DICOM needs Acr/Nema. if test x"$mdc_cv_include_dicm" = xyes; then if test x"$mdc_cv_include_acr" != xyes; then echo "***" echo "*** Oeps. DICOM needs Acr/Nema to be enabled." echo "*** Therefore rerun configure to do so ..." echo "***" rm -f config.cache exit 1 fi fi dnl Format PNG, test later for required components AC_ARG_ENABLE(png, [ --enable-png enable PNG format (default). --disable-png disable PNG format. ], [ case "$enableval" in no) AC_CACHE_VAL(mdc_cv_include_png,mdc_cv_include_png=no) ENABLE_PNG=0 ;; *) AC_CACHE_VAL(mdc_cv_include_png,mdc_cv_include_png=yes) ENABLE_PNG=1 ;; esac ], AC_CACHE_VAL(mdc_cv_include_png,mdc_cv_include_png=yes) ENABLE_PNG=1 ) AC_MSG_RESULT([Format PNG enabled? ${mdc_cv_include_png}]) dnl Format NIFTI, test later for required components AC_ARG_ENABLE(nifti, [ --enable-nifti enable NIFTI format (default). --disable-nifti disable NIFTI format. ], [ case "$enableval" in no) AC_CACHE_VAL(mdc_cv_include_nifti,mdc_cv_include_nifti=no) ENABLE_NIFTI=0 ;; *) AC_CACHE_VAL(mdc_cv_include_nifti,mdc_cv_include_nifti=yes) ENABLE_NIFTI=1 ;; esac ], AC_CACHE_VAL(mdc_cv_include_nifti,mdc_cv_include_nifti=yes) ENABLE_NIFTI=1 ) AC_MSG_RESULT([Format NIFTI enabled? ${mdc_cv_include_nifti}]) dnl DICOM LossLess JPEG ... if test x"$mdc_cv_include_dicm" = xyes; then AC_ARG_ENABLE(ljpg, [ --enable-ljpg enable DICOM lossless jpeg (default). --disable-ljpg disable DICOM lossless jpeg. ], [ case "$enableval" in no) AC_CACHE_VAL(mdc_cv_ljpg,mdc_cv_ljpg=no) ;; *) AC_CACHE_VAL(mdc_cv_ljpg,mdc_cv_ljpg=yes) ;; esac ], AC_CACHE_VAL(mdc_cv_ljpg,mdc_cv_ljpg=yes) ) else AC_CACHE_VAL(mdc_cv_ljpg,mdc_cv_ljpg=no) fi AC_MSG_RESULT([Enable DICOM 3.0 lossless jpeg ? ${mdc_cv_ljpg}]) dnl TPC library for ecat7 writing, test later for required components AC_ARG_ENABLE(tpc, [ --enable-tpc enable TPC ecat7 writing support (default). --disable-tpc disable TPC ecat7 writing support. ], [ case "$enableval" in no) AC_CACHE_VAL(mdc_cv_include_tpc,mdc_cv_include_tpc=no) ENABLE_TPC=0 ;; *) AC_CACHE_VAL(mdc_cv_include_tpc,mdc_cv_include_tpc=yes) ENABLE_TPC=1 ;; esac ], AC_CACHE_VAL(mdc_cv_include_tpc,mdc_cv_include_tpc=yes) ENABLE_TPC=1 ) AC_MSG_RESULT([Enable TPC ecat7 write support ? ${mdc_cv_include_tpc}]) dnl glib library (availability tests later). AC_ARG_ENABLE(glib, [ --enable-glib enable glib convience functions (default). --disable-glib disable glib convience functions. ], [ case "$enableval" in no) AC_CACHE_VAL(mdc_cv_glibsupport,mdc_cv_glibsupport=no) ;; *) AC_CACHE_VAL(mdc_cv_glibsupport,mdc_cv_glibsupport=yes) ;; esac ], AC_CACHE_VAL(mdc_cv_glibsupport,mdc_cv_glibsupport=yes) ) AC_MSG_RESULT([Enable glib convenience func's ? ${mdc_cv_glibsupport}]) dnl GUI (Gtk+ toolkit availability tests later). AC_ARG_ENABLE(gui, [ --enable-gui enable graphical user interface (default). --disable-gui disable graphical user interface. ], [ case "$enableval" in no) AC_CACHE_VAL(mdc_cv_gui,mdc_cv_gui=no) ;; *) AC_CACHE_VAL(mdc_cv_gui,mdc_cv_gui=yes) ;; esac ], AC_CACHE_VAL(mdc_cv_gui,mdc_cv_gui=yes) ) AC_MSG_RESULT([Enable graphical user interface? ${mdc_cv_gui}]) #dnl use version 1 of glib/gtk #AC_ARG_ENABLE(gtk1, #[ # --enable-gtk1 compile with older glib/gtk version 1 instead of 2. ], #[ # case "$enableval" in # yes) # AC_CACHE_VAL(mdc_cv_gtk_one,mdc_cv_gtk_one=yes) # ;; # *) # AC_CACHE_VAL(mdc_cv_gtk_one,mdc_cv_gtk_one=no) # ;; # esac ], # AC_CACHE_VAL(mdc_cv_gtk_one, mdc_cv_gtk_one=no) #) #AC_MSG_RESULT([Enable older glib/gtk version 1? ${mdc_cv_gtk_one}]) dnl Checks for long long type. AC_ARG_ENABLE(llcheck, [ --enable-llcheck enable long long type check. --disable-llcheck disable long long type check (default). ], [ case "$enableval" in yes) AC_CACHE_VAL(mdc_cv_lnglngcheck,mdc_cv_lnglngcheck=yes) ;; *) AC_CACHE_VAL(mdc_cv_lnglngcheck,mdc_cv_lnglngcheck=no) ;; esac ], AC_CACHE_VAL(mdc_cv_lnglngcheck,mdc_cv_lnglngcheck=no) ) AC_MSG_RESULT([Enable check for long long type? ${mdc_cv_lnglngcheck}]) echo "" echo "BEGIN AUTO CONFIG:" AM_INIT_AUTOMAKE AC_LIBTOOL_WIN32_DLL AM_PROG_LIBTOOL dnl Checks for programs. AC_PROG_AWK AC_PROG_INSTALL AC_PROG_LN_S AC_MSG_CHECKING([for native Win32]) case "$host" in *-*-mingw*) native_win32=yes ;; *) native_win32=no ;; esac AC_MSG_RESULT([$native_win32]) AM_CONDITIONAL(OS_WIN32, test "$native_win32" = yes) AC_MSG_CHECKING([for Win32 platform in general]) case "$host" in *-*-mingw*|*-*-cygwin*) platform_win32=yes ;; *) platform_win32=no ;; esac AC_MSG_RESULT([$platform_win32]) AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = yes) # Ensure MSVC-compatible struct packing convention is used when # compiling for Win32 with gcc. GTK+ uses this convention, so we must, too. # What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while # gcc2 uses "-fnative-struct". if test x"$native_win32" = xyes; then if test x"$GCC" = xyes; then msnative_struct='' AC_MSG_CHECKING([how to get MSVC-compatible struct packing]) if test -z "$ac_cv_prog_CC"; then our_gcc="$CC" else our_gcc="$ac_cv_prog_CC" fi case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in 2.) if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then msnative_struct='-fnative-struct' fi ;; *) if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then msnative_struct='-mms-bitfields' fi ;; esac if test x"$msnative_struct" = x ; then AC_MSG_RESULT([no way]) AC_MSG_WARN([produced libraries will be incompatible with prebuilt GTK+ DLLs]) else CFLAGS="$CFLAGS $msnative_struct" AC_MSG_RESULT([${msnative_struct}]) fi fi fi dnl Checks for libraries. dnl Check for libz if test $ENABLE_PNG -gt 0 -o $ENABLE_NIFTI -gt 0; then if test x"$native_win32" = xyes; then dnl check fails on mingw/msys - give default values ZLIB_LDFLAGS="-L/usr/lib -lz" ZLIB_CLFAGS="-DHAVE_ZLIB" else AC_CHECK_LIB([z],[uncompress],ZLIB_LDFLAGS="-lz",ZLIB_LDFLAGS="") if test x"$ac_cv_lib_z_uncompress" != xyes; then echo "***" echo "*** Oeps. Couldn't link with zlib required for PNG and NIFTI." echo "*** You will need to rerun the configure script with arguments" echo "*** --disable-png --disable-nifti" echo "***" rm -f config.cache exit 1 else ZLIB_CFLAGS="-DHAVE_ZLIB" fi fi fi dnl Check for libpng if test x"$ZLIB_LDFLAGS" = x; then ENABLE_PNG=0; echo "***" echo "*** WARNING: PNG support disabled. ZLIB not found." echo "***" fi if test $ENABLE_PNG -gt 0; then PKG_CHECK_MODULES(PNG,[ libpng >= 1.2.0 ],[HAVE_PNG=yes],[HAVE_PNG=no]) if test x"$HAVE_PNG" = xno; then echo "***" echo "*** Oeps. Components required for PNG support are missing." echo "*** You will need to rerun the configure script with argument" echo "*** --disable-png" echo "***" rm -f config.cache exit 1 else PNG_LDFLAGS=$PNG_LIBS fi fi dnl Prepare build flags for libniftiio prev_LDFLAGS="$LDFLAGS" prev_CPPFLAGS="$CPPFLAGS" AC_ARG_WITH(nifti-prefix, [ --with-nifti-prefix=PFX Prefix where NIFTI library is installed (optional)] , nifti_prefix="$withval", nifti_prefix="") if test x"$nifti_prefix" != x; then ZNZ_LDFLAGS="-L$nifti_prefix/lib -lznz" NIFTI_LDFLAGS="-L$nifti_prefix/lib -lniftiio $ZNZ_LDFLAGS" NIFTI_CFLAGS="" AC_CHECK_FILE([$nifti_prefix/include/nifti/nifti1_io.h], [NIFTI_CFLAGS="-I$nifti_prefix/include/nifti"], [NIFTI_CFLAGS="-I$nifti_prefix/include"]) LDFLAGS="$LDFLAGS -lm $NIFTI_LDFLAGS $ZLIB_LDFLAGS" CPPFLAGS="$CPPFLAGS $NIFTI_CFLAGS $ZLIB_LDFLAGS" else ZNZ_LDFLAGS="../libs/nifti/libznz.la" NIFTI_LDFLAGS="../libs/nifti/libniftiio.la $ZNZ_LDFLAGS" NIFTI_CFLAGS="-I../libs/nifti" fi dnl Check for installed libniftiio if test $ENABLE_NIFTI -gt 0 -a x"$nifti_prefix" != x; then AC_MSG_CHECKING([for NIFTI support]) AC_MSG_RESULT failed=0; passed=0; AC_CHECK_HEADER([nifti1_io.h], passed=`expr $passed + 1` , failed=`expr $failed + 1`, []) AC_CHECK_LIB([niftiio], [nifti_read_header], passed=`expr $passed + 1` , failed=`expr $failed + 1` , $ZNZ_LDFLAGS) AC_MSG_CHECKING([if NIFTI package is complete]) if test $passed -gt 0 then if test $failed -gt 0 then AC_MSG_RESULT([no]) ENABLE_NIFTI=0 else AC_MSG_RESULT([yes]) ENABLE_NIFTI=1 fi else AC_MSG_RESULT([no]) ENABLE_NIFTI=0 fi if test $ENABLE_NIFTI -lt 1; then echo "***" echo "*** Oeps. Components required for NIFTI support are missing." echo "*** You will need to rerun the configure script with argument" echo "*** --disable-nifti or give a proper value to --with-nifti-prefix." echo "***" rm -f config.cache exit 1 fi fi LDFLAGS="$prev_LDFLAGS" CPPFLAGS="$prev_CPPFLAGS" dnl Check for libtpcimgio and tpcmisc prev_LDFLAGS="$LDFLAGS" prev_CPPFLAGS="$CPPFLAGS" AC_ARG_WITH(tpc-prefix, [ --with-tpc-prefix=PFX Prefix where TPC library is installed (optional)] , tpc_prefix="$withval", tpc_prefix="") if test x"$tpc_prefix" != x; then TPC_LDFLAGS="-L$tpc_prefix/lib -ltpcimgio -L$tpc_prefix/lib -ltpcmisc" TPC_CFLAGS="-I$tpc_prefix/include" LDFLAGS="$LDFLAGS $TPC_LDFLAGS" CPPFLAGS="$CPPFLAGS $TPC_CFLAGS" else TPC_LDFLAGS="../libs/tpc/libtpcmisc.la ../libs/tpc/libtpcimgio.la" TPC_CFLAGS="-I../libs/tpc" fi if test $ENABLE_TPC -gt 0 -a x"$tpc_prefix" != x; then AC_MSG_CHECKING([for TPC ecat7 writing support]) AC_MSG_RESULT failed=0; passed=0; AC_CHECK_HEADER([ecat7.h], passed=`expr $passed + 1` , failed=`expr $failed + 1`, []) AC_CHECK_LIB([tpcimgio], [ecat7Create], passed=`expr $passed + 1` , failed=`expr $failed + 1` , $TPC_LDFLAGS) AC_MSG_CHECKING([if TPC library is complete]) if test $passed -gt 0 then if test $failed -gt 0 then AC_MSG_RESULT([no]) ENABLE_TPC=0 else AC_MSG_RESULT([yes]) ENABLE_TPC=1 fi else AC_MSG_RESULT([no]) ENABLE_TPC=0 fi if test $ENABLE_TPC -lt 1; then echo "***" echo "*** Oeps. Components required for TPC ecat7 writing are missing." echo "*** You will need to rerun the configure script with argument" echo "*** --disable-tpc or give a proper value to --with-tpc-prefix." echo "***" rm -f config.cache exit 1 fi fi LDFLAGS="$prev_LDFLAGS" CPPFLAGS="$prev_CPPFLAGS" dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST dnl Checks for library functions. AC_TYPE_SIGNAL AC_CHECK_FUNCS(strptime) AC_CHECK_FUNCS(localtime_r) AC_CHECK_FUNCS(isnan) AC_CHECK_FUNCS(isinf) dnl Checks for glib2 supported medcon if test x"$mdc_cv_glibsupport" = xyes; then PKG_CHECK_MODULES(XMEDCON_GLIB,[ glib-2.0 >= 2.0.0 ]) AC_SUBST(XMEDCON_GLIB_LIBS) AC_SUBST(XMEDCON_GLIB_CFLAGS) GLIBSUPPORTED=1 else GLIBSUPPORTED=0 fi dnl Checks for gtk2 GUI. if test x"$mdc_cv_gui" = xyes; then PKG_CHECK_MODULES(XMEDCON_GTK,[ gdk-pixbuf-2.0 >= 2.0.0 gtk+-2.0 >= 2.0.0 ]) AC_SUBST(XMEDCON_GTK_LIBS) AC_SUBST(XMEDCON_GTK_CFLAGS) GTKSUPPORTED=1 else GTKSUPPORTED=0 fi MDC_CHECK_GUI($GTKSUPPORTED) AM_CONDITIONAL(DO_ACR, test x"$mdc_cv_include_acr" = xyes) AM_CONDITIONAL(DO_GIF, test x"$mdc_cv_include_gif" = xyes) AM_CONDITIONAL(DO_INW, test x"$mdc_cv_include_inw" = xyes) AM_CONDITIONAL(DO_ANLZ, test x"$mdc_cv_include_anlz" = xyes) AM_CONDITIONAL(DO_CONC, test x"$mdc_cv_include_conc" = xyes) AM_CONDITIONAL(DO_ECAT, test x"$mdc_cv_include_ecat" = xyes) AM_CONDITIONAL(DO_INTF, test x"$mdc_cv_include_intf" = xyes) AM_CONDITIONAL(DO_DICM, test x"$mdc_cv_include_dicm" = xyes) AM_CONDITIONAL(DO_PNG, test x"$mdc_cv_include_png" = xyes) AM_CONDITIONAL(DO_NIFTI,test x"$mdc_cv_include_nifti" = xyes) AM_CONDITIONAL(DO_NIFTI_INTERNAL, test x"$nifti_prefix" = x) AM_CONDITIONAL(DO_TPC, test x"$mdc_cv_include_tpc" = xyes) AM_CONDITIONAL(DO_TPC_INTERNAL, test x"$tpc_prefix" = x) AM_CONDITIONAL(DO_LJPG, test x"$mdc_cv_ljpg" = xyes) AM_CONDITIONAL(DO_GLIBSUPPORT, test x"$mdc_cv_glibsupport" = xyes) AM_CONDITIONAL(DO_GUI, test x"$mdc_cv_gui" = xyes) dnl Make substitutions. AC_SUBST(XMEDCON_MAJOR) AC_SUBST(XMEDCON_MINOR) AC_SUBST(XMEDCON_MICRO) AC_SUBST(XMEDCON_PRGR) AC_SUBST(XMEDCON_DATE) AC_SUBST(XMEDCON_VERSION) AC_SUBST(XMEDCON_LIBVERS) AC_SUBST(ENABLE_ACR) AC_SUBST(ENABLE_GIF) AC_SUBST(ENABLE_INW) AC_SUBST(ENABLE_ANLZ) AC_SUBST(ENABLE_CONC) AC_SUBST(ENABLE_ECAT) AC_SUBST(ENABLE_INTF) AC_SUBST(ENABLE_DICM) AC_SUBST(ENABLE_PNG) AC_SUBST(ENABLE_NIFTI) AC_SUBST(ENABLE_TPC) AC_SUBST(ZLIB_LDFLAGS) AC_SUBST(ZLIB_CFLAGS) AC_SUBST(PNG_LDFLAGS) AC_SUBST(PNG_CFLAGS) AC_SUBST(NIFTI_LDFLAGS) AC_SUBST(NIFTI_CFLAGS) AC_SUBST(TPC_LDFLAGS) AC_SUBST(TPC_CFLAGS) AC_SUBST(mdc_cv_include_gif) AC_SUBST(mdc_cv_include_acr) AC_SUBST(mdc_cv_include_inw) AC_SUBST(mdc_cv_include_conc) AC_SUBST(mdc_cv_include_ecat) AC_SUBST(mdc_cv_include_intf) AC_SUBST(mdc_cv_include_anlz) AC_SUBST(mdc_cv_include_dicm) AC_SUBST(mdc_cv_include_png) AC_SUBST(mdc_cv_include_nifti) AC_SUBST(mdc_cv_include_tpc) AC_SUBST(mdc_cv_ljpg) AC_SUBST(mdc_cv_glibsupport) AC_SUBST(mdc_cv_gui) AC_SUBST(GLIBSUPPORTED) AC_SUBST(GLIBMDCETC) AC_SUBST(GTKONE) AC_SUBST(GTKSUPPORTED) AC_SUBST(XMDCETC) dnl Checks for machine dependencies. AC_C_BIGENDIAN if test x"$ac_cv_c_bigendian" = xyes; then mdc_cv_bigendian=1 else mdc_cv_bigendian=0 fi AC_CHECK_SIZEOF(short,2) AC_CHECK_SIZEOF(int,4) AC_CHECK_SIZEOF(long,4) if test x"$mdc_cv_lnglngcheck" = xyes; then AC_CHECK_SIZEOF(long long,8) fi dnl Checks for gzip or compress. AC_CHECK_PROGS(DECOMPRESS, [gunzip uncompress], none) dnl Config depency header AM_CONFIG_HEADER([source/m-depend.h]) dnl Keep correct libtool macros in-tree AC_CONFIG_MACRO_DIR([macros]) dnl Pass types for m-config.h AC_SUBST(mdc_cv_bigendian) AC_SUBST(ac_cv_sizeof_short) AC_SUBST(ac_cv_sizeof_int) AC_SUBST(ac_cv_sizeof_long) if test x"$mdc_cv_lnglngcheck" = xyes; then mdc_cv_enable_lnglng=1 AC_SUBST(ac_cv_sizeof_long_long) else mdc_cv_enable_lnglng=0 fi AC_SUBST(mdc_cv_enable_lnglng) AC_OUTPUT([ Makefile xmedcon-config libs/Makefile libs/ljpg/Makefile libs/dicom/Makefile libs/nifti/Makefile libs/tpc/Makefile macros/Makefile source/Makefile source/m-config.h etc/Makefile etc/xmedcon.spec etc/xmedcon-$VERSION-1.iss:etc/xmedcon.iss.in etc/xmedcon-$VERSION-1.info:etc/xmedcon.info.in etc/xmedcon-$VERSION.ebuild:etc/xmedcon.ebuild.in man/Makefile ]) xmedcon-0.14.1/ltmain.sh0000644000175000017510000117077112637622445012025 00000000000000#! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2014-01-03.01 # libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . PROGRAM=libtool PACKAGE=libtool VERSION=2.4.6 package_revision=2.4.6 ## ------ ## ## Usage. ## ## ------ ## # Run './libtool --help' for help with using this script from the # command line. ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # After configure completes, it has a better idea of some of the # shell tools we need than the defaults used by the functions shared # with bootstrap, so set those here where they can still be over- # ridden by the user, but otherwise take precedence. : ${AUTOCONF="autoconf"} : ${AUTOMAKE="automake"} ## -------------------------- ## ## Source external libraries. ## ## -------------------------- ## # Much of our low-level functionality needs to be sourced from external # libraries, which are installed to $pkgauxdir. # Set a version string for this script. scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # Copyright (C) 2004-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # As a special exception to the GNU General Public License, if you distribute # this file as part of a program or library that is built using GNU Libtool, # you may include this file under the same distribution terms that you use # for the rest of that program. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # Evaluate this file near the top of your script to gain access to # the functions and variables defined here: # # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh # # If you need to override any of the default environment variable # settings, do that before evaluating this file. ## -------------------- ## ## Shell normalisation. ## ## -------------------- ## # Some shells need a little help to be as Bourne compatible as possible. # Before doing anything else, make sure all that help has been provided! DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # NLS nuisances: We save the old values in case they are required later. _G_user_locale= _G_safe_locale= for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test set = \"\${$_G_var+set}\"; then save_$_G_var=\$$_G_var $_G_var=C export $_G_var _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Make sure IFS has a sensible default sp=' ' nl=' ' IFS="$sp $nl" # There are apparently some retarded systems that use ';' as a PATH separator! if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi ## ------------------------- ## ## Locate command utilities. ## ## ------------------------- ## # func_executable_p FILE # ---------------------- # Check that FILE is an executable regular file. func_executable_p () { test -f "$1" && test -x "$1" } # func_path_progs PROGS_LIST CHECK_FUNC [PATH] # -------------------------------------------- # Search for either a program that responds to --version with output # containing "GNU", or else returned by CHECK_FUNC otherwise, by # trying all the directories in PATH with each of the elements of # PROGS_LIST. # # CHECK_FUNC should accept the path to a candidate program, and # set $func_check_prog_result if it truncates its output less than # $_G_path_prog_max characters. func_path_progs () { _G_progs_list=$1 _G_check_func=$2 _G_PATH=${3-"$PATH"} _G_path_prog_max=0 _G_path_prog_found=false _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. for _G_prog_name in $_G_progs_list; do for _exeext in '' .EXE; do _G_path_prog=$_G_dir/$_G_prog_name$_exeext func_executable_p "$_G_path_prog" || continue case `"$_G_path_prog" --version 2>&1` in *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; *) $_G_check_func $_G_path_prog func_path_progs_result=$func_check_prog_result ;; esac $_G_path_prog_found && break 3 done done done IFS=$_G_save_IFS test -z "$func_path_progs_result" && { echo "no acceptable sed could be found in \$PATH" >&2 exit 1 } } # We want to be able to use the functions in this file before configure # has figured out where the best binaries are kept, which means we have # to search for them ourselves - except when the results are already set # where we skip the searches. # Unless the user overrides by setting SED, search the path for either GNU # sed, or the sed that truncates its output the least. test -z "$SED" && { _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for _G_i in 1 2 3 4 5 6 7; do _G_sed_script=$_G_sed_script$nl$_G_sed_script done echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed _G_sed_script= func_check_prog_sed () { _G_path_prog=$1 _G_count=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo '' >> conftest.nl "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin rm -f conftest.sed SED=$func_path_progs_result } # Unless the user overrides by setting GREP, search the path for either GNU # grep, or the grep that truncates its output the least. test -z "$GREP" && { func_check_prog_grep () { _G_path_prog=$1 _G_count=0 _G_path_prog_max=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo 'GREP' >> conftest.nl "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin GREP=$func_path_progs_result } ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # All uppercase variable names are used for environment variables. These # variables can be overridden by the user before calling a script that # uses them if a suitable command of that name is not already available # in the command search PATH. : ${CP="cp -f"} : ${ECHO="printf %s\n"} : ${EGREP="$GREP -E"} : ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} ## -------------------- ## ## Useful sed snippets. ## ## -------------------- ## sed_dirname='s|/[^/]*$||' sed_basename='s|^.*/||' # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s|\([`"$\\]\)|\\\1|g' # Same as above, but do not quote variable references. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' # Sed substitution that converts a w32 file name or path # that contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-'\' parameter expansions in output of sed_double_quote_subst that # were '\'-ed in input to the same. If an odd number of '\' preceded a # '$' in input to sed_double_quote_subst, that '$' was protected from # expansion. Since each input '\' is now two '\'s, look for any number # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. _G_bs='\\' _G_bs2='\\\\' _G_bs4='\\\\\\\\' _G_dollar='\$' sed_double_backslash="\ s/$_G_bs4/&\\ /g s/^$_G_bs2$_G_dollar/$_G_bs&/ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" ## ----------------- ## ## Global variables. ## ## ----------------- ## # Except for the global variables explicitly listed below, the following # functions in the '^func_' namespace, and the '^require_' namespace # variables initialised in the 'Resource management' section, sourcing # this file will not pollute your global namespace with anything # else. There's no portable way to scope variables in Bourne shell # though, so actually running these functions will sometimes place # results into a variable named after the function, and often use # temporary variables in the '^_G_' namespace. If you are careful to # avoid using those namespaces casually in your sourcing script, things # should continue to work as you expect. And, of course, you can freely # overwrite any of the functions or variables defined here before # calling anything to customize them. EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # Allow overriding, eg assuming that you follow the convention of # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: # By convention, finish your script with: # # exit $exit_status # # so that you can set exit_status to non-zero if you want to indicate # something went wrong during execution without actually bailing out at # the point of failure. exit_status=$EXIT_SUCCESS # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath=$0 # The name of this program. progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; *) _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS=$_G_IFS test -x "$progdir/$progname" && break done IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` progpath=$progdir/$progname ;; esac ## ----------------- ## ## Standard options. ## ## ----------------- ## # The following options affect the operation of the functions defined # below, and should be set appropriately depending on run-time para- # meters passed on the command line. opt_dry_run=false opt_quiet=false opt_verbose=false # Categories 'all' and 'none' are always available. Append any others # you will pass as the first argument to func_warning from your own # code. warning_categories= # By default, display warnings according to 'opt_warning_types'. Set # 'warning_func' to ':' to elide all warnings, or func_fatal_error to # treat the next displayed warning as a fatal error. warning_func=func_warn_and_continue # Set to 'all' to display all warnings, 'none' to suppress all # warnings, or a space delimited list of some subset of # 'warning_categories' to display only the listed warnings. opt_warning_types=all ## -------------------- ## ## Resource management. ## ## -------------------- ## # This section contains definitions for functions that each ensure a # particular resource (a file, or a non-empty configuration variable for # example) is available, and if appropriate to extract default values # from pertinent package files. Call them using their associated # 'require_*' variable to ensure that they are executed, at most, once. # # It's entirely deliberate that calling these functions can set # variables that don't obey the namespace limitations obeyed by the rest # of this file, in order that that they be as useful as possible to # callers. # require_term_colors # ------------------- # Allow display of bold text on terminals that support it. require_term_colors=func_require_term_colors func_require_term_colors () { $debug_cmd test -t 1 && { # COLORTERM and USE_ANSI_COLORS environment variables take # precedence, because most terminfo databases neglect to describe # whether color sequences are supported. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} if test 1 = "$USE_ANSI_COLORS"; then # Standard ANSI escape sequences tc_reset='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' else # Otherwise trust the terminfo database after all. test -n "`tput sgr0 2>/dev/null`" && { tc_reset=`tput sgr0` test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` tc_standout=$tc_bold test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` } fi } require_term_colors=: } ## ----------------- ## ## Function library. ## ## ----------------- ## # This section contains a variety of useful functions to call in your # scripts. Take note of the portable wrappers for features provided by # some modern shells, which will fall back to slower equivalents on # less featureful shells. # func_append VAR VALUE # --------------------- # Append VALUE onto the existing contents of VAR. # We should try to minimise forks, especially on Windows where they are # unreasonably slow, so skip the feature probes when bash or zsh are # being used: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then : ${_G_HAVE_ARITH_OP="yes"} : ${_G_HAVE_XSI_OPS="yes"} # The += operator was introduced in bash 3.1 case $BASH_VERSION in [12].* | 3.0 | 3.0*) ;; *) : ${_G_HAVE_PLUSEQ_OP="yes"} ;; esac fi # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is # useable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes if test yes = "$_G_HAVE_PLUSEQ_OP" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_append () { $debug_cmd eval "$1+=\$2" }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_append () { $debug_cmd eval "$1=\$$1\$2" } fi # func_append_quoted VAR VALUE # ---------------------------- # Quote VALUE and append to the end of shell variable VAR, separated # by a space. if test yes = "$_G_HAVE_PLUSEQ_OP"; then eval 'func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi # func_append_uniq VAR VALUE # -------------------------- # Append unique VALUE onto the existing contents of VAR, assuming # entries are delimited by the first character of VALUE. For example: # # func_append_uniq options " --another-option option-argument" # # will only append to $options if " --another-option option-argument " # is not already present somewhere in $options already (note spaces at # each end implied by leading space in second argument). func_append_uniq () { $debug_cmd eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in *"$2$_G_delim"*) ;; *) func_append "$@" ;; esac } # func_arith TERM... # ------------------ # Set func_arith_result to the result of evaluating TERMs. test -z "$_G_HAVE_ARITH_OP" \ && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ && _G_HAVE_ARITH_OP=yes if test yes = "$_G_HAVE_ARITH_OP"; then eval 'func_arith () { $debug_cmd func_arith_result=$(( $* )) }' else func_arith () { $debug_cmd func_arith_result=`expr "$@"` } fi # func_basename FILE # ------------------ # Set func_basename_result to FILE with everything up to and including # the last / stripped. if test yes = "$_G_HAVE_XSI_OPS"; then # If this shell supports suffix pattern removal, then use it to avoid # forking. Hide the definitions single quotes in case the shell chokes # on unsupported syntax... _b='func_basename_result=${1##*/}' _d='case $1 in */*) func_dirname_result=${1%/*}$2 ;; * ) func_dirname_result=$3 ;; esac' else # ...otherwise fall back to using sed. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` if test "X$func_dirname_result" = "X$1"; then func_dirname_result=$3 else func_append func_dirname_result "$2" fi' fi eval 'func_basename () { $debug_cmd '"$_b"' }' # func_dirname FILE APPEND NONDIR_REPLACEMENT # ------------------------------------------- # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. eval 'func_dirname () { $debug_cmd '"$_d"' }' # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT # -------------------------------------------------------- # Perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () { $debug_cmd '"$_b"' '"$_d"' }' # func_echo ARG... # ---------------- # Echo program name prefixed message. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } # func_echo_all ARG... # -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_echo_infix_1 INFIX ARG... # ------------------------------ # Echo program name, followed by INFIX on the first line, with any # additional lines not showing INFIX. func_echo_infix_1 () { $debug_cmd $require_term_colors _G_infix=$1; shift _G_indent=$_G_infix _G_prefix="$progname: $_G_infix: " _G_message=$* # Strip color escape sequences before counting printable length for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS } # func_error ARG... # ----------------- # Echo program name prefixed message to standard error. func_error () { $debug_cmd $require_term_colors func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } # func_fatal_error ARG... # ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { $debug_cmd func_error "$*" exit $EXIT_FAILURE } # func_grep EXPRESSION FILENAME # ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $debug_cmd $GREP "$1" "$2" >/dev/null 2>&1 } # func_len STRING # --------------- # Set func_len_result to the length of STRING. STRING may not # start with a hyphen. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_len () { $debug_cmd func_len_result=${#1} }' else func_len () { $debug_cmd func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } fi # func_mkdir_p DIRECTORY-PATH # --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { $debug_cmd _G_directory_path=$1 _G_dir_list= if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then # Protect directory names starting with '-' case $_G_directory_path in -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` func_mkdir_p_IFS=$IFS; IFS=: for _G_dir in $_G_dir_list; do IFS=$func_mkdir_p_IFS # mkdir can fail with a 'File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$_G_dir" 2>/dev/null || : done IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. test -d "$_G_directory_path" || \ func_fatal_error "Failed to create '$1'" fi } # func_mktempdir [BASENAME] # ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, BASENAME is the basename for that directory. func_mktempdir () { $debug_cmd _G_template=${TMPDIR-/tmp}/${1-$progname} if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race _G_tmpdir=$_G_template-${RANDOM-0}$$ func_mktempdir_umask=`umask` umask 0077 $MKDIR "$_G_tmpdir" umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$_G_tmpdir" || \ func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi $ECHO "$_G_tmpdir" } # func_normal_abspath PATH # ------------------------ # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. func_normal_abspath () { $debug_cmd # These SED scripts presuppose an absolute path with a trailing slash. _G_pathcar='s|^/\([^/]*\).*$|\1|' _G_pathcdr='s|^/[^/]*||' _G_removedotparts=':dotsl s|/\./|/|g t dotsl s|/\.$|/|' _G_collapseslashes='s|/\{1,\}|/|g' _G_finalslash='s|/*$|/|' # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` while :; do # Processed it all yet? if test / = "$func_normal_abspath_tpath"; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result"; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_notquiet ARG... # -------------------- # Echo program name prefixed message only when not in quiet mode. func_notquiet () { $debug_cmd $opt_quiet || func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_relative_path SRCDIR DSTDIR # -------------------------------- # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. func_relative_path () { $debug_cmd func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=$func_dirname_result if test -z "$func_relative_path_tlibdir"; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test -n "$func_stripname_result"; then func_append func_relative_path_result "/$func_stripname_result" fi # Normalisation. If bindir is libdir, return '.' else relative path. if test -n "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result" func_relative_path_result=$func_stripname_result fi test -n "$func_relative_path_result" || func_relative_path_result=. : } # func_quote_for_eval ARG... # -------------------------- # Aesthetically quote ARGs to be evaled later. # This function returns two values: # i) func_quote_for_eval_result # double-quoted, suitable for a subsequent eval # ii) func_quote_for_eval_unquoted_result # has all characters that are still active within double # quotes backslashified. func_quote_for_eval () { $debug_cmd func_quote_for_eval_unquoted_result= func_quote_for_eval_result= while test 0 -lt $#; do case $1 in *[\\\`\"\$]*) _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; *) _G_unquoted_arg=$1 ;; esac if test -n "$func_quote_for_eval_unquoted_result"; then func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" else func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" fi case $_G_unquoted_arg in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and variable expansion # for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_quoted_arg=\"$_G_unquoted_arg\" ;; *) _G_quoted_arg=$_G_unquoted_arg ;; esac if test -n "$func_quote_for_eval_result"; then func_append func_quote_for_eval_result " $_G_quoted_arg" else func_append func_quote_for_eval_result "$_G_quoted_arg" fi shift done } # func_quote_for_expand ARG # ------------------------- # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { $debug_cmd case $1 in *[\\\`\"]*) _G_arg=`$ECHO "$1" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; *) _G_arg=$1 ;; esac case $_G_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_arg=\"$_G_arg\" ;; esac func_quote_for_expand_result=$_G_arg } # func_stripname PREFIX SUFFIX NAME # --------------------------------- # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_stripname () { $debug_cmd # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary variable first. func_stripname_result=$3 func_stripname_result=${func_stripname_result#"$1"} func_stripname_result=${func_stripname_result%"$2"} }' else func_stripname () { $debug_cmd case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; esac } fi # func_show_eval CMD [FAIL_EXP] # ----------------------------- # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} func_quote_for_expand "$_G_cmd" eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" _G_status=$? if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_show_eval_locale CMD [FAIL_EXP] # ------------------------------------ # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} $opt_quiet || { func_quote_for_expand "$_G_cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { eval "$_G_user_locale $_G_cmd" _G_status=$? eval "$_G_safe_locale" if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_tr_sh # ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { $debug_cmd case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_verbose ARG... # ------------------- # Echo program name prefixed message in verbose mode only. func_verbose () { $debug_cmd $opt_verbose && func_echo "$*" : } # func_warn_and_continue ARG... # ----------------------------- # Echo program name prefixed warning message to standard error. func_warn_and_continue () { $debug_cmd $require_term_colors func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 } # func_warning CATEGORY ARG... # ---------------------------- # Echo program name prefixed warning message to standard error. Warning # messages can be filtered according to CATEGORY, where this function # elides messages where CATEGORY is not listed in the global variable # 'opt_warning_types'. func_warning () { $debug_cmd # CATEGORY must be in the warning_categories list! case " $warning_categories " in *" $1 "*) ;; *) func_internal_error "invalid warning category '$1'" ;; esac _G_category=$1 shift case " $opt_warning_types " in *" $_G_category "*) $warning_func ${1+"$@"} ;; esac } # func_sort_ver VER1 VER2 # ----------------------- # 'sort -V' is not generally available. # Note this deviates from the version comparison in automake # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a # but this should suffice as we won't be specifying old # version formats or redundant trailing .0 in bootstrap.conf. # If we did want full compatibility then we should probably # use m4_version_compare from autoconf. func_sort_ver () { $debug_cmd printf '%s\n%s\n' "$1" "$2" \ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n } # func_lt_ver PREV CURR # --------------------- # Return true if PREV and CURR are in the correct order according to # func_sort_ver, otherwise false. Use it like this: # # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." func_lt_ver () { $debug_cmd test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # Set a version string for this script. scriptversion=2014-01-07.03; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # Copyright (C) 2010-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # This file is a library for parsing options in your shell scripts along # with assorted other useful supporting features that you can make use # of too. # # For the simplest scripts you might need only: # # #!/bin/sh # . relative/path/to/funclib.sh # . relative/path/to/options-parser # scriptversion=1.0 # func_options ${1+"$@"} # eval set dummy "$func_options_result"; shift # ...rest of your script... # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file # starting with '# Written by ' and ending with '# warranty; '. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the # '# Written by ' line, like the one at the top of this file. # # The default options also support '--debug', which will turn on shell # execution tracing (see the comment above debug_cmd below for another # use), and '--verbose' and the func_verbose function to allow your script # to display verbose messages only when your user has specified # '--verbose'. # # After sourcing this file, you can plug processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. ## -------------- ## ## Configuration. ## ## -------------- ## # You should override these variables in your script after sourcing this # file so that they reflect the customisations you have added to the # option parser. # The usage line for option parsing errors and the start of '-h' and # '--help' output messages. You can embed shell variables for delayed # expansion at the time the message is displayed, but you will need to # quote other shell meta-characters carefully to prevent them being # expanded when the contents are evaled. usage='$progpath [OPTION]...' # Short help message in response to '-h' and '--help'. Add to this or # override it after sourcing this library to reflect the full set of # options your script accepts. usage_message="\ --debug enable verbose shell tracing -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -v, --verbose verbosely report processing --version print version information and exit -h, --help print short or long help message and exit " # Additional text appended to 'usage_message' in response to '--help'. long_help_message=" Warning categories include: 'all' show all warnings 'none' turn off all the warnings 'error' warnings are treated as fatal errors" # Help message printed before fatal option parsing errors. fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## ## Hook function management. ## ## ------------------------- ## # This section contains functions for adding, removing, and running hooks # to the main code. A hook is just a named list of of function, that can # be run in order later on. # func_hookable FUNC_NAME # ----------------------- # Declare that FUNC_NAME will run hooks added with # 'func_add_hook FUNC_NAME ...'. func_hookable () { $debug_cmd func_append hookable_fns " $1" } # func_add_hook FUNC_NAME HOOK_FUNC # --------------------------------- # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must # first have been declared "hookable" by a call to 'func_hookable'. func_add_hook () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not accept hook functions." ;; esac eval func_append ${1}_hooks '" $2"' } # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It is assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. func_run_hooks () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook funcions.n" ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do eval $_G_hook '"$@"' # store returned options list back into positional # parameters for next 'cmd' execution. eval _G_hook_result=\$${_G_hook}_result eval set dummy "$_G_hook_result"; shift done func_quote_for_eval ${1+"$@"} func_run_hooks_result=$func_quote_for_eval_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, remove any # options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # func_quote_for_eval ${1+"$@"} # my_options_prep_result=$func_quote_for_eval_result # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in # --silent|-s) opt_silent=: ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift # ;; # *) set dummy "$_G_opt" "$*"; shift; break ;; # esac # done # # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # } # func_add_hook func_parse_options my_silent_option # # # my_option_validation () # { # $debug_cmd # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # # func_quote_for_eval ${1+"$@"} # my_option_validation_result=$func_quote_for_eval_result # } # func_add_hook func_validate_options my_option_validation # # You'll alse need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd func_options_prep ${1+"$@"} eval func_parse_options \ ${func_options_prep_result+"$func_options_prep_result"} eval func_validate_options \ ${func_parse_options_result+"$func_parse_options_result"} eval func_run_hooks func_options \ ${func_validate_options_result+"$func_validate_options_result"} # save modified positional parameters for caller func_options_result=$func_run_hooks_result } # func_options_prep [ARG]... # -------------------------- # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propogate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning. func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. func_run_hooks func_parse_options ${1+"$@"} # Adjust func_parse_options positional parameters to match eval set dummy "$func_run_hooks_result"; shift # Break out of the loop if we already parsed every option. test $# -gt 0 || break _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) test $# = 0 && func_missing_arg $_G_opt && break case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above func_append_uniq opt_warning_types " $1" ;; *all) opt_warning_types=$warning_categories ;; *none) opt_warning_types=none warning_func=: ;; *error) opt_warning_types=$warning_categories warning_func=func_fatal_error ;; *) func_fatal_error \ "unsupported warning category: '$1'" ;; esac shift ;; --verbose|-v) opt_verbose=: ;; --version) func_version ;; -\?|-h) func_usage ;; --help) func_help ;; # Separate optargs to long options (plugins may need this): --*=*) func_split_equals "$_G_opt" set dummy "$func_split_equals_lhs" \ "$func_split_equals_rhs" ${1+"$@"} shift ;; # Separate optargs to short options: -W*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "$func_split_short_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-v*|-x*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result } # func_validate_options [ARG]... # ------------------------------ # Perform any sanity checks on option settings and/or unconsumed # arguments. func_hookable func_validate_options func_validate_options () { $debug_cmd # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result } ## ----------------- ## ## Helper functions. ## ## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. # func_fatal_help ARG... # ---------------------- # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { $debug_cmd eval \$ECHO \""Usage: $usage"\" eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } # func_help # --------- # Echo long help message to standard output and exit. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message" exit 0 } # func_missing_arg ARGNAME # ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $debug_cmd func_error "Missing argument for '$1'." exit_cmd=exit } # func_split_equals STRING # ------------------------ # Set func_split_equals_lhs and func_split_equals_rhs shell variables after # splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_equals () { $debug_cmd func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} test "x$func_split_equals_lhs" = "x$1" \ && func_split_equals_rhs= }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_equals () { $debug_cmd func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= test "x$func_split_equals_lhs" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals # func_split_short_opt SHORTOPT # ----------------------------- # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_short_opt () { $debug_cmd func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"} }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_short_opt () { $debug_cmd func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt # func_usage # ---------- # Echo short help message to standard output and exit. func_usage () { $debug_cmd func_usage_message $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } # func_usage_message # ------------------ # Echo short help message to standard output. func_usage_message () { $debug_cmd eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ x;p;x } h /^Written by/q' < "$progpath" echo eval \$ECHO \""$usage_message"\" } # func_version # ------------ # Echo version message to standard output and exit. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /(C)/!b go :more /\./!{ N s|\n# | | b more } :go /^# Written by /,/# warranty; / { s|^# || s|^# *$|| s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| p } /^# Written by / { s|^# || p } /^warranty; /q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... # ---------------- # Libtool also displays the current mode in messages, so override # funclib.sh func_echo with this custom definition. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" done IFS=$func_echo_IFS } # func_warning ARG... # ------------------- # Libtool warnings are not categorized, so override funclib.sh # func_warning with this simpler definition. func_warning () { $debug_cmd $warning_func ${1+"$@"} } ## ---------------- ## ## Options parsing. ## ## ---------------- ## # Hook in the functions to make sure our own options are parsed during # the option parsing loop. usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --mode=MODE use operation mode MODE --no-warnings equivalent to '-Wnone' --preserve-dup-deps don't remove duplicate dependency libraries --quiet, --silent don't print informational messages --tag=TAG use configuration variables from tag TAG -v, --verbose print more informational messages than default --version print version information -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. When passed as first option, '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. Try '$progname --help --mode=MODE' for a more detailed description of MODE. When reporting a bug, please describe a test case to reproduce it and include the following information: host-triplet: $host shell: $SHELL compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) version: $progname (GNU libtool) 2.4.6 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." exit 0 } # func_lo2o OBJECT-NAME # --------------------- # Transform OBJECT-NAME from a '.lo' suffix to the platform specific # object suffix. lo2o=s/\\.lo\$/.$objext/ o2lo=s/\\.$objext\$/.lo/ if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in *.lo) func_lo2o_result=${1%.lo}.$objext ;; * ) func_lo2o_result=$1 ;; esac }' # func_xform LIBOBJ-OR-SOURCE # --------------------------- # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) # suffix to a '.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo }' else # ...otherwise fall back to using sed. func_lo2o () { func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` } func_xform () { func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` } fi # func_fatal_configuration ARG... # ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func__fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } # func_config # ----------- # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # ------------- # Display the features supported by this script. func_features () { echo "host: $host" if test yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi if test yes = "$build_old_libs"; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag TAGNAME # ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname=$1 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf=/$re_begincf/,/$re_endcf/p # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # libtool_options_prep [ARG]... # ----------------------------- # Preparation for options parsed by libtool. libtool_options_prep () { $debug_mode # Option defaults: opt_config=false opt_dlopen= opt_dry_run=false opt_help=false opt_mode= opt_preserve_dup_deps=false opt_quiet=false nonopt= preserve_args= # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_opt=$1 shift case $_G_opt in --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) func_config ;; --dlopen|-dlopen) opt_dlopen="${opt_dlopen+$opt_dlopen }$1" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) func_features ;; --finish) set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $_G_opt && break opt_mode=$1 case $1 in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $_G_opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" ;; --no-warnings|--no-warning|--no-warn) opt_warning=false func_append preserve_args " $_G_opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $_G_opt" ;; --silent|--quiet) opt_quiet=: opt_verbose=false func_append preserve_args " $_G_opt" ;; --tag) test $# = 0 && func_missing_arg $_G_opt && break opt_tag=$1 func_append preserve_args " $_G_opt $1" func_enable_tag "$1" shift ;; --verbose|-v) opt_quiet=false opt_verbose=: func_append preserve_args " $_G_opt" ;; # An option not handled by this hook function: *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result } func_add_hook func_parse_options libtool_parse_options # libtool_validate_options [ARG]... # --------------------------------- # Perform any sanity checks on option settings and/or unconsumed # arguments. libtool_validate_options () { # save first non-option argument if test 0 -lt $#; then nonopt=$1 shift fi # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" case $host in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match test yes != "$build_libtool_libs" \ && test yes != "$build_old_libs" \ && func_fatal_configuration "not configured to build any kind of library" # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then func_error "unrecognized option '-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help=$help help="Try '$progname --help --mode=$opt_mode' for more information." } # Pass back the unparsed argument list func_quote_for_eval ${1+"$@"} libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options # Process options as early as possible so that --help and --version # can return quickly. func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ## ----------- ## ## Main. ## ## ----------- ## magic='%%%MAGIC variable%%%' magic_exe='%%%MAGIC EXE variable%%%' # Global variables. extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # func_generated_by_libtool # True iff stdin has been generated by Libtool. This function is only # a basic sanity check; it will hardly flush out determined imposters. func_generated_by_libtool_p () { $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p } # func_lalib_unsafe_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if 'file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case $lalib_p_line in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test yes = "$lalib_p" } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { test -f "$1" && $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $debug_cmd save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # 'FILE.' does not work on cygwin managed mounts. func_source () { $debug_cmd case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case $lt_sysroot:$1 in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result='='$func_stripname_result ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $debug_cmd if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with '--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=$1 if test yes = "$build_libtool_libs"; then write_lobj=\'$2\' else write_lobj=none fi if test yes = "$build_old_libs"; then write_oldobj=\'$3\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $debug_cmd # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result= if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result"; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $debug_cmd if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $debug_cmd # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $debug_cmd if test -z "$2" && test -n "$1"; then func_error "Could not determine host file name corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result=$1 fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $debug_cmd if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " '$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result=$3 fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $debug_cmd case $4 in $1 ) func_to_host_path_result=$3$func_to_host_path_result ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via '$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $debug_cmd $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $debug_cmd case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result=$1 } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result=$func_convert_core_msys_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result=$func_convert_core_file_wine_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via '$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $debug_cmd if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd=func_convert_path_$func_stripname_result fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $debug_cmd func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result=$1 } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_msys_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_path_wine_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_dll_def_p FILE # True iff FILE is a Windows DLL '.def' file. # Keep in sync with _LT_DLL_DEF_P in libtool.m4 func_dll_def_p () { $debug_cmd func_dll_def_p_tmp=`$SED -n \ -e 's/^[ ]*//' \ -e '/^\(;.*\)*$/d' \ -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ -e q \ "$1"` test DEF = "$func_dll_def_p_tmp" } # func_mode_compile arg... func_mode_compile () { $debug_cmd # Get the compilation command and the source file. base_compile= srcfile=$nonopt # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg=$arg arg_mode=normal ;; target ) libobj=$arg arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs=$IFS; IFS=, for arg in $args; do IFS=$save_ifs func_append_quoted lastarg "$arg" done IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg=$srcfile srcfile=$arg ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj=$func_basename_result } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test yes = "$build_libtool_libs" \ || func_fatal_configuration "cannot build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname=$func_basename_result xdir=$func_dirname_result lobj=$xdir$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test yes = "$build_old_libs"; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test no = "$compiler_c_o"; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext lockfile=$output_obj.lock else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test yes = "$need_locks"; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test warn = "$need_locks"; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test no != "$pic_mode"; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test yes = "$build_old_libs"; then if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test yes = "$compiler_c_o"; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test compile = "$opt_mode" && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a 'standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix '.c' with the library object suffix, '.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to '-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the '--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the 'install' or 'cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE use a list of object files found in FILE to specify objects -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with '-') are ignored. Every other argument is treated as a filename. Files ending in '.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in '.la', then a libtool library is created, only library objects ('.lo' files) may be specified, and '-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created using 'ar' and 'ranlib', or on Windows using 'lib'. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode '$opt_mode'" ;; esac echo $ECHO "Try '$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test : = "$opt_help"; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | $SED -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | $SED '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $debug_cmd # The first argument is the command name. cmd=$nonopt test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "'$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "'$file' was not linked with '-export-dynamic'" continue fi func_dirname "$file" "" "." dir=$func_dirname_result if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir=$func_dirname_result ;; *) func_warning "'-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir=$absdir # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic=$magic # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file=$progdir/$program elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file=$progdir/$program fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if $opt_dry_run; then # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS else if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd=\$cmd$args fi } test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $debug_cmd libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "'$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument '$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and '=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the '-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the '$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the '$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the '$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $debug_cmd # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=false stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=: ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test X-m = "X$prev" && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the '$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=: if $isdir; then destdir=$dest destname= else func_dirname_and_basename "$dest" "" "." destdir=$func_dirname_result destname=$func_basename_result # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "'$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "'$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir=$func_dirname_result func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking '$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname=$1 shift srcname=$realname test -n "$relink_command" && srcname=${realname}T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme=$stripme case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= ;; esac ;; os2*) case $realname in *_dll.a) tstripme= ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try 'ln -sf' first, because the 'ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib=$destdir/$realname func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name=$func_basename_result instname=$dir/${name}i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest=$destfile destfile= ;; *) func_fatal_help "cannot copy a libtool object to '$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test yes = "$build_old_libs"; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext= case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=.exe fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script '$wrapper'" finalize=: for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` if test -n "$libdir" && test ! -f "$libfile"; then func_warning "'$lib' has not been installed in '$libdir'" finalize=false fi done relink_command= func_source "$wrapper" outputname= if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { if $finalize; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file=$func_basename_result outputname=$tmpdir/$file # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink '$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file=$outputname else func_warning "cannot relink '$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name=$func_basename_result # Set up the ranlib parameters. oldlib=$destdir/$name func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run '$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test install = "$opt_mode" && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $debug_cmd my_outputname=$1 my_originator=$2 my_pic_p=${3-false} my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms=${my_outputname}S.c else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist=$output_objdir/$my_outputname.nm func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* External symbol declarations for the compiler. */\ " if test yes = "$dlself"; then func_verbose "generating symbol list for '$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from '$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols=$output_objdir/$outputname.exp $opt_dry_run || { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from '$dlprefile'" func_basename "$dlprefile" name=$func_basename_result case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename= if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname"; then func_basename "$dlprefile_dlname" dlprefile_dlbasename=$func_basename_result else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi func_show_eval '$RM "${nlist}I"' if test -n "$global_symbol_to_import"; then eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[];\ " if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ static void lt_syminit(void) { LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; for (; symbol->name; ++symbol) {" $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" echo >> "$output_objdir/$my_dlsyms" "\ } }" fi echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = { {\"$my_originator\", (void *) 0}," if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ {\"@INIT@\", (void *) <_syminit}," fi case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for '$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $debug_cmd win32_libid_type=unknown win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || func_cygming_gnu_implib_p "$1" then win32_nmres=import else win32_nmres= fi ;; *) func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s|.*|import| p q } }'` ;; esac case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $debug_cmd sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $debug_cmd match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive that possess that section. Heuristic: eliminate # all those that have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $debug_cmd if func_cygming_gnu_implib_p "$1"; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1"; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result= fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $debug_cmd f_ex_an_ar_dir=$1; shift f_ex_an_ar_oldlib=$1 if test yes = "$lock_old_archive_extraction"; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test yes = "$lock_old_archive_extraction"; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $debug_cmd my_gentop=$1; shift my_oldlibs=${1+"$@"} my_oldobjs= my_xlib= my_xabs= my_xdir= for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib=$func_basename_result my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir=$my_gentop/$my_xlib_u func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` func_basename "$darwin_archive" darwin_base_archive=$func_basename_result darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches; do func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" cd "unfat-$$/$darwin_base_archive-$darwin_arch" func_extract_an_archive "`pwd`" "$darwin_base_archive" cd "$darwin_curdir" $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result=$my_oldobjs } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options that match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test yes = "$fast_install"; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else \$ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined other_platform || defined ... */ #endif /* portability defines, excluding path handling macros */ #if defined _MSC_VER # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC #elif defined __MINGW32__ # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined __CYGWIN__ # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined other platforms ... */ #endif #if defined PATH_MAX # define LT_PATHMAX PATH_MAX #elif defined MAXPATHLEN # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ defined __OS2__ # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free (stale); stale = 0; } \ } while (0) #if defined LT_DEBUGWRAPPER static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; size_t tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined HAVE_DOS_BASED_FILE_SYSTEM if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined HAVE_DOS_BASED_FILE_SYSTEM } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = (size_t) (q - p); p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (STREQ (str, pat)) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else size_t len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { size_t orig_value_len = strlen (orig_value); size_t add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ size_t len = strlen (new_value); while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[--len] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $debug_cmd case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_suncc_cstd_abi # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! # Several compiler flags select an ABI that is incompatible with the # Cstd library. Avoid specifying it if any are in CXXFLAGS. func_suncc_cstd_abi () { $debug_cmd case " $compile_command " in *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) suncc_use_cstd_abi=no ;; *) suncc_use_cstd_abi=yes ;; esac } # func_mode_link arg... func_mode_link () { $debug_cmd case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll that has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=false prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module=$wl-single_module func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test yes != "$build_libtool_libs" \ && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg=$1 shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir=$arg prev= continue ;; dlfiles|dlprefiles) $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=: } case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test no = "$dlself"; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test dlprefiles = "$prev"; then dlself=yes elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test dlfiles = "$prev"; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols=$arg test -f "$arg" \ || func_fatal_error "symbol file '$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex=$arg prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir=$arg prev= continue ;; mllvm) # Clang does not use LLVM to link, so we can simply discard any # '-mllvm $arg' options when doing the link step. prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result if test none != "$pic_object"; then # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object fi # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file '$arg' does not exist" fi arg=$save_arg prev= continue ;; os2dllname) os2dllname=$arg prev= continue ;; precious_regex) precious_files_regex=$arg prev= continue ;; release) release=-$arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test rpath = "$prev"; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds=$arg prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg=$arg case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "'-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test X-export-symbols = "X$arg"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between '-L' and '$1'" else func_fatal_error "need path for '-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of '$dir'" dir=$absdir ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test X-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test X-lc = "X$arg" && continue ;; esac elif test X-lc_r = "X$arg"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -mllvm) prev=mllvm continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module=$wl-multi_module continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "'-no-install' is ignored for $host" func_warning "assuming '-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -os2dllname) prev=os2dllname continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -stdlib=* select c++ std lib with clang -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; -Z*) if test os2 = "`expr $host : '.*\(os2\)'`"; then # OS/2 uses -Zxxx to specify OS/2-specific options compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case $arg in -Zlinker | -Zstack) prev=xcompiler ;; esac continue else # Otherwise treat like 'Some other compiler flag' below func_quote_for_eval "$arg" arg=$func_quote_for_eval_result fi ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result test none = "$pic_object" || { # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object } # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test dlfiles = "$prev"; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test dlprefiles = "$prev"; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the '$prevarg' option requires an argument" if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname=$func_basename_result libobjs_save=$libobjs if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" # Definition is injected by LT_CONFIG during libtool generation. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" func_dirname "$output" "/" "" output_objdir=$func_dirname_result$objdir func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test lib = "$linkmode"; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=false newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test lib,link = "$linkmode,$pass"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs=$tmp_deplibs fi if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass"; then libs=$deplibs deplibs= fi if test prog = "$linkmode"; then case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs=$dlprefiles fi if test dlopen = "$pass"; then # Collect dlpreopened libraries save_deplibs=$deplibs deplibs= fi for deplib in $libs; do lib= found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test lib != "$linkmode" && test prog != "$linkmode"; then func_warning "'-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test lib = "$linkmode"; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib=$searchdir/lib$name$search_ext if test -f "$lib"; then if test .la = "$search_ext"; then found=: else found=false fi break 2 fi done done if $found; then # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll=$l done if test "X$ll" = "X$old_library"; then # only static version available found=false func_dirname "$lib" "" "." ladir=$func_dirname_result lib=$ladir/$old_library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi else # deplib doesn't seem to be a libtool library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l *.ltframework) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test conv = "$pass" && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi if test scan = "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "'-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test link = "$pass"; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=false case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=: fi ;; pass_all) valid_a_lib=: ;; esac if $valid_a_lib; then echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" else echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." fi ;; esac continue ;; prog) if test link != "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test conv = "$pass"; then deplibs="$deplib $deplibs" elif test prog = "$linkmode"; then if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=: continue ;; esac # case $deplib $found || test -f "$lib" \ || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "'$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir=$func_dirname_result dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass" || { test prog != "$linkmode" && test lib != "$linkmode"; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test conv = "$pass"; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for '$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test yes = "$prefer_static_libs" || test built,no = "$prefer_static_libs,$installed"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib=$l done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for '$lib'" fi # This library was specified with -dlopen. if test dlopen = "$pass"; then test -z "$libdir" \ && func_fatal_error "cannot -dlopen a convenience library: '$lib'" if test -z "$dlname" || test yes != "$dlopen_support" || test no = "$build_libtool_libs" then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of '$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir=$ladir fi ;; esac func_basename "$lib" laname=$func_basename_result # Find the relevant object directory and library name. if test yes = "$installed"; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library '$lib' was moved." dir=$ladir absdir=$abs_ladir libdir=$abs_ladir else dir=$lt_sysroot$libdir absdir=$lt_sysroot$libdir fi test yes = "$hardcode_automatic" && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir=$ladir absdir=$abs_ladir # Remove this search path later func_append notinst_path " $abs_ladir" else dir=$ladir/$objdir absdir=$abs_ladir/$objdir # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test dlpreopen = "$pass"; then if test -z "$libdir" && test prog = "$linkmode"; then func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" fi case $host in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test lib = "$linkmode"; then deplibs="$dir/$old_library $deplibs" elif test prog,link = "$linkmode,$pass"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test prog = "$linkmode" && test link != "$pass"; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=false if test no != "$link_all_deplibs" || test -z "$library_names" || test no = "$build_libtool_libs"; then linkalldeplibs=: fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if $linkalldeplibs; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test prog,link = "$linkmode,$pass"; then if test -n "$library_names" && { { test no = "$prefer_static_libs" || test built,yes = "$prefer_static_libs,$installed"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then # Make sure the rpath contains only unique directories. case $temp_rpath: in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if $alldeplibs && { test pass_all = "$deplibs_check_method" || { test yes = "$build_libtool_libs" && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test built = "$use_static_libs" && test yes = "$installed"; then use_static_libs=no fi if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test no = "$installed"; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule= for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule=$dlpremoduletest break fi done if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then echo if test prog = "$linkmode"; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test lib = "$linkmode" && test yes = "$hardcode_into_libs"; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname=$1 shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname=$dlname elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc* | *os2*) func_arith $current - $age major=$func_arith_result versuffix=-$major ;; esac eval soname=\"$soname_spec\" else soname=$realname fi # Make a new name for the extract_expsyms_cmds to use soroot=$soname func_basename "$soroot" soname=$func_basename_result func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from '$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for '$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test prog = "$linkmode" || test relink != "$opt_mode"; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test no = "$hardcode_direct"; then add=$dir/$linklib case $host in *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; *-*-sysv4*uw2*) add_dir=-L$dir ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir=-L$dir ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we cannot # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library"; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add=$dir/$old_library fi elif test -n "$old_library"; then add=$dir/$old_library fi fi esac elif test no = "$hardcode_minus_L"; then case $host in *-*-sunos*) add_shlibpath=$dir ;; esac add_dir=-L$dir add=-l$name elif test no = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; relink) if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$dir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$absdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name elif test yes = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; *) lib_linked=no ;; esac if test yes != "$lib_linked"; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test prog = "$linkmode"; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test yes != "$hardcode_direct" && test yes != "$hardcode_minus_L" && test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test prog = "$linkmode" || test relink = "$opt_mode"; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$libdir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add=-l$name elif test yes = "$hardcode_automatic"; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib"; then add=$inst_prefix_dir$libdir/$linklib else add=$libdir/$linklib fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir=-L$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name fi if test prog = "$linkmode"; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test prog = "$linkmode"; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test unsupported != "$hardcode_direct"; then test -n "$old_library" && linklib=$old_library compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test yes = "$build_libtool_libs"; then # Not a shared library if test pass_all != "$deplibs_check_method"; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system cannot link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test yes = "$module"; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test lib = "$linkmode"; then if test -n "$dependency_libs" && { test yes != "$hardcode_into_libs" || test yes = "$build_old_libs" || test yes = "$link_static"; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs=$temp_deplibs fi func_append newlib_search_path " $absdir" # Link against this library test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test no != "$link_all_deplibs"; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path=$deplib ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of '$dir'" absdir=$dir fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names"; then for tmp in $deplibrary_names; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl"; then depdepl=$absdir/$objdir/$depdepl darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" path= fi fi ;; *) path=-L$absdir/$objdir ;; esac else eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "'$deplib' seems to be moved" path=-L$absdir fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test link = "$pass"; then if test prog = "$linkmode"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs=$newdependency_libs if test dlpreopen = "$pass"; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test dlopen != "$pass"; then test conv = "$pass" || { # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= } if test prog,link = "$linkmode,$pass"; then vars="compile_deplibs finalize_deplibs" else vars=deplibs fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Add Sun CC postdeps if required: test CXX = "$tagname" && { case $host_os in linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; solaris*) func_cc_basename "$CC" case $func_cc_basename_result in CC* | sunCC*) func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; esac } # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i= ;; esac if test -n "$i"; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test prog = "$linkmode"; then dlfiles=$newdlfiles fi if test prog = "$linkmode" || test lib = "$linkmode"; then dlprefiles=$newdlprefiles fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "'-R' is ignored for archives" test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "'-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "'-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs=$output func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form 'libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test no = "$module" \ && func_fatal_help "libtool library '$output' must begin with 'lib'" if test no != "$need_lib_prefix"; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test pass_all != "$deplibs_check_method"; then func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test no = "$dlself" \ || func_warning "'-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test 1 -lt "$#" \ && func_warning "ignoring multiple '-rpath's for a libtool library" install_libdir=$1 oldlibs= if test -z "$rpath"; then if test yes = "$build_libtool_libs"; then # Building a libtool convenience library. # Some compilers have problems with a '.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "'-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs=$IFS; IFS=: set dummy $vinfo 0 0 0 shift IFS=$save_ifs test -n "$7" && \ func_fatal_help "too many parameters to '-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major=$1 number_minor=$2 number_revision=$3 # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # that has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_revision ;; freebsd-aout|qnx|sunos) current=$number_major revision=$number_minor age=0 ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_minor lt_irix_increment=no ;; esac ;; no) current=$1 revision=$2 age=$3 ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT '$current' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION '$revision' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE '$age' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE '$age' is greater than the current interface number '$current'" func_fatal_error "'$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" # On Darwin other compilers case $CC in nagfor*) verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" ;; *) verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; esac ;; freebsd-aout) major=.$current versuffix=.$current.$revision ;; freebsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; irix | nonstopux) if test no = "$lt_irix_increment"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring=$verstring_prefix$major.$revision # Add in all the interfaces that we are compatible with. loop=$revision while test 0 -ne "$loop"; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring_prefix$major.$iface:$verstring done # Before this point, $major must not contain '.'. major=.$major versuffix=$major.$revision ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=.$current.$age.$revision verstring=$current.$age.$revision # Add in all the interfaces that we are compatible with. loop=$age while test 0 -ne "$loop"; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring:$iface.0 done # Make executables depend on our current version. func_append verstring ":$current.0" ;; qnx) major=.$current versuffix=.$current ;; sco) major=.$current versuffix=.$current ;; sunos) major=.$current versuffix=.$current.$revision ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 file systems. func_arith $current - $age major=$func_arith_result versuffix=-$major ;; *) func_fatal_configuration "unknown library version type '$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring=0.0 ;; esac if test no = "$need_version"; then versuffix= else versuffix=.0.0 fi fi # Remove version info from name if versioning should be avoided if test yes,no = "$avoid_version,$need_version"; then major= versuffix= verstring= fi # Check to see if the archive will have undefined symbols. if test yes = "$allow_undefined"; then if test unsupported = "$allow_undefined_flag"; then if test yes = "$build_old_libs"; then func_warning "undefined symbols not allowed in $host shared libraries; building static only" build_libtool_libs=no else func_fatal_error "can't build $host shared library unless -no-undefined is specified" fi fi else # Don't allow undefined symbols. allow_undefined_flag=$no_undefined_flag fi fi func_generate_dlsyms "$libname" "$libname" : func_append libobjs " $symfileobj" test " " = "$libobjs" && libobjs= if test relink != "$opt_mode"; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) if test -n "$precious_files_regex"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles=$dlfiles dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles=$dlprefiles dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test yes = "$build_libtool_need_lc"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release= versuffix= major= newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib=$potent_lib while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | $SED 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib= ;; esac fi if test -n "$a_deplib"; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib=$potent_lib # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs= tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test yes = "$allow_libtool_libs_with_static_runtimes"; then for i in $predeps $postdeps; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test none = "$deplibs_check_method"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test yes = "$droppeddeps"; then if test yes = "$module"; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test no = "$allow_undefined"; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs=$new_libs # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test yes = "$build_libtool_libs"; then # Remove $wl instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test yes = "$hardcode_into_libs"; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath=$finalize_rpath test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath=$finalize_shlibpath test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname=$1 shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname=$realname fi if test -z "$dlname"; then dlname=$soname fi lib=$output_objdir/$realname linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols=$output_objdir/$libname.uexp func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile func_dll_def_p "$export_symbols" || { # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols=$export_symbols export_symbols= always_export_symbols=yes } fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs=$IFS; IFS='~' for cmd1 in $cmds; do IFS=$save_ifs # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test yes = "$try_normal_branch" \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=$output_objdir/$output_la.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS=$save_ifs if test -n "$export_symbols_regex" && test : != "$skipped_export"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test : != "$skipped_export" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs=$tmp_deplibs if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test yes = "$compiler_needs_object" && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test : != "$skipped_export" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then output=$output_objdir/$output_la.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test yes = "$compiler_needs_object"; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-$k.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test -z "$objlist" || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test 1 -eq "$k"; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-$k.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-$k.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi ${skipped_export-false} && { func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi } test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs=$IFS; IFS='~' for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi ${skipped_export-false} && { if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi } libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs=$IFS; IFS='~' for cmd in $cmds; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs # Restore the uninstalled library and exit if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test yes = "$module" || test yes = "$export_dynamic"; then # On all known operating systems, these are identical. dlname=$soname fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "'-R' is ignored for objects" test -n "$vinfo" && \ func_warning "'-version-info' is ignored for objects" test -n "$release" && \ func_warning "'-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object '$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj=$output ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # if reload_cmds runs $LD directly, get rid of -Wl from # whole_archive_flag_spec and hope we can get by with turning comma # into space. case $reload_cmds in *\$LD[\ \$]*) wl= ;; esac if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags else gentop=$output_objdir/${obj}x func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test yes = "$build_libtool_libs" || libobjs=$non_pic_objects # Create the old-style object. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs output=$obj func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi test yes = "$build_libtool_libs" || { if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS } if test -n "$pic_flag" || test default != "$pic_mode"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output=$libobj func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "'-version-info' is ignored for programs" test -n "$release" && \ func_warning "'-release' is ignored for programs" $preload \ && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test CXX = "$tagname"; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " $wl-bind_at_load" func_append finalize_command " $wl-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs=$new_libs func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath=$rpath rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath=$rpath if test -n "$libobjs" && test yes = "$build_old_libs"; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" false # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=: case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; *cygwin* | *mingw* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) if test no = "$need_relink" || test yes != "$build_libtool_libs"; then wrappers_required=false fi ;; esac $wrappers_required || { # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command=$compile_command$compile_rpath # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.$objext"; then func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' fi exit $exit_status } if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test yes = "$no_install"; then # We don't need to create a wrapper script. link_command=$compile_var$compile_command$compile_rpath # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi case $hardcode_action,$fast_install in relink,*) # Fast installation is not supported link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath func_warning "this platform does not like uninstalled shared libraries" func_warning "'$output' will be relinked during installation" ;; *,yes) link_command=$finalize_var$compile_command$finalize_rpath relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` ;; *,no) link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath ;; *,needless) link_command=$finalize_var$compile_command$finalize_rpath relink_command= ;; esac # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource=$output_path/$objdir/lt-$output_name.c cwrapper=$output_path/$output_name.exe $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host"; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do case $build_libtool_libs in convenience) oldobjs="$libobjs_save $symfileobj" addlibs=$convenience build_libtool_libs=no ;; module) oldobjs=$libobjs_save addlibs=$old_convenience build_libtool_libs=no ;; *) oldobjs="$old_deplibs $non_pic_objects" $preload && test -f "$symfileobj" \ && func_append oldobjs " $symfileobj" addlibs=$old_convenience ;; esac if test -n "$addlibs"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase=$func_basename_result case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj"; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test -z "$oldobjs"; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test yes = "$build_old_libs" && old_library=$libname.$libext func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test yes = "$hardcode_automatic"; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test yes = "$installed"; then if test -z "$install_libdir"; then break fi output=$output_objdir/${outputname}i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name=$func_basename_result func_resolve_sysroot "$deplib" eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs=$newdependency_libs newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles=$newdlprefiles else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles=$newdlprefiles fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result/$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that cannot go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test no,yes = "$installed,$need_relink"; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } if test link = "$opt_mode" || test relink = "$opt_mode"; then func_mode_link ${1+"$@"} fi # func_mode_uninstall arg... func_mode_uninstall () { $debug_cmd RM=$nonopt files= rmforce=false exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic for arg do case $arg in -f) func_append RM " $arg"; rmforce=: ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir=$func_dirname_result if test . = "$dir"; then odir=$objdir else odir=$dir/$objdir fi func_basename "$file" name=$func_basename_result test uninstall = "$opt_mode" && odir=$dir # Remember odir for removal later, being careful to avoid duplicates if test clean = "$opt_mode"; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif $rmforce; then continue fi rmfiles=$file case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case $opt_mode in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test none != "$pic_object"; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test none != "$non_pic_object"; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test clean = "$opt_mode"; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.$objext" if test yes = "$fast_install" && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name"; then func_append rmfiles " $odir/lt-$noexename.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the $objdir's in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then func_mode_uninstall ${1+"$@"} fi test -z "$opt_mode" && { help=$generic_help func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode '$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # where we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: xmedcon-0.14.1/config.sub0000755000175000017510000010237011203650750012141 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2008-09-08' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx | dvp \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[24]a*eb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]a*eb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mipsEE* | ee | ps2) basic_machine=mips64r5900el-scei case $os in -linux*) ;; *) os=-elf ;; esac ;; iop) basic_machine=mipsel-scei os=-irx ;; dvp) basic_machine=dvp-scei os=-elf ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -irx*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: xmedcon-0.14.1/install-sh0000755000175000017510000002202110352357440012160 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2005-05-14.22 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then mkdircmd=: chmodcmd= else mkdircmd=$mkdirprog fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` shift IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit 0 } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: xmedcon-0.14.1/man/0000755000175000017510000000000012637632716011024 500000000000000xmedcon-0.14.1/man/Makefile.am0000644000175000017510000000200107442656604012771 00000000000000## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## filename: Makefile.am ## ## ## ## UTIL Make : Medical Image Conversion Utility ## ## ## ## purpose : man subdir Makefile template (automake) ## ## ## ## project : (X)MedCon by Erik Nolf ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## $Id: Makefile.am,v 1.4 2002/03/10 13:20:04 enlf Exp $ AUTOMAKE_OPTIONS = gnu man_MANS = \ medcon.1 \ xmedcon.1 \ xmedcon-config.1 \ medcon.3 \ m-acr.4 \ m-anlz.4 \ m-ecat.4 \ m-gif.4 \ m-intf.4 \ m-inw.4 EXTRA_DIST = $(man_MANS) xmedcon-0.14.1/man/medcon.10000644000175000017510000005577510636322354012305 00000000000000'\" t .TH MEDCON 1 .SH NAME medcon - MedCon conversion of medical image formats .SH SYNOPSIS .PP .in 0.2i .HP 7 .B medcon [options] -f files ... .PP .br .SH DESCRIPTION .PP .in 0.2i .I MedCon is a conversion utility intended for reconstructed nuclear medical images. .PP .in 0.2i The supported formats are: .PP .in 0.2i .TS center,tab(@); c c s s s c c c s s s c l l s s s l. Format@Explanation@Notation ------@-----------@-------- Ascii@Raw ascii image arrays without header@'ascii' Binary@Raw binary image arrays without header@'bin' Gif89a@annimated GIF with colormap@'gif' Acr/Nema@Papyrus, Siemens (vers 2.0)@'acr' INW@RUG local format (vers 1.0)@'inw' ECAT@Siemens CTI ECAT 6@'ecat6' or 'ecat' ECAT@Siemens CTI ECAT 7@'ecat7' InterFile@version 3.3@'intf' Analyze@with consideration to SPM software@'anlz' DICOM@uses the VT-DICOM library@'dicom' PNG@Portable Network Graphics@'png' Concorde@Concorde/microPET@'conc' NIfTI@Neuroimaging Informatics Technology Initiative@'nifti' .TE .PP .in 0.2i .SH FLAGS .PP .in 0.2i .TP .B -f, --file, --files ... Read a list of files. .SH OPTIONS .PP .in 0.2i .TP .B -8, --indexed-color This color mode forces 24-bit RGB color images being reduced to an 8-bit indexed colormap. For color reduction in combination with dithering see the -dith option. .TP .B -24, --true-color This color mode keeps a 24-bit image as is. .TP .B -alias, --alias-naming Generate filenames based on patient and study information. The syntax of the resulting basename is: +++ and ++ with the latter three id's applied in case the originating format is DICOM or Acr/Nema. See also -noprefix. Since Analyze does not have a patient_name, patient_id is used instead. .TP .B -anon, --anonymous Make patient and study related entries anonymous (filled with 'X'). This option can not be used with option -ident. .TP .B -b8, --unsigned-char .TP .B -b16, --signed-short .TP .B -b16.12 Force writing of Uint8 or Int16 pixels. The special option -b16.12 only uses 12 bits, as unsigned however. With these options one can lose the quantified float values when the new format doesn't support a global rescale factor or slope/intercept. .TP .B -big, --big-endian Force writing of big endian files when supported by the format. .TP .B -byframe, --sort-by-frame Set sort order in ECAT by frames, instead of the default anatomical sort (based on slice location). Identical planes in each frame will be grouped together. You don't want this. .TP .B -c, --convert ... Convert with a list of formats to convert to. Use the notation without quotes as specified in the above table. You can not use this option with -p. .TP .B -contrast, --enable-contrast Apply (DICOM) window centre/width contrast remapping. Although this may improve the display of images, any manufacturer independent pixel values (like HU, SUV) with quantitation options -qc or -qs will be lost. .TP .B -cor, --coronal Reslice the images of a volume into a coronal projection while preserving the real world dimensions. .TP .B -crop=:::, --crop-images=::: This option allows to crop an equal frame from all images at : where width and height are :. The upper-left corner of an image is at 0:0. .TP .B -cs, --cine-sorting Apply cine sorting, 1st image of each time frame, 2nd image of each time frame, 3rd image of each time frame, ... (applicable on gated SPECT). Reapplying does NOT undo this sorting. For this you need option -cu. .TP .B -cu, --cine-undo Undo the cine sorting (as a result of the option -cs). .TP .B -cw=: Remap contrast using specified centre/width pair. No spaces are allowed within this option. See also -contrast options. .TP .B -d, --debug Show debug info. After reading a file, the program will display the contents of the internal FILEINFO structure. .TP .B -db Only print main header of CTI ECAT files to standard output. .TP .B -dith, --dither-color Use dithering to improve quality of color reduction (from RGB to 8-bit indexed). .TP .B -e, --extract [image ranges ...] A routine to extract images interactively, unless you specify normal style image ranges directly on the command-line separated by spaces. In normal style it is also possible to reorder the sequence of images. You need to specify an output conversion format (see option -c). Note that the extraction does NOT addapt the centre-centre slice separations. In other words, proper volume measurements could be lost. .PP .ti +1.2i Selection Type? 1=normal 2=ecat .PP .ti +1.0i Normal Style .ti +1.0i ------------ .PP .in 0.2i .ti +0.8i - Any number must be one-based (0 = All reversed) .ti +0.8i - Syntax of range : X...Y or X-Y .ti +0.8i - Syntax of interval: X:S:Y (S = step) .ti +0.8i - The list is sequence sensitive! .PP .ti +1.0i Give a list of images to extract? .PP .ti +1.0i Ecat Style .ti +1.0i ---------- .PP .in 0.2i .ti +0.8i - Any number must be one-based (0 = All) .ti +0.8i - Syntax of range : X...Y or X-Y .ti +0.8i - Syntax of interval: X:S:Y (S = step) .PP .ti +1.0i Give planes list? .ti +1.0i Give frames list? .ti +1.0i Give gates list? .ti +1.0i Give beds list? .TP .B -ean, --echo-alias-name A convenience function which quickly echoes the alias or human readable filename on screen, without any delay of image processing. For the syntax of this alias filename, see option -alias. The output could then be used in a script, for example to make interpretable links towards cryptic numbered files resulting from a DICOM series. .TP .B -fb-none, --without-fallback .TP .B -fb-anlz, --fallback-analyze .TP .B -fb-conc, --fallback-concorde .TP .B -fb-dicom, --fallback-dicom .TP .B -fb-ecat, --fallback-ecat Disable or specify a fallback read format in case autodetect failed. .TP .B -fh, --flip-horizontal .TP .B -fv, --flip-vertical Flip images horizontal (-fh) along the X-axis, vertical (-fv) along the Y-axis respectively. Parameters such as slice orientation are NOT changed. See also the -rs option. .TP .B -fmosaic=xx, --force-mosaic=xx Enforce the mosaic file support for DICOM or Acr/Nema formats. The *stamps* will be splitted into separate slices according to the values supplied on the command-line. See also extra options -interl and -mfixv. The preset arguments are: .PP .ti +1.2i = pixel width of image stamps (X) .PP .ti +1.2i = pixel height of image stamps (Y) .PP .ti +1.2i = total number of image stamps (Z) .PP .ti +1.2i .B medcon -f imagefile -fmosaic=64x64x30 .TP .B -g, --make-gray Remap coloured images to gray. This is necessary when you convert to formats which only support a grayscale colormap! .TP .B -gap, --spacing-true-gap The spacing between slices is the true gap/overlap between adjacent slices. In contrary to the default behaviour where the spacing between slices is measured from the centre to centre of two adjacent slices (including gap/overlap). Applied in DICOM & Acr/Nema. .TP .B -hackacr, --hack-acrtags Enables you to hack a file that contains Acr/Nema tags hidden somewhere. Some proprietary image formats do contain tags but are placed after some unknown headerinformation. This option will try to find some readable tags in the first 2048 bytes after which it will give some possible hints to get the images out of the file with the use of the interactive reading procedure (see option `-i'). This experimental procedure can fail badly ... .TP .B -i, --interactive Selects the interactive reading procedure. Normally the program automatically detects the format or uses 'ecat' (or 'dicom') as default. With the interactive procedure it could be possible to read an uncompressed, unsupported format by answering the following questions: .PP .in 0.2i .ti +0.8i Number of images? .ti +0.8i General header offset to binary data? .ti +0.8i Image header offset to binary data? .ti +0.8i Image header repeated before each image? .ti +0.8i Swap the pixel bytes? .ti +0.8i Same characteristics for all images? .ti +0.8i Absolute offset in bytes? (overrides above, 0 = unused) .ti +0.8i Image columns? .ti +0.8i Image rows? .ti +0.8i Pixel data type? .ti +0.8i Redo input? .PP The GUI allows to save such raw predef input (RPI) files, that can be used in a redirect statement: .PP .in 1.0i .B medcon -f unsupported.img -c intf -i < predef.rpi .PP Doing so you can create small scripts that will read and convert your unsupported images at once. .TP .B -ident, --identify An interactive routine to specify the patient and study related information. This option can not be used with the option -anon. The questions asked are: .PP .in 0.2i .ti +0.8i Give patient name? .ti +0.8i Give patient id? .ti +0.8i Select patient sex? .ti +0.8i Give study description? .ti +0.8i Give study id/name/p-number? .ti +0.8i Give series description? .TP .B -implicit, --write-implicit Another DICOM related option to enforce the implicit VR little transfer syntax as output, instead of the default explicit transfer syntax. .TP .B -interl, --mosaic-interlaced An extra option used in combination with forced mosaic (-fmosaic). The option indicates that the slices in the original mosaic are in fact interlaced. See also options -fmosaic and -mfixv. .TP .B -little, --little-endian Force writing of little endian files when supported by the format. .TP .B -lut, --load-lut Load an external LUT color scheme. .TP .B -mh, --map-hotmetal Selects the hotmetal colormap. This is only usefull to GIF89a or PNG. .TP .B -mr, --map-rainbow Selects the rainbow colormap. This is only usefull to GIF89a or PNG. .TP .B -mc, --map-combined Selects the combined colormap. This is only usefull to GIF89a or PNG. .TP .B -mi, --map-inverted Selects the invers colormap. This is only usefull to GIF89a or PNG .TP .B -mfixv, --mosaic-fix-voxel Another extra option used in combination with forced mosaic (-fmosaic). Choosing this options will rescale the real world voxel dimensions by the mosaic factor. See also -fmosaic and -interl. .TP .B -mosaic, --enable-mosaic Enable mosaic file support in DICOM or Acr/Nema format. The *stamps* will be splitted into separate slices according to values found in the file. This autodetect routine will always fix the voxel sizes. To support other type of mosaic files, see option -fmosaic. .TP .B -n, --negatives Preserve negative values. When not selected, all negative values are put to zero. In combination with quantitation (see -qs or -qc) the requested format must support pixels of type float, a global rescale factor or the more generic slope/intercept concept in order to preserve the (negative and positive) quantified values. .TP .B -nf, --norm-over-frames Normalize with minimum/maximum values found over images in a frame group (in case the original format has different frames). The default behaviour is normalization with minimum/maximum values found over all images. This can be important when the requested format requires a rescaling to a new pixeltype. The original pixel values then need to be rescaled to the new pixeltype boundaries based on the minimum/maximum values. .TP .B -nometa, --write-without-meta Write DICOM files without the part 10 meta header (group 0x0002). .TP .B -nopath, --ignore-path Ignore absolute path mentioned in the "name of data file" key of an interfile header. Do make sure then that the data file resides in the same directory as the header file. .TP .B -noprefix, --without-prefix This option disables the numbered prefix in the output filename. In combination with the -alias option, one could create human readable and alphabetical sorted files from DICOM or Acr/Name multiple file volumes. .TP .B -o, --output-name Changes output filename for ALL files to be created. It is allowed to specify a full directory path as well. However, a full path disables unique filename prefixing. .TP .B -one, --single-file Write header and image to same file; as allowed for InterFile. .TP .B -optgif, --options-gif Define some GIF options when converting to the GIF format. Without this option a loop and background color are defined by default. This interactive routine asks the following questions: .PP .in 0.2i .ti +0.8i Select color map? .ti +0.8i Insert a display loop? .ti +0.8i Delay 1/100ths of a second? .ti +0.8i Insert a transparent color? .ti +0.8i Transparent color? .ti +0.8i Background color? .PP .in 0.2i .TP .B -optspm, --options-spm Define some SPM options (origins) when converting to the Analyze format. The quantification is not set. See also '-spm' & '-ar'. The interactive routine asks the following questions: .PP .in 0.2i .ti +0.8i Origin X? .ti +0.8i Origin Y? .ti +0.8i Origin Z? .PP .TP .B -p, --print-values Show some specified pixel values. This is an interactive routine. Calibration and negative pixels are preserved automatically. You need to specify the -qs to preserve the quantification instead of the calibration. You can not use this option with -c. See also -pa option for a non-interactive routine. .PP .in 0.2i .ti +0.8i - Any number must be one-based (0 = All) .ti +0.8i - Syntax of range : X...Y or X-Y .ti +0.8i - Syntax of interval: X:S:Y (S = step) .PP .ti +1.2i Selection Type? 1=normal 2=ecat .PP .ti +1.0i Normal Style .ti +1.0i ------------ .PP .ti +1.2i Give a list of image numbers? .ti +1.2i Give a list of pixels x,y ? .PP .ti +1.0i Ecat Style .ti +1.0i ---------- .PP .ti +1.2i Give planes list? .ti +1.2i Give frames list? .ti +1.2i Give gates list? .ti +1.2i Give beds list? .ti +1.2i Give a list of pixels x,y ? .TP .B -pa, --print-all-values Show all pixel values. This option is identical to -p, but doesn't require user input. .TP .B -pad, --pad-around .TP .B -padtl, --pad-top-left .TP .B -padbr, --pad-bottom-right Increasing the slice matrix is done by padding an image with the lowest pixel value. The options above enable different padding modes. .TP .B -preacq, --prefix-acquisition .TP .B -preser, --prefix-series Respectivily use acquisition or series value in the numbered prefix of the new filename. This is useful for alphabetical file ordering, where leading zeros in DICOM elements are missing. See also -alias. .TP .B -q, --quantitation Enable quantitation using all scale factors (for now alias for -qc option). .TP .B -qs, --quantification A first scaling option to preserve the (ECAT) quantification (a) or to consider a first linear scaling slope with intercept (b). .PP .in 1.0i qpv = ppv * quant_scale [counts/second/pixel] (a) .in 1.0i qpv = ppv * slope + intercept (b) .PP .PP .in 1.0i qpv = quantified pixel value .in 1.0i ppv = plain pixel value .PP The "quant_scale" factor normalizes all images in the file; quite important for merging purposes. When the corresponding format can not hold a rescale factor for each image, the quantified values are saved as floats. Therefore, the highest pixel precision for correct quantitation is float, not double! .PP If the format does not support floats, the quantified pixel values get rescaled to an integer. Then only formats that support a global scaling factor or slope/intercept pair will preserve those quantified values. .PP Note that this option can not be used with -qc. .PP .TP .B -qc, --calibration A second quantitation option to preserve the (ECAT) quantification as well as the (ECAT) calibration (a) or in general, using two rescale slopes with an intercept (b). These should normally transform pixels into manufacturer independent values. So one can assume that after a calibration, the new pixels will represent a real world unit (like concentration values (SUV), hounsfield units (HU) and alike). .PP .in 1.0i cpv = ppv * quant_scale * calibr_fctr [uCi/ml] (a) .in 1.0i cpv = ppv * slope1 * slope2 + intercept (b) .PP .PP .in 1.0i cpv = calibrated pixel value .in 1.0i ppv = plain pixel value .in 1.0i qpv = quantified pixel value = ppv * quant_scale .PP The "quant_scale" factor normalizes all images in the file; quite important for merging purposes. The "calibr_fctr" rescales the qpv-values to a new unit. When the corresponding format can not hold a compound factor for each image, the quantified values will be saved as floats. Therefore, the highest pixel precision for correct quantitation is float and not double! .PP If the format does not support floats, the calibrated pixel values are rescaled to an integer type. Only formats that support a global scaling factor or slope/intercept pair preserve those calibrated values. .PP Note that this option can not be used with -qs. .TP .B -r, --rename-file Rename the file basename. This option is only useful in case of conversion. .TP .B -rs, --reverse-slices Reverse all the slices along the Z-axis. Parameters such as slice orientation are NOT changed. See also the -fh and -fv options. .TP .B -s, --silent Suppress all message, warning and error dialogs. .TP .B -sag, --sagittal Reslice the images of a volume into a sagittal projection while preserving the real world dimensions. .TP .B -si=: Force remap of pixel values using specified slope/intercept (y = s*x + i). The quantitation option -qc is enabled by default. No spaces are allowed within this option. .TP .B -skip1, --skip-preview-slice Skip the first image in an InterFile. In other words, the first image in the array will simply be ignored. Use this only when you are sure that the InterFile does contain an annoying/confusing preview slice. .TP .B -split4d, -splitf, --split-frames .TP .B -split3d, -splits, --split-slices Write out a study into separate files, one for each volume in a time frame (--split-frames) or each image slice (--split-slices) individually. The names of the files created will have an extra index number. See also -stack3d and -stack4d as opposite options. .TP .B -spm, --analyze-spm Considering Analyze files for/from SPM. In this case the global scaling factor hidden in imd.funused[1] will be used, as well as the hidden offset value in imd.funused[0]. .PP In case of quantitation, the default output pixel type is float. This option allows to write integers combined with a global scale factor. To actually use this scaling factor, you must select a quantitation option like -qs or -qc as well. .PP See also -ar & -optspm. .TP .B -sqr, --make-square Make all image matrices square, using the largest dimension. Images are padded with the lowest pixel value. See also -pad related options. .TP .B -sqr2, --make-square-two Make all image matrices square, using the nearest power of two (between 64, 128, 256, 512 and 1024). Images are padded with the lowest pixel value. See also -pad related options. .TP .B -stack4d, -stackf, --stack-frames .TP .B -stack3d, -stacks, --stack-slices Write separate studies into one file. The --stack-slices option allows to write single image slice files into one 3D volume, while the --stack-frames option allows volumes of different time frames being written into one 4D file. The sequence of stacking is based on the file sequence given at the argument line. See also -split3d and -split4d as the opposite options. .TP .B -tra, --transverse Reslice the images of a volume into a transverse projection while preserving the real world dimensions. .TP .B -uin, --use-institution-name Change the program's default institution name which is applied on studies without one. However, this does .B not override existing values. For a namestring with spaces, group between double quotes. .TP .B -v, --verbose Verbose mode. Show some explaining messages during the reading and writing of files. .TP .B -vifi, --edit-fileinfo An interactive routine for editing voxel,array,slice and orient related entries in the FILEINFO struct. .TP .B -w, --overwrite-files Allow overwrite of existing files, without warning. .in 0.2i .SH NOTES .PP .in 0.2i When no conversion was specified, the program will display the header information of each image. .PP .in 0.2i When conversion was specified, the program will automatically create new filenames in the .B current directory with the following syntax: .PP .in 0.2i .ce 1 mXXX-filename.ext .PP .in 0.2i .ce 2 \`XXX-' a number representing the XXX-th conversion .br \`ext' a corresponding extension of the new format .br .PP .in 0.2i .TS center,tab(@); l c l. Binary raw@->@.bin Ascii raw@->@.asc Gif89a@->@.gif Acr/Nema@->@.ima INW@->@.im ECAT@->@.img Interfile@->@.h33 + .i33 Analyze@->@.hdr + .img DICOM@->@.dcm PNG@->@.png CONC@->@.hdr + .dat .TE .PP .in 0.2i Some special remarks related to reading from stdin or writing to stdout. .PP .in 0.5i .B a) reading from stdin: .PP Enable this by using an "-" mark instead of the list of input files. .PP .in 1.0i 1. redirect: .B medcon -f - < inputfile .PP This is supported for all formats and shouldn't cause any particular problems. Interactive routines are disabled because stdin is now in use by the image input. .PP .in 1.0i 2. pipes : .B cat inputfile | medcon -f - format .PP Actually, this way only one or two formats are supported since seek() calls are not possible during pipes. The fact is that most of our formats are read using those seek() calls. In normal operation we already need a quick sneak in the file to determine the format. Because this fseek() isn't allowed, you must supply at least the input format too. .PP .in 0.5i .B b) writing to stdout: .PP Enabled by using an extra "-" mark on the conversion list. .PP .in 1.0i .B medcon -f inputfile -c - format .PP Only one inputfile is allowed. The converted output will be send to stdout. .PP In case of dual file formats such as Analyze or InterFile, the header information will be send to stderr. The reference to the image file in the header of an InterFile will ofcourse be wrong (since the program is not capable of knowing the resulting filename). .PP In case of RAW or ASCII output, the program will print the content of the internal FILEINFO struct to stderr as well. Please note that the (t)csh shells do not allow to catch stderr or stdout separately. In case of the bash shell, it is possible to say: .PP .B medcon -f inputfile -c - intf -b16.12 -qc 1>image 2>header .PP .in 0.2i .SH EXAMPLES .PP .in 0.2i .B 1. To display the image headers: .ti +1.0i medcon -f filename1 filename2 .PP .in 0.2i .B 2. To convert the images: .ti +1.0i medcon -f filename1 filename2 -c gif acr intf .PP .in 0.2i .B 3. To read interactively .ti +1.0i medcon -i -f filename -c ecat .PP .in 0.2i .B 4. To extract alternate images: .ti +1.0i medcon -e 1:2:20 -f filename -c gif .PP .in 0.2i .B 5. To print out pixel values .ti +1.0i medcon -p -f filename .PP .in 0.2i .B 6. Convert to raw binary images, send to standard output: .ti +1.0i medcon -f filename -c - bin .PP .in 0.2i .SH FILES .PP .in 0.2i .TS tab(@); l l. /usr/local/xmedcon/include/@Directory with header files. /usr/local/xmedcon/lib/@Directory with libraries. /usr/local/xmedcon/bin/@Directory with executables. /usr/local/xmedcon/man/@Directory with man-pages. /usr/local/xmedcon/etc/@Directory with rcfiles. .TE .PP .in 0.2i .SH SEE ALSO .PP .in 0.2i xmedcon(1), xmedcon-config(1) .PP .in 0.2i m-acr(4), m-anlz(4), m-gif(4), m-inw(4), m-intf(4), m-ecat(4) .PP .in 0.2i medcon(3) .PP .in 0.2i .SH AUTHOR .PP .in 0.2i .I (X)MedCon project was originally written by Erik Nolf (eNlf) for the former PET-Centre at Ghent University (Belgium). .PP .in 0.2i .TS tab(=); lB l lB l. e-mail:=enlf-at-users.sourceforge.net=www:=http://xmedcon.sourceforge.net .TE xmedcon-0.14.1/man/m-anlz.40000644000175000017510000001410410415033212012201 00000000000000'\" t .TH M-ANLZ 4 .SH NAME m-anlz - Analyze (SPM) medical image format (MedCon) .SH DESCRIPTION .PP .in 0.2i This is a very simple format. The basic headers are written in one file with extension `.hdr', the image data in another file with extension `.img'. .PP .in 0.2i The basic defines for the format: .PP .in 0.2i .nf --------------------------------------------------------------------------- typedef struct Header_Key_t{ Int32 sizeof_hdr; /* 348 or 148 */ char data_type[10]; /* "dsr" */ char db_name[18]; /* filename without extension */ Int32 extents; /* 16384 */ Int16 session_error; char regular; /* 'r' */ char hkey_un0; } MDC_ANLZ_HEADER_KEY; #define MDC_ANLZ_HK_SIZE 40 typedef struct Image_Dimensions_t{ Int16 dim[8]; /* [0] = # of dimensions */ /* [1] = X-dim */ /* [2] = Y-dim */ /* [3] = Z-dim */ /* [4] = t-dim */ /* ... */ Int16 unused[7]; Int16 datatype; /* pixel type */ /* 0 = Unknown 1 = one-bit */ /* 2 = Uint8 4 = Int16 */ /* 8 = Int32 16 = float */ /* 32 = complex 64 = double */ /*128 = RGB 255 = all */ Int16 bitpix; /* bits per pixel */ Int16 dim_un0; float pixdim[8]; /* [0] = # of dimensions */ /* [1] = X-dim (mm) */ /* [2] = Y-dim (mm) */ /* [3] = Z-dim (mm) */ /* [4] = t-dim (ms) */ /* ... */ float funused[6]; float compressed; float verified; Int32 glmax,glmin; } MDC_ANLZ_IMAGE_DIMS; #define MDC_ANLZ_IMD_SIZE 108 typedef struct Data_History_t{ char descrip[80]; char aux_file[24]; char orient; /* patient orientation */ /* 0 = transverse unflipped */ /* 1 = coronal unflipped */ /* 2 = sagittal unflipped */ /* 3 = transverse flipped */ /* 4 = coronal flipped */ /* 5 = sagittal flipped */ char originator[10]; char generated[10]; char scannum[10]; char patient_id[10]; char exp_date[10]; char exp_time[10]; char hist_un0[3]; Int32 views; Int32 vols_added; Int32 start_field; Int32 field_skip; Int32 omax, omin; Int32 smax, smin; } MDC_ANLZ_DATA_HIST; #define MDC_ANLZ_DH_SIZE 200 --------------------------------------------------------------------------- .fi .PP .in 0.2i The structures are defined in the order as they should be found in the file. The Data_History header is not obliged. The SPM Analyze format, intended for the SPM software, differs a little from the normal Analyze format. .PP .in 0.2i What does the format support or not support: .PP .in 0.2i .nf =========================================================================== Item Supported Not Supported =========================================================================== Color Map : grayscale - File Endian : little & big - Pixeltypes : 1-bit, Uint8, Int16, Int32 Int8,Uint16,Uint32 float, double, (complex) Int64,Uint64 =========================================================================== Scaling factors : quantify & calibrate factors/image are NOT supported --------------------------------------------------------------------------- Dimensions/Image : different dimensions for each image are NOT supported --------------------------------------------------------------------------- Pixeltypes/Image : different pixeltypes for each image are NOT supported --------------------------------------------------------------------------- SPM remarks : 1) imd.funused[0] = the offset 2) imd.funused[1] = one global scaling factor 3) (Int16)dh.originator[0...1] \\ (Int16)dh.originator[2...3] } = origin (X, Y, Z) (Int16)dh.originator[4...5] / =========================================================================== .fi .PP .in 0.2i .SH NOTES .PP .in 0.2i A note about the image (patient) orientation in SPM: .IP X-axis 5 increases from leftside (hand) to rightside (hand). .IP Y-axis 5 increases from posterior (back) to anterior (front). .IP Z-axis 5 increases from inferior (feet) to superior (head). .PP .in 0.2i .SH FILES .PP .in 0.2i .nf /usr/local/xmedcon/source/m-anlz.h The header file. /usr/local/xmedcon/source/m-anlz.c The source file. .fi .PP .in 0.2i .SH SEE ALSO .PP .in 0.2i medcon(1), xmedcon(1), xmedcon-config(1) .PP .in 0.2i m-acr(4), m-gif(4), m-inw(4), m-intf(4), m-ecat(4) .PP .in 0.2i medcon(3) .PP .in 0.2i .SH AUTHOR .PP .in 0.2i .I (X)MedCon project was originally written by Erik Nolf (eNlf) for the former PET-Centre at Ghent University (Belgium). .PP .in 0.2i .TS tab(=); lB l lB l. e-mail:=enlf-at-users.sourceforge.net=www:=http://xmedcon.sourceforge.net .TE xmedcon-0.14.1/man/ChangeLog0000644000175000017510000000000011152103414012457 00000000000000xmedcon-0.14.1/man/m-ecat.40000644000175000017510000002257610415033212012165 00000000000000'\" t .TH M-ECAT 4 .SH NAME m-ecat - CTI ECAT 6/7 medical image format (MedCon) .SH DESCRIPTION .PP .in 0.2i This is a painful format. You should check the source code for more info. There is only read support for ECAT 7. Below you will find the specs for the ECAT 6 format. The ECAT 7 format differs a little in header definitions and there is only one matrix entry per volume, while for ECAT 6 files there is one matrix entry per plane. All ECAT 6 image data is written in one file with `.img' extension. .PP .in 0.2i .ce 3 ----------------------------------------------------------------------- Important Definitions ----------------------------------------------------------------------- .PP .in 0.2i .nf typedef struct mat_main_header { char original_file_name[20]; Int16 sw_version; Int16 data_type; Int16 system_type; Int16 file_type; char node_id[10]; Int16 scan_start_day, scan_start_month, scan_start_year, scan_start_hour, scan_start_minute, scan_start_second; char isotope_code[8]; float isotope_halflife; char radiopharmaceutical[32]; float gantry_tilt, gantry_rotation, bed_elevation; Int16 rot_source_speed, wobble_speed, transm_source_type; float axial_fov, transaxial_fov; Int16 transaxial_samp_mode, coin_samp_mode, axial_samp_mode; float calibration_factor; Int16 calibration_units, compression_code; char study_name[12], patient_id[16], patient_name[32], patient_sex, patient_age[10], patient_height[10], patient_weight[10], patient_dexterity, physician_name[32], operator_name[32], study_description[32]; Int16 acquisition_type, bed_type, septa_type; char facility_name[20]; Int16 num_planes, num_frames, num_gates, num_bed_pos; float init_bed_position, bed_offset[15], plane_separation; Int16 lwr_sctr_thres, lwr_true_thres, upr_true_thres; float collimator; char user_process_code[10]; Int16 acquisition_mode; } Main_header; #define MH_64_SIZE 446 typedef struct mat_scan_subheader { Int16 data_type, dimension_1, dimension_2, smoothing, processing_code; float sample_distance, isotope_halflife; Int16 frame_duration_sec; Int32 gate_duration, r_wave_offset; float scale_factor; Int16 scan_min, scan_max; Int32 prompts, delayed, multiples, net_trues; float cor_singles[16], uncor_singles[16], tot_avg_cor, tot_avg_uncor; Int32 total_coin_rate, frame_start_time, frame_duration; float loss_correction_fctr; Int32 phy_planes[8]; } Scan_subheader; #define SSH_64_SIZE 236 typedef struct mat_image_subheader { Int16 data_type, num_dimensions, dimension_1, dimension_2; float x_origin, y_origin, recon_scale, /* Image ZOOM from reconstruction */ quant_scale; /* Scale Factor */ Int16 image_min, image_max; float pixel_size, slice_width; Int32 frame_duration, frame_start_time; Int16 slice_location, recon_start_hour, recon_start_minute, recon_start_sec; Int32 gate_duration; Int16 filter_code; Int32 scan_matrix_num, norm_matrix_num, atten_cor_matrix_num; float image_rotation, plane_eff_corr_fctr, decay_corr_fctr, loss_corr_fctr, intrinsic_tilt ; Int16 processing_code, quant_units, recon_start_day, recon_start_month, recon_start_year; float ecat_calibration_fctr, well_counter_cal_fctr, filter_params[6]; char annotation[40]; } Image_subheader; #define ISH_64_SIZE 172 typedef struct mat_norm_subheader { Int16 data_type, dimension_1, dimension_2; float scale_factor; Int16 norm_hour, norm_minute, norm_second, norm_day, norm_month, norm_year; float fov_source_width; float ecat_calib_factor; } Norm_subheader; #define NSH_64_SIZE 30 typedef struct mat_attn_subheader { Int16 data_type, attenuation_type, dimension_1, dimension_2; float scale_factor, x_origin, y_origin, x_radius, y_radius, tilt_angle, attenuation_coeff, sample_distance; } Attn_subheader; #define ASH_64_SIZE 40 ----------------------------------------------------------------------- .if .PP .in 0.2i What does the format support or not support: .PP .in 0.2i .nf =========================================================================== Item Supported Not Supported =========================================================================== Color Map : grayscale - File Endian : big little Pixeltypes : VAX Int16 (write) | All (read) - =========================================================================== Scaling factors : quantify & calibrate factors/image are supported --------------------------------------------------------------------------- Dimensions/Image : different dimensions for each image are NOT supported --------------------------------------------------------------------------- Pixeltypes/Image : different pixeltypes for each image are NOT supported =========================================================================== .fi .PP .in 0.2i .SH NOTES .PP .in 0.2i The MedCon program also supports the reading of sinogram, attenuation and normalization files for conversion purposes but it does not support writing those file types. In fact, they will be considered as reconstructed data! .PP .in 0.2i The format supports more pixeltypes. The reason for our restriction of writing only the Int16 type was our ECAT software that only supports the Int16 type. .PP .in 0.2i We consider three kinds of images (planes) in an ECAT file: .PP .in 0.5i (1) plain pixel values [no unit] (ppv = ppv) .in 0.8i - the planes/images are NOT normalized .PP .in 0.5i (2) quantified values [counts/second/pixel] (qpv = ppv * quant_scale) .in 0.8i - the planes/images are normalized .PP .in 0.5i (3) calibrated values [uCi/ml] (cpv = qpv * calibr_fctr) .in 0.8i - the planes/images are normalized .PP .in 0.2i The float values in the header are stored as VAX format. .SH FILES .PP .in 0.2i .nf /usr/local/xmedcon/source/m-ecat64.h The header file. /usr/local/xmedcon/source/m-ecat64.c The source file. /usr/local/xmedcon/source/m-matrix64.h CTI header file. /usr/local/xmedcon/source/m-matrix64.c CTI source file. .fi .PP .in 0.2i .SH SEE ALSO .PP .in 0.2i medcon(1), xmedcon(1), xmedcon-config(1) .PP .in 0.2i m-acr(4), m-anlz(4), m-gif(4), m-inw(4), m-intf(4) .PP .in 0.2i medcon(3) .PP .in 0.2i .SH AUTHOR .PP .in 0.2i .I (X)MedCon project was originally written by Erik Nolf (eNlf) for the former PET-Centre at Ghent University (Belgium). .PP .in 0.2i .TS tab(=); lB l lB l. e-mail:=enlf-at-users.sourceforge.net=www:=http://xmedcon.sourceforge.net .TE xmedcon-0.14.1/man/xmedcon-config.10000644000175000017510000000344210415033212013703 00000000000000'\" t .TH MEDCON 1 .SH NAME xmedcon-config - script to get info about the installed version of (X)MedCon .SH SYNOPSIS .in 0.2i .HP 7 .B xmedcon-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags] .SH DESCRIPTION .PP .in 0.2i .I xmedcon-config is a tool that is used to determine the compiler and linker flags that should be used to compile and link programs that use the (X)MedCon library. It is also used internally to the .m4 macro, included for GNU autoconf. .SH OPTIONS .PP .in 0.2i .TP .B --version Print the currently installed version of (X)MedCon on the standard output. .TP .B --libs Print the linker flags that are necessary to link an (X)MedCon depended program. .TP .B --cflags Print the compiler flags that are necessary to compile an (X)MedCon depended program. .TP .B --prefix=PREFIX If specified, use PREFIX instead of the installation prefix that (X)MedCon was built with when computing the output for the --cflags and --libs options. This option is also used for the exec prefix if --exec-prefix was not specified. This option must be specified before any --libs or --cflags options. .TP .B --exec-prefix=PREFIX If specified, use PREFIX instead of the installation exec prefix that (X)MedCon was built with when computing the output for the --cflags and --libs options. This option must be specified before any --libs or --cflags options. .PP .in 0.2i .SH SEE ALSO .PP .in 0.2i medcon(1), xmedcon(1) .PP .in 0.2i m-acr(4), m-anlz(4), m-gif(4), m-inw(4), m-intf(4), m-ecat(4) .PP .in 0.2i medcon(3) .PP .in 0.2i .SH AUTHOR .PP .in 0.2i .I (X)MedCon project was originally written by Erik Nolf (eNlf) for the former PET-Centre at Ghent University (Belgium). .PP .in 0.2i .TS tab(=); lB l lB l. e-mail:=enlf-at-users.sourceforge.net=www:=http://xmedcon.sourceforge.net .TE xmedcon-0.14.1/man/m-inw.40000644000175000017510000001255710415033212012044 00000000000000'\" t .TH M-INW 4 .SH NAME m-inw - RUG INW1.0 medical image format (MedCon) .SH DESCRIPTION .PP .in 0.2i This is a local file format used at the RUG (Ghent, Belgium). The headers and image data are written in one file with extension `.im'. .PP .in 0.2i The basic defines for the format: .PP .in 0.2i .nf --------------------------------------------------------------------------- typedef struct Head_start_t { Int32 mark; /* should be HEADER_MARK */ Int16 version; /* high*256 + low */ Int16 size_header; /* whole header (in bytes) */ Int16 size_start; /* sizeof(Head_start_t) */ Int16 size_gen; /* sizeof(Head_gen_t) */ Int16 size_spec; /* sizeof(Head_spec_t) */ char reserved[10]; } MDC_INW_HEAD_START; /* current size: 24 */ #define MDC_INW_HEAD_START_SIZE 24 typedef struct Head_gen_t { Int16 no; /* number of planes */ Int16 sizeX; /* number of columns */ Int16 sizeY; /* number of rows */ Int16 pixel_type; /* sizeof(pixel) */ /* for compatibility only 2 is allowed */ Int16 init_trans; /* initial translation (mm) */ Int16 dummy1; /* for alignment reasons only */ /* Note: We take the positive axis into the gantry ! This means, if the patient lies with his head into the gantry, the head has higher translation offset than his feet */ char day[12]; /* day of first scan eg. 04-AUG-89 */ Int32 time; /* seconds after midnight */ /* first scan or time activity measured */ float decay_cst; /* NOT half_life ! (discards log(2)) */ /* decay_cst = half_life / log(2) */ float pixel_size; /* sampling distance (mm) */ float max; /* scaled maximum of all images */ float min; Int16 scanner; /* EcatII, EcatIV */ char reconstruction; /* reconFBP, reconMaxLik,... */ char recon_version; /* reconstruction version (0-99) */ char reserved[24]; } MDC_INW_HEAD_GEN; /* current size: 72 */ #define MDC_INW_HEAD_GEN_SIZE 72 typedef struct Head_spec_t { Int32 time; /* time relative to gen.time (secs) */ float cal_cst; /* abs_activ(uCU/ml) = cal_cst*pix_val */ /* cal_cst = calibr_cst * decay_comp */ /* decay_comp = exp(time/decay_cst) */ Int32 max; /* maximum in plane */ Int32 min; /* minimum in plane */ Int16 trans; /* translation relative to gen.trans mm */ char reserved[6]; } MDC_INW_HEAD_SPEC; /* current size: 24 */ #define MDC_INW_HEAD_SPEC_SIZE 24 --------------------------------------------------------------------------- .fi .PP .in 0.2i What does the format support or not support: .PP .in 0.2i .nf =========================================================================== Item Supported Not Supported =========================================================================== Color Map : grayscale - File Endian : little big Pixeltypes : Int16 - =========================================================================== Scaling factors : quantify or calibrate factors/image are supported --------------------------------------------------------------------------- Dimensions/Image : different dimensions for each image are NOT supported --------------------------------------------------------------------------- Pixeltypes/Image : different pixeltypes for each image are NOT supported =========================================================================== .fi .PP .in 0.2i .SH NOTES .PP .in 0.2i The first two structures in the file are HEAD_START and HEAD_GEN. After these data structures, a number of HEAD_SPEC structures follow, as much as there are images in the file. The float values in the headers are stored as VAX floats! .PP .in 0.2i Following the headers are the binary image data. The images are stored from left to right and from top to bottom. The pixel values are Int16, little endian. .PP .in 0.2i .SH FILES .PP .in 0.2i .nf /usr/local/xmedcon/source/m-inw.h The header file. /usr/local/xmedcon/source/m-inw.c The source file. .fi .PP .in 0.2i .SH SEE ALSO .PP .in 0.2i medcon(1), xmedcon(1), xmedcon-config(1) .PP .in 0.2i m-acr(4), m-anlz(4), m-gif(4), m-intf(4), m-ecat(4) .PP .in 0.2i medcon(3) .PP .in 0.2i .SH AUTHOR .PP .in 0.2i .I (X)MedCon project was originally written by Erik Nolf (eNlf) for the former PET-Centre at Ghent University (Belgium). .PP .in 0.2i .TS tab(=); lB l lB l. e-mail:=enlf-at-users.sourceforge.net=www:=http://xmedcon.sourceforge.net .TE xmedcon-0.14.1/man/m-gif.40000644000175000017510000002533110415033212012006 00000000000000'\" t .TH M-GIF 4 .SH NAME m-gif - GIF87a and annimated GIF89a format (MedCon) .SH DESCRIPTION .PP .in 0.2i The Graphics Interchange Format from CompuServe allows between 1 and 8 bits of color information with an RGB color palette. The image arrays are compressed with an LZW coding. The extension of the file is `.gif'. .PP .in 0.2i The basic defines for the format: .PP .in 0.2i .nf --------------------------------------------------------------------------- typedef struct { char sig[6]; /* GIF87a or GIF89a */ Uint16 screenwidth,screenheight; /* screen dimensions */ Uint8 flags,background,aspect; /* background color, ratio */ } MDC_GIFHEADER; #define MDC_GIF_GH_SIZE 13 typedef struct { Uint16 left,top,width,height; /* image dimensions */ Uint8 flags; } MDC_GIFIMAGEBLOCK; #define MDC_GIF_IBLK_SIZE 9 typedef struct { /* display information */ Uint8 blocksize; Uint8 flags; Uint16 delay; Uint8 transparent_colour; Uint8 terminator; } MDC_GIFCONTROLBLOCK; #define MDC_GIF_CBLK_SIZE 6 typedef struct { /* plain text block */ Uint8 blocksize; Uint16 left,top; Uint16 gridwidth,gridheight; Uint8 cellwidth,cellheight; Uint8 forecolour,backcolour; } MDC_GIFPLAINTEXT; #define MDC_GIF_TBLK_SIZE 13 typedef struct { /* application block */ Uint8 blocksize; char applstring[8]; char authentication[3]; } MDC_GIFAPPLICATION; #define MDC_GIF_ABLK_SIZE 12 --------------------------------------------------------------------------- .fi .PP .in 0.2i What does the format support or not support: .PP .in 0.2i .nf =========================================================================== Item Supported Not Supported =========================================================================== Color Map : max 256 RGB colors - File Endian : little big Pixeltypes : Uint8 - =========================================================================== Scaling factors : quantify & calibrate factors/image are NOT supported --------------------------------------------------------------------------- Dimensions/Image : different dimensions for each image are supported --------------------------------------------------------------------------- Pixeltypes/Image : different pixeltypes for each image are NOT supported =========================================================================== .fi .PP .in 0.2i Because of the flexible nature of the GIF format it could be possible to include scaling factors per image with the GIF extension blocks, but more about this later. The image is stored from left to right and from top to bottom, unless the images are interlaced. .PP .in 0.2i First some explanation on the GIF format and its different structures. .PP .in 0.2i ======================= .br The .B GIFHEADER structure .br ======================= .PP .in 0.2i This data structure is the very first information in a GIF file: .PP .in 0.2i .TP .B sig[6] Holds the signature of the file "GIF87a" or "GIF89a". .TP .B screenwidth, screenheight The required screen dimensions in pixels to display the images. .TP .B background This represents the background color. It is in fact an index entry in the color palette. .TP .B aspect The aspect ratio of the pixels in the image. If this field is not 0 the aspect ratio is: ((gh.aspect + 15) / 64). This entry is always 0 for the GIF87a format. .TP .B flags This fields contains a number of bits of information. .br if (gh.flags & 0x0080) is true, a global color map will follow. .nf The number of color bits: ((gh.flags & 0x0007) + 1) The number of colors : (1 << ((gh.flags & 0x0007) + 1) .fi if (gh.flags > 0x0008) is true, the color palette is sorted with the most important colors first. This bit is low in GIF87a. .br Finally (1 << ((gh.flags >> 4) + 1) represents the number of color bits in the original image. This bit is low in GIF87a. .PP .in 0.2i After reading the GIFHEADER and any global colormap, there should be a `block separator' which introduce the following block of GIF information. There are three kind of .B `block separators' : a comma, an exclamation mark and a semicolon. .br .nf ',' => the next block will be an image '!' => the next block will be an extension ';' => the end of the GIF file .fi .PP .in 0.2i The image block after a comma consists of the IMAGEBLOCK structure and the compressed image. The IMAGEBLOCK structure defines the nature of the image and supersedes the global definitions. .PP .in 0.2i ======================== .br The .B IMAGEBLOCK extension .br ======================== .PP .in 0.2i .TP .B left, top The upper left coordinate of the image relative to the screen. .TP .B width, height The image dimensions. Width is the number of pixels in a line. Depth represents the number of rows. .TP .B flags This field is similar to the global flags in the GIFHEADER structure. Number of colors in the image is ((iblk.flags & 0x0007) + 1). .br If (iblk.flags & 0x0040) is true, the image is .B interlaced. In this case the image is split into four passes instead of sequential lines: .br .ce 4 1st pass: lines 0 8 16 24 ... (+8) 2nd pass: lines 4 12 20 28 ... (+8) 3rd pass: lines 2 6 10 14 ... (+4) 4th pass: lines 1 3 5 7 ... (+2) If (iblk.flags & 0x0080) is true, there is a local color map. .br If (iblk.flags & 0x0020) is true, the color map is sorted. .br .PP .in 0.2i The next byte, after the IMAGEBLOCK should be the .B initial image code size . The compressed image consists of .B subblocks of code, of which the first byte gives the amount of code bytes that follow. The last block is a zero-length block. This is how you could skip an image: .PP .in 0.2i .nf FILE *fp; int i,n; do { n = fgetc(fp); /* get code size */ if (n != EOF) { for (i=0; i> 2) & 0x0007) tells the method to remove the present image from the screen: .PP .in 0.2i .nf 0 = do nothing 1 = leave it 2 = restore with the background color 3 = restore with the previous graphic .fi .TP .B delay The delay in 1/100ths of a second to dispose the present graphic. .TP .B transparant_color This fields represents the color index of the transparant color. .TP .B terminator Any clues on this? .PP .in 0.2i ========================= .br The .B APPLICATION extension .br ========================= .PP .in 0.2i The final extension is the APPLICATION block. The application data structure is identified by the byte .B 0xff just after the block separator. .TP .B blocksize This contains the value 0x0b. .TP .B applstring An 8-byte string that specifies the creator software. .TP .B authentication This field should contain 3 bytes based on the applstring field to check the integrity of the applstring field. .PP .in 0.2i The APPLICATION block extension can be followed by subblocks, ending with a zero-length subblock. .PP .in 0.2i A special kind of APPLICATION block extension is the .B LOOPBLOCK extension used for annimated GIF files in concern to Netscape Navigator. This block comes between the GIFHEADER and IMAGEBLOCK data structures. It contains the following items: .br .nf 1. An application block ap.blocksize = 0x0b; ap.applstring = "NETSCAPE"; ap.authentication = "2.0"; 2. subblock of 3 bytes: 0x03 0x01,0xe8,0x03 3. endblock of 0 bytes: 0x00 .fi .PP .in 0.2i .SH NOTES For complete information on the GIF format, we liked reading this book: .br .PP .in 0.2i .B ``Supercharged Bitmapped Graphics'' .br written by Steve Rimmer .br published by Windcrest/McGraw-Hill .br ISBN: 0-8306-3788-5 .PP .in 0.2i .SH FILES .PP .in 0.2i .nf /usr/local/xmedcon/source/m-gif.h The header file. /usr/local/xmedcon/source/m-gif.c The source file. .fi .PP .in 0.2i .SH SEE ALSO .PP .in 0.2i medcon(1), xmedcon(1), xmedcon-config(1) .PP .in 0.2i m-acr(4), m-anlz(4), m-inw(4), m-intf(4), m-ecat(4) .PP .in 0.2i medcon(3) .PP .in 0.2i .SH AUTHOR .PP .in 0.2i .I (X)MedCon project was originally written by Erik Nolf (eNlf) for the former PET-Centre at Ghent University (Belgium). .PP .in 0.2i .TS tab(=); lB l lB l. e-mail:=enlf-at-users.sourceforge.net=www:=http://xmedcon.sourceforge.net .TE xmedcon-0.14.1/man/medcon.30000644000175000017510000006366210604434032012271 00000000000000'\" t .TH MEDCON 3 .SH NAME medcon - MedCon C project for conversion of medical images .SH LIBRARY .PP .in 0.2i Local MedCon C library ( .B libmdc.a ) .SH SYNOPSIS .PP .in 0.2i .nf #include "medcon.h" .if .PP .in 0.2i .ce 3 ----------------------------------------------------------------------- Important Global Variables ----------------------------------------------------------------------- .PP .in 0.2i .nf char prefix[MDC_MAX_PREFIX+1]; /* prefix for new filenames */ /* command-line input data */ char *mdc_arg_files[]; /* pointers to input files */ int mdc_arg_convs[]; /* conversions selected */ int mdc_arg_total[]; /* total files & conversions*/ /* options set at command-line */ Int8 MDC_INFO; /* print image info */ Int8 MDC_INTERACTIVE; /* interactive read */ Int8 MDC_CONVERT; /* do conversion */ Int8 MDC_EXTRACT; /* extract images */ Int8 MDC_PIXELS; /* print pixel values */ Int8 MDC_SKIP_PREVIEW; /* skip first preview image*/ Int8 MDC_DICOM_MOSAIC; /* support mosaic files */ Int8 MDC_TRUE_GAP; /* spacing true gap/overlap */ Int8 MDC_DEBUG; /* show debug info */ Int8 MDC_ANLZ_REV; /* analyze reverse images */ Int8 MDC_ANLZ_SPM; /* analyze for SPM */ Int8 MDC_GIF_OPTIONS; /* define gif options */ Int8 MDC_COLOR_MAP; /* gray colormap selected */ Int8 MDC_MAKE_GRAY; /* remap color to gray */ Int8 MDC_DITHER_COLOR; /* dither color reduction */ Int8 MDC_FORCE_INT; /* force writing BIT?_? pixs*/ Int8 MDC_NEGATIVE; /* preserve negative pixels */ Int8 MDC_QUANTIFY; /* preserve quantification */ Int8 MDC_CALIBRATE; /* preserve calibration */ Int8 MDC_VERBOSE; /* verbose mode */ Int8 MDC_NORM_OVER_FRAMES /* normalize over frames */ /* 'QUANTIFY' & 'CALIBRATE' may NOT be ON at the same time! */ .fi .PP .in 0.2i .ce 3 ----------------------------------------------------------------------- Important Defines ----------------------------------------------------------------------- .PP .in 0.2i .nf /* representation of supported formats */ #define MDC_FRMT_NONE 0 /* unsupported format */ #define MDC_FRMT_RAW 1 /* Read Interactive */ /* Write RAW Binary */ #define MDC_FRMT_ASCII 2 /* Write RAW Ascii */ #define MDC_FRMT_GIF 3 /* GIF89a or GIF87a */ #define MDC_FRMT_ACR 4 /* Acr/Nema 2.0 (Papyrus) */ #define MDC_FRMT_INW 5 /* INW (RUG) */ #define MDC_FRMT_ECAT6 6 /* Siemens/CTI ECAT 6.4 */ #define MDC_FRMT_ECAT7 7 /* Siemens/CTI ECAT 7.2 */ #define MDC_FRMT_INTF 8 /* Interfile v3.3 */ #define MDC_FRMT_ANLZ 9 /* Analyze */ #define MDC_FRMT_DICM 10 /* DICOM 3.0 */ #define MDC_FRMT_PNG 11 /* PNG */ #define MDC_FRMT_CONC 12 /* Concorde uPet */ #define MDC_MAX_FMTS 13 /* total + 1 */ /* supported color maps */ #define MDC_MAP_PRESENT 0 /* 256 RGB colormap */ #define MDC_MAP_GRAY 1 /* grayscale colormap */ #define MDC_MAP_INVERTED 2 /* inverted colormap */ #define MDC_MAP_RAINBOW 3 /* rainbow colormap */ #define MDC_MAP_COMBINED 4 /* combined colormap */ #define MDC_MAP_HOTMETAL 5 /* hotmetal colormap */ #define MDC_MAP_LOADED 6 /* extern LUT loaded */ .if .PP .in 0.2i .ce 3 ----------------------------------------------------------------------- Important Definitions ----------------------------------------------------------------------- .PP .in 0.2i .nf typedef struct Gated_Data_t { Int8 gspect_nesting; /* gated spect nesting */ float nr_projections; /* number of projections */ float extent_rotation; /* extent of rotation */ float study_duration; /* study duration (ms) */ float image_duration; /* image duration (ms) */ float time_per_proj; /* time per proj (ms) */ float window_low; /* lower limit (ms) */ float window_high; /* higher limit (ms) */ float cycles_observed; /* cardiac cycles observed */ float cycles_acquired; /* cardiac cycles acquired */ } GATED_DATA; typedef struct Acquisition_Data_t { Int16 rotation_direction; /* direction of rotation */ Int16 detector_motion; /* type detector motion */ float angle_start; /* start angle (interfile) */ float angle_step; /* angular step */ float scan_arc; /* angular range */ } ACQ_DATA; typedef struct Dynamic_Data_t { Uint32 nr_of_slices; /* images in time frame */ float time_frame_start; /* start time frame (ms) */ float time_frame_delay; /* delay this frame (ms) */ float time_frame_duration; /* duration frame (ms) */ float delay_slices; /* delay each slice (ms) */ } DYNAMIC_DATA; typedef struct Bed_Data_t { float hoffset; /* horizontal position (mm) */ float voffset; /* vertical position (mm) */ } BED_DATA; typedef struct Static_Data_t { char label[MDC_MAXSTR]; /* label name of image */ float total_counts; /* total counts in image */ float image_duration; /* duration of image (ms) */ Int16 start_time_hour; /* start time hour */ Int16 start_time_minute; /* start time minute */ Int16 start_time_second; /* start time second */ } STATIC_DATA; typedef struct Image_Data_t { /* ** general data ** */ Uint32 width,height; /* image dimension */ Int16 bits,type; /* bits/pixel & datatype */ Uint16 flags; /* extra flag */ double min, max; /* min/max pixelvalue */ double qmin, qmax; /* quantified min/max */ double fmin, fmax; /* min/max in whole frame */ double qfmin, qfmax; /* in whole frame (quant) */ float rescale_slope; /* rescale slope */ /* P */ float rescale_intercept; /* rescale intercept */ /* P */ Uint32 frame_number; /* part of frame (1-based) */ /* P */ float slice_start; /* start of slice (ms) */ /* P */ Uint8 *buf; /* pointer to raw image */ long load_location; /* load start in file */ /* ** internal items ** */ Int8 rescaled; /* rescaled YES or NO */ double rescaled_min; /* new rescaled max */ double rescaled_max; /* new rescaled min */ double rescaled_fctr; /* new rescale fctr */ double rescaled_slope; /* new rescaled slope */ double rescaled_intercept; /* new rescaled intercept */ /* ** ecat64 items ** */ Int16 quant_units; /* quantification units */ Int16 calibr_units; /* calibration units */ float quant_scale; /* quantification scale */ float calibr_fctr; /* calibration factor */ float intercept; /* scale intercept */ float pixel_xsize; /* pixel size X (mm) */ float pixel_ysize; /* pixel size Y (mm) */ float slice_width; /* slice width (mm) */ float recon_scale; /* recon magnification */ /* ** Acr/Nema items ** */ float image_pos_dev[3]; /* image pos. device (mm) */ float image_orient_dev[6]; /* image orient device (mm) */ float image_pos_pat[3]; /* image pos. patient (mm) */ float image_orient_dev[6]; /* image orient patient (mm) */ float slice_spacing; /* space btw centres (mm) */ float ct_zoom_fctr; /* CT image zoom factor */ /* ** Miscellaneous ** STATIC_DATA *sdata; /* extra static entries */ unsigned char *plugb; /* like to attach here? */ } IMG_DATA; typedef struct File_Info_t { FILE *ifp; /* pointer to input file */ FILE *ifp_raw; /* pointer to raw input file*/ FILE *ofp; /* pointer to output file */ FILE *ofp_raw; /* pointer to raw output file*/ char ipath[MAX_PATH]; /* path to input file */ char opath[MAX_PATH]; /* path to output file */ char *idir; /* dir to input file */ char *odir; /* dir to output file */ char *ifname; /* name of input file */ char *ofname; /* name of output file */ int iformat; /* format of input file */ int oformat; /* format of output file */ Int8 rawconv; /* FRMT_RAW | FRMT_ASCII */ Int8 endian; /* endian type of file */ Int8 compression; /* file compression */ Int8 truncated; /* truncated ? */ Int8 diff_type; /* images with diff type */ Int8 diff_size; /* images with diff size */ Int8 diff_scale; /* images with diff rescale? */ Uint32 number; /* total number of images */ /* P */ Uint32 mwidth, mheight; /* global max dimensions */ Uint16 bits, type; /* global bits & datatype */ Int16 dim[8]; /* [0] = # of dimensions */ /* [1] = X-dim (pixels) */ /* [2] = Y-dim (pixels) */ /* [3] = Z-dim (planes) */ /* [4] = (frames) */ /* [5] = (gates) */ /* [6] = (beds) */ /* ... */ /* values must be 1-based */ float pixdim[8]; /* [0] = # of dimensions */ /* [1] = X-dim (mm) */ /* [2] = Y-dim (mm) */ /* [3] = Z-dim (mm) */ /* [4] = time (ms) */ /* ... */ double glmin, glmax; /* global min/max value */ double qglmin, qglmax; /* quantified min/max */ Int8 contrast_remapped; /* contrast remap applied? */ float window_centre; /* contrast window centre */ float window_width; /* contrast window width */ Int8 slice_projection; /* projection of images */ Int8 pat_slice_orient /* combined flag */ char pat_pos[MDC_MAXSTR]; /* patient position */ char pat_orient[MDC_MAXSTR]; /* patient orientation */ char patient_sex[MDC_MAXSTR]; /* sex of patient */ char patient_name[MDC_MAXSTR]; /* name of patient */ char patient_id[MDC_MAXSTR]; /* id of patient */ char patient_dob[MDC_MAXSTR]; /* birth of patient YYYYMMDD */ float patient_weight; /* weight of patient (kg) */ char study_descr[MDC_MAXSTR]; /* study description */ char study_id[MDC_MAXSTR]; /* study id */ Int16 study_date_day; /* day of study */ Int16 study_date_month; /* month of study */ Int16 study_date_year; /* year of study */ Int16 study_time_hour; /* hour of study */ Int16 study_time_minute; /* minute of study */ Int16 study_time_second; /* second of study */ Int16 dose_time_hour; /* hour of dose start */ Int16 dose_time_minute; /* minute of dose start */ Int16 dose_time_second; /* second of dose start */ Int16 nr_series; /* number of series */ Int16 nr_acquisition; /* number of acquisition */ Int16 nr_instance; /* number of instance (image)*/ Int16 acquisition_type; /* acquisition type */ Int16 planar; /* planar of tomo ? */ Int16 decay_corrected; /* decay corrected ? */ Int16 flood_corrected; /* flood corrected ? */ Int16 reconstructed; /* reconstructed ? */ char recon_method[MDC_MAXSTR]; /* reconstruction method */ char institution[MDC_MAXSTR]; /* name of institution */ char manufacturer[MDC_MAXSTR]; /* name of manufacturer */ char series_descr[MDC_MAXSTR]; /* series description */ char radiopharma[MDC_MAXSTR]; /* radiopharmaceutical */ char filter_type[MDC_MAXSTR]; /* filter type */ char organ_code[MDC_MAXSTR]; /* organ */ char isotope_code[MDC_MAXSTR]; /* isotope */ float isotope_halflife; /* isotope halflife (sec) */ float injected_dose; /* amount injected (MBq) */ float gantry_tilt; /* gantry tilt */ Uint8 map; /* indexed 256 colormap */ Uint8 palette[768]; /* global palette */ char *comment; /* whatever comment */ Uint32 comm_length; /* length of comment */ Uint32 gatednr; /* number of gated entries */ GATED_DATA *gdata; /* array of GATED_DATA */ Uint32 acqnr; /* number acq. data entries */ ACQ_DATA *acqdata; /* array of ACQ_DATA entries */ Uint32 dynnr; /* number of time frames */ DYNAMIC_DATA *dyndata; /* array of DYNAMIC_DATA */ Uint32 bednr; /* number bed data entries */ BED_DATA *beddata; /* array of BED_DATA entries */ IMG_DATA *image; /* array of IMG_DATA images */ MOD_INFO *mod; /* modalities specific info */ unsigned char *pluga; /* want to attach stuff? */ } FILEINFO; .fi .PP .in 0.2i .ce 3 ------------------------------------------------------------------------ Important Functions ------------------------------------------------------------------------ .PP .in 0.2i .nf void MdcInit (void); void MdcFinish (void); int MdcHandleArgs ( FILEINFO *fi,int argc,char *argv[],int MAXFILES ); void MdcPrintUsage ( char *pgrname ); int MdcOpenFile ( FILEINFO *fi, char *path ); int MdcReadFile ( FILEINFO *fi, int filenr, char *(*ReadFile)(FILEINFO *fi) ); int MdcWriteFile ( FILEINFO *fi, int format, int prefixnr, char *(*WriteFile)(FILEINFO *fi) ); void MdcInitFI ( FILEINFO *fi, char *path ); void MdcFreeIDs ( FILEINFO *fi ); void MdcCleanUpFI ( FILEINFO *fi ); void MdcResetIDs ( FILEINFO *fi ); void MdcPrintFI ( FILEINFO *fi ); void MdcCloseFile ( FILEINFO *fi ); void MdcSplitPath ( char path[], char **dir, char **fname ); int MdcGetFrmt ( FILEINFO *fi ); void MdcGetColorMap ( int map, Uint8 palette[] ); char *MdcImagesPixelFiddle( FILEINFO *fi); void MdcPrntMesg ( char *fmt, ... ); void MdcPrntWarn ( char *fmt, ... ); void MdcPrntErr ( int code, char *fmt, ... ); char *MdcReadGIF ( FILEINFO *fi ); char *MdcReadACR ( FILEINFO *fi ); char *MdcReadINW ( FILEINFO *fi ); char *MdcReadECAT6 ( FILEINFO *fi ); char *MdcReadECAT7 ( FILEINFO *fi ); char *MdcReadINTF ( FILEINFO *fi ); char *MdcReadANLZ ( FILEINFO *fi ); char *MdcReadRAW ( FILEINFO *fi ); char *MdcReadDICM ( FILEINFO *fi ); char *MdcReadPNG ( FILEINFO *fi ); char *MdcReadCONC ( FILEINFO *fi ); char *MdcReadNIFTI ( FILEINFO *fi ); char *MdcWriteRAW ( FILEINFO *fi ); char *MdcWriteGIF ( FILEINFO *fi ); char *MdcWriteACR ( FILEINFO *fi ); char *MdcWriteINW ( FILEINFO *fi ); char *MdcWriteECAT6 ( FILEINFO *fi ); char *MdcWriteINTF ( FILEINFO *fi ); char *MdcWriteANLZ ( FILEINFO *fi ); char *MdcWriteDICM ( FILEINFO *fi ); char *MdcWritePNG ( FILEINFO *fi ); char *MdcWriteCONC ( FILEINFO *fi ); char *MdcWriteNIFTI ( FILEINFO *fi ); .fi .PP .in 0.2i .SH DESCRIPTION .PP .in 0.2i The .I MedCon library is intended for easy use of read/write routines for the various medical image formats. Our main test format is Ecat 6.4. The FILEINFO structure holds all the interesting data and pointers to the images. A fast introduction ... .PP .in 0.2i .TP .B MdcInit(), MdcFinish() The very first and very last function to call when using this library. Currently changes occur to the signal handler for floating point exceptions and the program's locale. .TP .B MdcHandleArgs() Parser for the command-line arguments. Last function argument determines the maximum of input files allowed. The absolute maximum is MDC_MAX_FILES defined in the library. .TP .B MdcPrintUsage() Prints possible MedCon command-line options and terminates the program. .TP .B MdcOpenFile() Initializes FILEINFO struct and opens the file with or without decompression. .TP .B MdcReadFile() Reads the (decompressed) file with format autodetection or by trying a fallback format, initializes a (grayscale) colormap and does the obligated pixel handling. The last argument enables the use of an external read function. .TP .B MdcWriteFile() Writes a file in the supplied format. Last argument is a number used in the prefix of the output filename. Give a negative value when a personal prefix was prepared. The last argument enables the use of an external write function. .TP .B MdcCloseFile() Closes the file and sets the pointer to NULL. .TP .B MdcInitFI() Initializes the FILEINFO structure. .TP .B MdcFreeIDs() Cleans the IMG_DATA structures by freeing all allocated memory. .TP .B MdcCleanUpFI() Cleans the FILEINFO structure. The routine makes use of FreeIDs(). .TP .B MdcResetIDs() Resets the IMG_DATA structures. This is necessary after each conversion. .TP .B MdcPrintFI() Prints the content of the FILEINFO structure. Useful for debug purposes. .TP .B MdcSplitPath() Splits the path in a string pointer to directory and filename. .TP .B MdcGetFrmt() Checks the format of the file. For the return value, see the representation of the supported formats under the section `Important Defines'. With the INTERACTIVE variable ON, the function returns F_RAW; see also ReadRaw(). .TP .B MdcGetColorMap() Fills a 256 byte RGB palette with the requested grayscale colormap. .TP .B MdcImagesPixelFiddle() Performs all the pixel by pixel processes such as swapping bytes, make positive values, quantification, rescaling, filling the FILEINFO structure with global & image variables and check some important parameters. This function is required after a file was read! .TP .B MdcPrntMesg() Prints a message. Argument is a variable parameter list. .TP .B MdcPrntWarn() Prints a warning. Argument is a variable parameter list. .TP .B MdcPrntErr() Prints an error and quits the program. The first argument is the error code. .TP .B MdcReadRAW() - MdcWriteRAW() Reads files of an unknown format interactively and writes raw image arrays with out headers. ReadInterActive() is an alias for MdcReadRAW(). .TP .B MdcReadGIF() - MdcWriteGIF() Reads GIF87a & GIF89a, writes annimated GIF89a files. .TP .B MdcReadACR() - MdcWriteACR() Reads and writes Acr/Nema files. .TP .B MdcReadINW() - MdcWriteINW() Reads and writes RUG INW files. .TP .B MdcReadECAT6(), MdcReadECAT7() - MdcWriteECAT6() Reads ECAT 6 (resp. 7). Writes ECAT 6.4 files. .TP .B MdcReadINTF() - MdcWriteINTF() Reads and writes Interfile 3.3 files. .TP .B MdcReadANLZ() - MdcWriteANLZ() Reads and writes Analyze (SPM) files. .TP .B MdcReadDICM() - MdcWriteDICM() Reads DICOM files. Writes DICOM files. .TP .B MdcReadPNG() - MdcWritePNG() Reads PNG files. Writes PNG files. .TP .B MdcReadCONC() - MdcWriteCONC() Reads and writes Concorde microPET. .TP .B MdcReadNIFTI() - MdcWriteNIFTI() Reads and writes NIH's NIfTI files. .SH EXAMPLE .PP .in 0.2i A sample C-source code to show the usage of the functions. Please, look into the project source code for more details. .PP .in 0.2i .nf ----------------------------------------------------------------------- .B /* filename: testit.c */ #include #include "medcon.h" #undef VERSION /* prevent any conflict */ #define VERSION "TestIt v2.3" void NewPrefix(int n) { sprintf(prefix,"my%02d-",n); /* max of 5 chars */ } int main(int argc, char *argv[]) { FILEINFO fi; int *total = mdc_arg_total; /* total arguments of files & conversions */ int *convs = mdc_arg_convs; /* counter for each conversion format */ char **files = mdc_arg_files; /* array of pointers to input filenames */ int f, c; /* some counters */ int t=0; /* counter for the output name prefix */ int convert, err=MDC_OK; /* some variables */ .B /* check arguments */ if (argc < 2) { printf("%s - %s\\n",VERSION,MdcGetLibLongVersion()); MdcPrintUsage(argv[0]); } .B /* init library */ MdcInit(); .B /* handle arguments, last one determines max inputfiles */ if (MdcHandleArgs(&fi,argc,argv,MDC_MAX_FILES) != MDC_OK) MdcPrintUsage(argv[0]); .B /* check output/conversion formats */ if (total[MDC_CONVS] == 0) { printf("\\n%s: ERROR : No output format specified\\n\\n",argv[0]); return(MDC_BAD_CODE); } .B /* do the stuff for each input file */ for (f=0; f 0) { .B /* go through conversion formats */ for (c=1; c 0) { if ((err = MdcWriteFile(&fi, c, t++, NULL)) != MDC_OK) { MdcCleanUpFI(&fi); return(err); } } } } .B /* clean up FILEINFO struct */ MdcCleanUpFI(&fi); } .B /* finish library */ MdcFinish(); return(err); } ----------------------------------------------------------------------- .fi .PP .in 0.2i Example `Makefile' for compiling `testit.c': .PP .in 0.2i .nf ----------------------------------------------------------------------- # filename: Makefile CC = gcc CCOPTS = -Wall -g CFLAGS = $(CCOPTS) INCS = `xmedcon-config --cflags` LIBS = `xmedcon-config --libs` testit: testit.c $(CC) $(CFLAGS) $(INCS) -o testit testit.c $(LIBS) # don't forget a before $(CC). You can lose this with copy/paste ----------------------------------------------------------------------- .fi .PP .in 0.2i .SH FILES .PP .in 0.2i .TS tab(@); l l. /usr/local/xmedcon/include/@Directory with header files.. /usr/local/xmedcon/lib/@Directory with libraries. /usr/local/xmedcon/bin/@Directory with executables. /usr/local/xmedcon/man/@Directory with man-pages. /usr/local/xmedcon/etc/@Directory with rcfiles. .TE .PP .in 0.2i .SH SEE ALSO .PP .in 0.2i medcon(1), xmedcon(1), xmedcon-config(1) .PP .in 0.2i m-acr(4), m-anlz(4), m-gif(4), m-intf(4), m-ecat(4), m-inw(4) .PP .in 0.2i .SH AUTHOR .PP .in 0.2i .I (X)MedCon project was originally written by Erik Nolf (eNlf) for the former PET-Centre at Ghent University (Belgium). .PP .in 0.2i .TS tab(=); lB l lB l. e-mail:=enlf-at-users.sourceforge.net=www:=http://xmedcon.sourceforge.net .TE xmedcon-0.14.1/man/m-acr.40000644000175000017510000005161311203075327012021 00000000000000'\" t .TH M-ACR 4 .SH NAME m-acr - ACR/NEMA medical image format (MedCon) .SH DESCRIPTION .PP .in 0.2i We are absolutely lost in standards, versions and ACR/NEMA dialects. Here you can only read how we handle this format. The format is written in one file with extension `.ima'. .PP .in 0.2i The format consists of a group of fields with different elements, in a serie of tags. Does that explain you something? The image data is stored from left to right and from top to bottom. .PP .in 0.2i The basic defines for the format: .PP .in 0.2i .nf --------------------------------------------------------------------------- #define MDC_ACR_TAG_SIZE 8 /* size of group+element+length */ typedef struct { Uint16 group; /* the kind of group */ Uint16 element; /* the kind of element */ Uint32 length; /* the length of data */ Uint8 *data; /* pointer to the data */ } MDC_ACR_TAG; --------------------------------------------------------------------------- .if .PP .in 0.2i What does the format support or not support: .PP .in 0.2i .nf =========================================================================== Item Supported Not Supported =========================================================================== Color Map : grayscale - File Endian : little & big - Pixeltypes : all integers (signed/unsigned) float & double =========================================================================== Scaling factors : quantify & calibrate factors/image are NOT supported, unless you define your own tags --------------------------------------------------------------------------- Dimensions/Image : different dimensions for each image are supported --------------------------------------------------------------------------- Pixeltypes/Image : different pixeltypes for each image are supported =========================================================================== .fi .PP .in 0.2i An ACR/NEMA file could look like this, in fact it is the kind we write: .PP .in 0.2i .nf =========================================================================== .B GROUP 0x0008 Identifying information =========================================================================== Uint16 Group number : 0x0008 Uint16 Element number : 0x0000 (first element of any group) Uint32 Element length in bytes : (4) Int32 Length of group in bytes : (X) (143) X = [total length of this group] - [total bytes of this first tag (12)] --------------------------------------------------------------------------- Uint16 Group number : 0x0008 Uint16 Element number : 0x0001 Uint32 Element length in bytes : (4) Int32 Total bytes to end of file : Y Y = [filesize] - [total bytes of first two tags] --------------------------------------------------------------------------- Uint16 Group number : 0x0008 Uint16 Element number : 0x0010 Uint32 Element length in bytes : (12) char * Recognition Code : (ACR-NEMA 2.0) --------------------------------------------------------------------------- Uint16 Group number : 0x0008 Uint16 Element number : 0x0020 Uint32 Element length in bytes : (10) char * Study Date : yyyy.mm.dd --------------------------------------------------------------------------- Uint16 Group number : 0x0008 Uint16 Element number : 0x0030 Uint32 Element length in bytes : (14) char * Study Time : hh.mm.ss.frac_ --------------------------------------------------------------------------- Uint16 Group number : 0x0008 Uint16 Element number : 0x0040 Uint32 Element length in bytes : (2) Int16 Data Set Type : 0 = Images 256 = Raw data --------------------------------------------------------------------------- Uint16 Group number : 0x0008 Uint16 Element number : 0x0060 Uint32 Element length in bytes : (2) char * Image Modality : (NM) --------------------------------------------------------------------------- Uint16 Group number : 0x0008 Uint16 Element number : 0x0070 Uint32 Element length in bytes : (24) char * Manufacturer : (MedCon v?.?? - Erik Nolf) --------------------------------------------------------------------------- Uint16 Group number : 0x0008 Uint16 Element number : 0x0080 Uint32 Element length in bytes : (11) char * Institution ID : (NucMed) =========================================================================== .B GROUP 0x0010 Patient Information =========================================================================== Uint16 Group number : 0x0010 Uint16 Element number : 0x0000 Uint32 Element length in bytes : (4) Int32 Length of group in bytes : (96) --------------------------------------------------------------------------- Uint16 Group number : 0x0010 Uint16 Element number : 0x0010 Uint32 Element length in bytes : (35) char * Patient Name : --------------------------------------------------------------------------- Uint16 Group number : 0x0010 Uint16 Element number : 0x0020 Uint32 Element length in bytes : (35) char * Patient ID : --------------------------------------------------------------------------- Uint16 Group number : 0x0010 Uint16 Element number : 0x0040 Uint32 Element length in bytes : (2) char * Patient Sex : M_ = male F_ = female O_ = others =========================================================================== .B GROUP 0x0018 Acquisition Information =========================================================================== Uint16 Group number : 0x0018 Uint16 Element number : 0x0000 Uint32 Element length in bytes : (4) Int32 Length of group in bytes : (122) --------------------------------------------------------------------------- Uint16 Group number : 0x0018 Uint16 Element number : 0x0030 Uint32 Element length in bytes : 32 char * Radionuclide : --------------------------------------------------------------------------- Uint16 Group number : 0x0018 Uint16 Element number : 0x0050 Uint32 Element length in bytes : (13) char * Slice Thickness in mm : (+0.000000e+00) --------------------------------------------------------------------------- Uint16 Group number : 0x0018 Uint16 Element number : 0x0088 Uint32 Element length in bytes : (13) char * Slice Spacing in mm : (+0.000000e+00) --------------------------------------------------------------------------- Uint16 Group number : 0x0018 Uint16 Element number : 0x1120 Uint32 Element length in bytes : (13) float Gantry Tilt in degrees : (+0.000000e+00) --------------------------------------------------------------------------- Uint16 Group number : 0x0018 Uint16 Element number : 0x1160 Uint32 Element length in bytes : (32) char * Filter Type : --------------------------------------------------------------------------- Uint16 Group number : 0x0018 Uint16 Element number : 0x5100 Uint32 Element length in bytes : (32) char * Patient Position : (supine) supine = face-up on the table prone = face-down towards the table other? =========================================================================== .B GROUP 0x0020 Relationship Information =========================================================================== Uint16 Group number : 0x0020 Uint16 Element number : 0x0000 Uint32 Element length in bytes : (4) Int32 Length of group in bytes : (352) --------------------------------------------------------------------------- Uint16 Group number : 0x0020 Uint16 Element number : 0x0010 Uint32 Element length in bytes : (10) char * Study ID : --------------------------------------------------------------------------- Uint16 Group number : 0x0020 Uint16 Element number : 0x0013 Uint32 Element length in bytes : (6) char * Image Number : --------------------------------------------------------------------------- Uint16 Group number : 0x0020 Uint16 Element number : 0x0020 Uint32 Element length in bytes : (32) char * Patient Orientation : (L\\P) (direction of image row in patient\\direction of image column in patient) 'L' = Left (hand) 'A' = Anterior (to front) 'H' = Head 'R' = Right (hand) 'P' = Posterior (to back) 'F' = Feet --------------------------------------------------------------------------- Uint16 Group number : 0x0020 Uint16 Element number : 0x0030 Uint32 Element length in bytes : (41) char * Image Position in mm : * * * * * * * * * * * * * Gives the 3D equipment based coordinates of the upper left hand corner in the image. Example: (+0.000000e+00\\+0.000000e+00\\+0.000000e+00) =X-axis =Y-axis =Z-axis "When facing the front of the gantry (equipment device), and with the gantry in a neutral (untilted) position, the x-axis is increasing to the right; the y-axis is increasing down (gravitational attraction); and the z-axis is defined as the line orthogonal to x and y, with increasing values from the front to the back of the gantry." (From a Papyrus 2.3 document: UIN/HCUG 1990, 91) My note: where is its origin? For an ECAT 931 scanner we choose the origin in the right/back/down point of the gantry A ______H |\\______\\F Looking to the scanner, this is a representation of the R |.|.... | L volume our scanner detects. My origin is in the point we \\|_____| can't see ;-) Our images are transversal slices, beginning at the head towards the feet (so patient orientation = L\\P) P and the patient position is supine. Therefore, the coordinates of the first pixel in our images is: Image 0: -(PIXEL_X_SIZE*PIXELS_IN_X);-(PIXEL_Y_SIZE*PIXELS_IN_Y);-0 Image 1: -(PIXEL_X_SIZE*PIXELS_IN_X);-(PIXEL_Y_SIZE*PIXELS_IN_Y);-(SLICE_WIDTH*1) Image n: -(PIXEL_X_SIZE*PIXELS_IN_X);-(PIXEL_Y_SIZE*PIXELS_IN_Y);-(SLICE_WIDTH*N) | | image width image height A view of the coordinate system you can see in 0x0020;0x0035. However, it could all be wrong too! By the way, for DICOM it's retired stuff. * * * * * * * * * * * * * --------------------------------------------------------------------------- Uint16 Group number : 0x0020 Uint16 Element number : 0x0032 Uint32 Element length in bytes : (41) char * Image Position (Patient) in mm: * * * * * * * * * * * * * The same as above but know based on the coordinate system of the patient. A DICOM replacement for the above values: "The direction of the axes is defined fully by the patient's orientation. The x-axis is increasing to the left hand side of the patient. The y-axis is increasing to the posterior side of the patient. The z-axis is increasing toward the head of the patient. The patient based coordinate system is a right handed system, i.e. the vector cross product of a unit vector along the positive x-axis and a unit vector along the positive y-axis is equal to a unit vector along the positive z-axis. NOTE: If a patient lies parallel to the ground, face-up on the table, with his feet-to-head direction the same as front-to-back direction of the imaging equipment, the direction of the axes of the patient based coordinate system and equipment based coordinate system in previous versions of the DICOM Standard will coincide" (From the NEMA Standards Publication PS3.3(199X) * * * * * * * * * * * * * --------------------------------------------------------------------------- Uint16 Group number : 0x0020 Uint16 Element number : 0x0032 Uint32 Element length in bytes : (83) char * Image Orientation : * * * * * * * * * * * * * Based on 0x0020;0x0030 these are the direction cosines of a unit vector on the first row and on the first column based on the equipment coordinate system (or our patient coordinate system, because they coincide as we described above). (to back of the scanner) +Z (or head of the patient) \\ \\ coordinate system \\ \\_ _ _ _ _ _ _ +X (to right of the scanner) | (or left of the patient) | | | +Y (to the ground) (or back of the patient) * * * * * * * * * * * * * Remember we take transversal slices (Right to Left of patient, Anterior to Posterior) while the patient is supine with head first in gantry. Then the images are in the plane XY and the unit vectors are upper left corner of image (X) + - - - - > (x1,y1,z1 = 1,0,0) | unit vector on row | | (Y) V (x2,y2,z2 = 0,1,0) unit vector on column In this case: a) in point (x1,y1,z1) X direction cosinus = +1 Y direction cosinus = -0 Z direction cosinus = -0 b) in point (x2,y2,z2) X direction cosinus = +0 Y direction cosinus = +1 Z direction cosinus = +0 How about the signs and values? cos(0 or 360) = +1 cos(90) = +0 cos(180) = -1 cos(270) = -0 The angle between an axis and the vector, you determine with a so called "corkscrew-rule": You must turn from THE AXIS towards THE VECTOR (=angle) the same direction so a corkscrew should proceed in the direction of an axis orthogonal on the plane formed by THE AXIS and THE VECTOR. Well, thats what it should be I think. If your images are tilted, it will be a bit harder, isn't it? For the above ECAT 931 acquisition an example value should be: (+1.000000e+00\\-0.000000e+00\\+0.000000e+00\\ +0.000000e+00\\+1.000000e+00\\-0.000000e+00) Again, this tag is retired for DICOM ... * * * * * * * * * * * * * --------------------------------------------------------------------------- Uint16 Group number : 0x0020 Uint16 Element number : 0x0037 Uint32 Element length in bytes : (83) char * Image Orientation Patient : The same as for tag 0x0020;0x0032 but now considered for the patient coordinate system ... =========================================================================== .B GROUP 0x0028 Image Presentation =========================================================================== Uint16 Group number : 0x0028 Uint16 Element number : 0x0000 Uint32 Element length in bytes : (4) Int32 Length of group in bytes : (127) --------------------------------------------------------------------------- Uint16 Group number : 0x0028 Uint16 Element number : 0x0005 Uint32 Element length in bytes : (2) Int16 Image Dimensions : (2) --------------------------------------------------------------------------- Uint16 Group number : 0x0028 Uint16 Element number : 0x0010 Uint32 Element length in bytes : (2) Int16 Rows : --------------------------------------------------------------------------- Uint16 Group number : 0x0028 Uint16 Element number : 0x0011 Uint32 Element length in bytes : (2) Int16 Columns : --------------------------------------------------------------------------- Uint16 Group number : 0x0028 Uint16 Element number : 0x0030 Uint32 Element length in bytes : (27) char * Pixel Size in mm : (+0.000000e+00\\+0.000000e+00) --------------------------------------------------------------------------- Uint16 Group number : 0x0028 Uint16 Element number : 0x0060 Uint32 Element length in bytes : (4) char * Compression code : (NONE) --------------------------------------------------------------------------- Uint16 Group number : 0x0028 Uint16 Element number : 0x0100 Uint32 Element length in bytes : (2) Int16 Bits Allocated : --------------------------------------------------------------------------- Uint16 Group number : 0x0028 Uint16 Element number : 0x0101 Uint32 Element length in bytes : (2) Int16 Bits per Pixel : --------------------------------------------------------------------------- Uint16 Group number : 0x0028 Uint16 Element number : 0x0102 Uint32 Element length in bytes : (2) Int16 High Bit : --------------------------------------------------------------------------- Uint16 Group number : 0x0028 Uint16 Element number : 0x0103 Uint32 Element length in bytes : (2) Int16 Pixel Representation : 0 = unsigned 1 = signed --------------------------------------------------------------------------- Uint16 Group number : 0x0028 Uint16 Element number : 0x0200 Uint32 Element length in bytes : (2) Int16 Image Location : (7fe0) =========================================================================== .B GROUP 0x7fe0 Pixel Information =========================================================================== Uint16 Group number : 0x7fe0 Uint16 Element number : 0x0000 Uint32 Element length in bytes : (4) Int32 Length of group in bytes : Z Z = [imagesize] + 8 --------------------------------------------------------------------------- Uint16 Group number : 0x7fe0 Uint16 Element number : 0x0010 Uint32 Element length in bytes : (imagesize) Uint8 * Image Data : --------------------------------------------------------------------------- .fi .PP .in 0.2i This was an example of an ACR/NEMA file holding one image, as normal ACR/NEMA files do. However, as we are interested in multiple images, we use an ACR/NEMA dialect such as Papyrus. In this case we sequentially concatenate different ACR/NEMA files into one single large file! .PP .in 0.2i .SH NOTES .PP .in 0.2i Because of the previous remark, we must notify that in the Element 0x0001 of Group 0x0008, the [filesize] means the filesize in case of this one ACR/NEMA file and NOT the real filesize! .PP .in 0.2i For the Group 0x0028, Element 0x0100: `Bits Allocated' .br We only support a multiple of 8. .br For the Group 0x0028, Element 0x0102: `High Bit' .br We only support `High Bit' = [`Bits per Pixel'] - 1, .br so we only accept images stored in the file endian type. .PP .in 0.2i .SH FILES .PP .in 0.2i .nf /usr/local/xmedcon/source/m-acr.h The header file. /usr/local/xmedcon/source/m-acr.c The source file. .fi .PP .in 0.2i .SH SEE ALSO .PP .in 0.2i medcon(1), xmedcon(1), xmedcon-config(1) .PP .in 0.2i m-anlz(4), m-gif(4), m-inw(4), m-intf(4), m-ecat(4) .PP .in 0.2i medcon(3) .PP .in 0.2i .SH AUTHOR .PP .in 0.2i .I (X)MedCon project was originally written by Erik Nolf (eNlf) for the former PET-Centre at Ghent University (Belgium). .PP .TS tab(=); lB l lB l. e-mail:=enlf-at-users.sourceforge.net=www:=http://xmedcon.sourceforge.net .TE xmedcon-0.14.1/man/m-intf.40000644000175000017510000011376210415033212012207 00000000000000'\" t .TH M-INTF 4 .SH NAME m-intf - InterFile 3.3 medical image format (MedCon) .SH DESCRIPTION .PP .in 0.2i The file consists of two parts, the administrative data in ASCII and the binary image data. It is possible to put both in one file, but we prefer to separate the data into two files. The administrative data in a file with extension `.h33' and the binary data in a file with extension `.i33'. .PP .in 0.2i This is a wonderful feature! Because of the separate header in ASCII you could write your own header for any raw image data you may have. I regularly use InterFile for turning unsupported formats into a supported format. Try to extract the raw image data from the unknown format and add an appropriate header with all information you know about. .PP .in 0.2i The basic defines for the format: .PP .in 0.2i .nf --------------------------------------------------------------------------- #define MDC_INTF_MAXKEYCHARS 256 char keystr[MDC_INTF_MAXKEYCHARS]; /* the data type */ #define MDC_INTF_STATIC 1 #define MDC_INTF_DYNAMIC 2 #define MDC_INTF_GATED 3 #define MDC_INTF_TOMOGRAPH 4 #define MDC_INTF_CURVE 5 #define MDC_INTF_ROI 6 /* the process status */ #define MDC_INTF_ACQUIRED 1 #define MDC_INTF_RECONSTRUCTED 2 /* gated spect nesting outer level */ #define MDC_INTF_NESTING_SPECT 1 #define MDC_INTF_NESTING_GATED 2 typedef struct MdcInterFile_t { int data_type, process_status, pixel_type, gspect_nesting; Uint32 width, height, images_per_dimension, time_slots; Uint32 data_offset, data_blocks, imagesize, number_images; Uint32 energy_windows, frame_groups, time_windows, detector_heads; float pixel_xsize, pixel_ysize, slice_thickness, centre_centre_separation; float study_duration, image_duration, image_pause, group_pause, ext_rot; Int8 patient_rot, patient_orient, slice_orient; double version; } MDC_INTERFILE; --------------------------------------------------------------------------- .fi .PP .in 0.2i What does the format support or not support: .PP .in 0.2i .nf =========================================================================== Item Supported Not Supported =========================================================================== Color Map : grayscale - File Endian : little or big - Pixeltypes : 1-bit, all intergers - float, double, ASCII =========================================================================== Scaling factors : quantify & calibrate factors/image are NOT supported, unless you define your own key-value pairs --------------------------------------------------------------------------- Dimensions/Image : different dimensions for each image are supported --------------------------------------------------------------------------- Pixeltypes/Image : different pixeltypes for each image are supported, but decoders are not required to be able to read. MedCon does support different pixeltypes per image. =========================================================================== .fi .PP .in 0.2i Underneath you will find a description of the format. .PP .in 0.2i 1. ADMINISTRATIVE DATA .br =================== .PP .in 0.2i .IP a) 5 The administrative data are only composed of key-value pairs and exist in the form of ASCII text. The administrative data should be terminated with a .IP c) 5 The maximum permitted number of characters for a key or a value or a comment is 255 characters. .IP d) 5 Neither keys nor values are to be treated as case sensitive. The characters may all be treated as white space and ignored. .IP e) 5 All relevant keys should be included in the intermediate file. A null value is permitted which will invoke the default where specified. The required keys are preceded by an exclamation mark. .IP f) 5 A hole line or key-value pairs may have comments appended to them by preceding the comment with a semicolon <;>. .IP g) 5 A required key ("name of data file") is included to point to the image data file, even if the binary data is in the same file of the administrative data. .IP h) 5 The two alternate keys ("data starting block") or ("data offset in bytes") are used to indicate the offset of the binary data in the file as specified by the key ("name of data file"). The ("data starting block") represents the offset in number of blocks or 2048 bytes. The use of the key ("data offset in bytes") permits the offset to the binary data to be freely specified. .PP .in 0.2i 2. IMAGE DATA .br ========== .PP .in 0.2i .IP a) 5 The order of the pixel data shall increment by column from left to right, and then by row, from top to bottom. .IP b) 5 Image data shall be in either bit, signed or unsigned integer format, IEEE floating point format (float or double) or ASCII. When the data pixels are written in ASCII, the text line must not exceed 255 characters. .IP c) 5 The default value for the key ("imagedata byte order") is BIGENDIAN, but LITTLEENDIAN is allowed. The byte order must be respected for integer and floating point numbers. .IP d) 5 Bit data will stored in a single byte, representing 8 pixel values and ordered such that the most significant bit corresponds to the leftmost pixel. .PP .in 0.2i 3. LIST OF KEYS - VERSION 3.3 (Updated for Gated SPECT) .br ========================== .PP .in 0.2i .nf !INTERFILE := ;to indicate that this is an Interfile file !imaging modality := nucmed ;only nucmed is defined for the purpose of this document !originating system := ;eg.GAMMA-11, MDS, ADAC, etc. !version of keys := 3.3 ;future versions shall increment date of keys := 1996:09:26 ;date of version 3.3 in date format conversion program := ;name of program used program author := ;your chance of fame and fortune program version := ;to keep track of conversion programs program date := ;date of program !GENERAL DATA := ;required but can be treated as comment original institution := ;name of hospital etc. contact person := ;another chance of fame (and fortune?) data description := ;whatever you want !data starting block := 0 ;the value is the offset in blocks of 2048 bytes in either the ;administrative or the data file depending on the key value for ;name of data file (see below) | ;OR !data offset in bytes:= 0 ;as above but the offset may be specified freely in bytes !name of data file := ; if no image data exists ;key is a name of the file where the data are present, either when ;in a separate binary data file, or when in a combined ;administrative/binary data file patient name := ;last name, first name (recommended) !patient ID := ;as used in your hospital patient dob := ;date of birth patient sex := Unknown M|F|Unknown ;default is Unknown! !study ID := ;as local conditions dictate exam type := ;description of procedure as above data compression := none ;name of algorithm if present- e.g. JPEG, etc. data encode := none ;name of method of encoding if present- e.g. uuencode etc. organ := none ;ENLF: for mapping with DICOM tag (0018,0015) BodyPartExamined isotope := | / none ;ENLF: for mapping with DICOM radionuclide/radiopharmaceutical entries. dose := 0 ;ENLF: for mapping with DICOM tag (0018,1074) RadionuclideTotalDose [MBq] !GENERAL IMAGE DATA := ;again required but treated as comment !type of data := Other Static|Dynamic|Gated|Tomographic|Curve|ROI|GSPECT|Other ;important - this key is used for many conditionals !total number of images := ;how many images are there altogether in total in the associated ;data file (for all windows etc.). This overrides any other way of ;calculating the total number of images. study date := ;date of the first image included in the data file study time := ;time for the start of first image specified imagedata byte order := BIGENDIAN BIGENDIAN|LITTLEENDIAN ;BIGENDIAN is the default if unspecified process label := none ;ENLF: for mapping with DICOM tag (0008,103E) SeriesDescription quantification units := +1.696265e-05 ;ENLF: global scale factor for mediman dialect NUD/rescale slope := +1.696265e-05 ;ENLF: global scale factor for NUD systems NUD/rescale intercept := +0.000000e+00 ;ENLF: global scale intercept for NUD systems number of energy windows := 1 ;defaulted to one if unspecified for ( number of energy windows, energy window) { energy window[] := ;ASCII text- for example "Tc99m" ;this starts as "energy window [1]" and then increments to ;energy window[2]:= ;and then on to ;energy window[3]:= ;etc. etc. energy window lower level [] := ;value of lower energy level in keV for the corresponding window ;starts off as "energy window lower level [1]" ;and continues [2],[3] .. as above energy window upper level [] := ;value of upper energy level in keV for the corresponding window ;starts off as "energy window upper level [1]" ;and continues [2],[3] .. as above flood corrected := Y Y|N ;corrected if unspecified decay corrected := N Y|N ;not corrected if unspecified if( type of data = "Static"|"ROI") { !STATIC STUDY (General) := ;label to indicate that this is the static definition number of images/energy window := 1 ;number of images in THIS energy window for ( number of images/energy window ) { !Static Study (each frame) := ;included at the beginning of the definition of ;each new static frame !image number := ;starting from 1 [see above] ;- must be specified!! ;starts from 1 and increments though all ;windows to its maximum value which equals the ;total number of images in the file!! !matrix size [1] :=< Numeric> ;matrix size across (number of columns)- previously x ;32, 64, 128 etc. but not necessarily powers of 2 !matrix size [2] := ;matrix size down (number of rows)- previously y ;32, 64, 128 etc. but not necessarily powers of 2 !number format := unsigned integer signed integer|unsigned integer |long float|short float|bit|ASCII ;as specified !number of bytes per pixel := ;e.g. 1|2|4.. [this key ignored for bit data] scaling factor (mm/pixel) [1]:= ;size of pixel across- previously x scaling factor (mm/pixel) [2] := ;size of pixel down- previously y image duration (sec) := ;eg. 120.0 i.e. normally a float, for each image image start time := ;time for each image label := ;eg Anterior maximum pixel count := ;for scaling purposes, for each image total counts := ;either an integer or a float, for each image } ;End of frame loop -Repeat for each subsequent frame } ;End of static definitions if( type of data = "Dynamic") { !DYNAMIC STUDY (general) := ;label to indicate that this is a dynamic study !number of frame groups := 1 ;defaults to 1 for( number of frame groups, frame group number) { !Dynamic Study (each frame group) := ;Repeated for each group of frames as ;indication of the start of the ;definition of the new group !frame group number := ;numbering starts from 1 (must be specified) !matrix size [1] := ;matrix size across (number of columns) ;-previously matrix size x ;32, 64, 128 etc. but not necessarily powers of 2 !matrix size [2] := ;matrix size down (number of rows)- previously y ;32, 64, 128 etc. but not necessarily powers of 2 !number format := unsigned integer signed integer|unsigned integer| long float|short float|bit|ASCII ;as specified !number of bytes per pixel := ;e.g. 1|2|4.. [this key ignored for bit data] scaling factor (mm/pixel) [1]:= ;size of pixel across- previously x scaling factor (mm/pixel) [2] := ;size of pixel down- previously y !number of images this frame group := ;for each frame group ;(for each energy window) !image duration (sec) := ;eg 0.2, for each frame group ;(for each energy window) pause between images (sec) := 0.0 ;eg 0.0, default is 0.0 pause between frame groups (sec) := 0.0 ;eg 5.0 default 0.0, time between last ;frame group (or start of study) and this frame group !maximum pixel count in group := ;eg 1234 (for scaling purposes) ;maximum pixel for all frames in this ;group and this window!! } ;Repeat for each subsequent frame group } ; End of dynamic definitions if( type of data = "Gated") { !GATED STUDY (general) := ;again a flag to indicate a gated study !matrix size [1] := ;matrix size across (number of columns)- previously x ;32, 64, 128 etc. but not necessarily powers of 2 !matrix size [2] := ;matrix size down (number of rows)- previously y ;32, 64, 128 etc. but not necessarily powers of 2 !number format := unsigned integer signed integer|unsigned integer| long float|short float|bit|ASCII ;as specified !number of bytes per pixel := ;e.g. 1|2|4|..> [this key ignored for bit data] scaling factor (mm/pixel) [1]:= ;size of pixel across- previously x scaling factor (mm/pixel) [2] := ;size of pixel down- previously y study duration (elapsed) sec := ;eg 300, total elapsed time for whole study number of cardiac cycles (observed) := ;total number of cycles if known, for this ;energy window number of time windows := 1 ;defaults to 1 if unspecified- number of different ;sets of time intervals for ( number of time windows, time window number) { !Gated Study (each time window) := !time window number := ;starting from 1 !number of images in time window := ;eg 24 !image duration (sec) := ;eg 0.04 for each frame in THIS time window framing method := Forward Forward|Backward|Mixed|Other ;default is forward time window lower limit (sec) := ;float normally expected, for THIS time window time window upper limit (sec) := ;float normally expected % R-R cycles acquired this window := ;if known number of cardiac cycles (acquired) := ;eg 356 , if known study duration (acquired) sec := ;total acquisition time duration for ;this window only (if it can be computed!!) as ;opposed to total acquisition time (when different) !maximum pixel count := ;for scaling purposes for all images in this ;time window (and energy window) only R-R histogram := N Y|N ;flag to indicate that one exists!! } ;Repeat for each subsequent time window. } ;end of gated definitions if( type of data = "Tomographic") { !SPECT STUDY (general) := ;flag to indicate tomographic data with no effect as such number of detector heads := 1 ;default=1 if unspecified for ( number of detector heads ) { !number of images/energy window := ;total number of images (for all heads) for ;THIS energy window!! !process status := Reconstructed Acquired|Reconstructed ;used below in conditional- MUST be defined !matrix size [1] := ;matrix size across (number of columns)- previously x ;32, 64, 128 etc. but not necessarily powers of 2 !matrix size [2] := ;matrix size down (number of rows)- previously y ;32, 64, 128 etc. but not necessarily powers of 2 !number format := unsigned integer signed integer|unsigned integer| long float|short float|bit|ASCII ;as specified !number of bytes per pixel := ;e.g. 1|2|4|.. [this key ignored for bit data] scaling factor (mm/pixel) [1]:= ;size of pixel across- previously x scaling factor (mm/pixel) [2] := ;size of pixel down- previously y !number of projections := ;for example- 64 ;note this is the actual number of images per ;head per energy window if ;the data are acquired, but NOT if the data are ;reconstructed where the number of images is ;specified separately as number of slices !extent of rotation := ;e.g 180, 360 !time per projection (sec) := ;important for Acquired data study duration (sec) := ;eg 1280.0, for acquired data should be equal ;to the product of number of projections and ;time per projection, but could be different!! !maximum pixel count := ;for scaling- in THIS image series( this head ;and this energy window) patient orientation := head_in head_in|feet_in|other patient rotation := supine prone|supine|other if( process status = "acquired") { !SPECT STUDY (acquired data):= !direction of rotation := CW CW|CCW ;CW = clockwise, CCW = counter clockwise start angle := ;0 is top-dead-centre, in degrees ;in orientation as specified above first projection angle in data set := ;in degrees expressed with respect to ;anterior- angles in direction as ;specified CW or CCW acquisition mode := stepped stepped|continuous Centre_of_rotation := Corrected Corrected|Single_value|For_every_angle ;default is "Corrected" ;"Corrected" corresponds to a null centre of rotation ;correction, as previous required by Interfile, that ;is, no centre of rotation information is to be ;passed. The key "Single value" indicates the ;conventional definition of the centre of rotation ;offset to be a single value specified for all angles, ;specified for each head given a multiple head ;acquisition. ;The key "For_every_angle" indicates that the centre ;of rotation offset will be specified for each head ;and every angle. This is not currently implemented in ;this Interfile definition, but will be introduced in ;V4. ;The mathematical centre of rotation is assumed to be ;in the exact middle of the projection for example at ;x= 32.5 y=32.5 for a 64x64 image where the count ;starts from 1. Note that the choice of coordinates ;does not matter, the only constraint being the ;assumption that all projections have a length which ;is an even number of pixels. The centre of rotation ;is specified as the offset from that position to the ;perpendicular dropped from a point on the axis of ;rotation onto the head. if( Centre_of_rotation = "Single_value" ) { !X_offset := ;x offset for all angles in mm. ;x_offset is the x offset between the perpendicular ;dropped from the centre of rotation and the dead ;centre of the matrix, ;The positive direction for the offset is considered ;to be that of the increasing projection index, e.g. ;for a projection with pixels of size 6mm, which ;should be centred at 32.5, an offset of +6mm ;indicates that the centre of rotation is at 33.5 ;Note that since offset is specified in mm, the pixel ;size must be known. Y_offset := ;y offset for all angles in mm ;y_offset is the y offset between that perpendicular ;dropped from the centre of rotation from that point ;on the axis of rotation where the y_offset is ;considered to be zero, and the centre of the camera's ;field of view. Thus y_offset is the RELATIVE shift of ;the y-axis with respect to some arbitrary position, ;normally that from the centre of the filed of view of ;the first at the top dead centre position. Thus for ;a single head, this value would normally be expected ;to be equal to zero. Radius := ;radial distance to centre of rotation in mm, ;for this head. } ;end of centre of rotation specification orbit := Circular Circular|non-circular preprocessed := ;preprocessing method } ; end of process status acquired if( process status = "reconstructed") { !SPECT STUDY (reconstructed data) := method of reconstruction := !number of slices := ;i.e. number of images in this set for this ;head and this energy window number of reference frame := 0 ;if unspecified the frame number ;originally used for defining slice positions ;0=default [Note- not a very useful key] slice orientation := Transverse Transverse|Coronal|Sagittal|Other ;default is transverse if unspecified slice thickness (pixels) := 1 ;if unspecified 1=default centre-centre slice separation (pixels):= 1 ;e.g.1,2,3,4... as distinct from slice thickness ;the word centre can also be spelt as center filter name := ;e.g. Hann, Hamming, Butterworth filter parameters := ;Nyquist freq etc. z-axis filter := ;method [1,2,1] etc. attenuation correction coefficient/cm := 0.0 ;default 0 means not done if unspecified method of attenuation correction := none scatter corrected := N Y|N method of scatter correction := none oblique reconstruction := N Y|N oblique orientation := ;free text [Note ACR-NEMA convention preferred] } ;end of reconstructed tomo } ;End of tomo * if( type of data = "GSPECT") { * !GATED SPECT STUDY (general) := ;again a flag to indicate a gated SPECT study ;MIXTURE OF GATED & TOMO !matrix size [1] := ;matrix size across (number of columns)- previously x ;32, 64, 128 etc. but not necessarily powers of 2 !matrix size [2] := ;matrix size down (number of rows)- previously y ;32, 64, 128 etc. but not necessarily powers of 2 !number format := unsigned integer signed integer|unsigned integer| long float|short float|bit|ASCII ;as specified !number of bytes per pixel := ;e.g. 1|2|4|..> [this key ignored for bit data] !Gated SPECT nesting outer level := SPECT|Gated Gated ; key to indictae order of images, if SPECT is outer level ; order is, for every angle give each gated image, if ; gated is outer level, then order is, for every gated ; time value, vie set of tomographic images scaling factor (mm/pixel) [1]:= ;size of pixel across- previously x scaling factor (mm/pixel) [2] := ;size of pixel down- previously y study duration (elapsed) sec := ;eg 300, total elapsed time for whole study number of cardiac cycles (observed) := ;total number of cycles if known, for this ;energy window number of time windows := 1 ;defaults to 1 if unspecified- number of different ;sets of time intervals for ( number of time windows, time window number) { !Gated Study (each time window) := !time window number := ;starting from 1 * !number of images in time window := ;eg 24 NOTE that here in gated SPECT is means images/angle !image duration (sec) := ;eg 0.04 for each frame in THIS time window framing method := Forward Forward|Backward|Mixed|Other ;default is forward time window lower limit (sec) := ;float normally expected, for THIS time window time window upper limit (sec) := ;float normally expected % R-R cycles acquired this window := ;if known number of cardiac cycles (acquired) := ;eg 356 , if known study duration (acquired) sec := ;total acquisition time duration for ;this window only (if it can be computed!!) as ;opposed to total acquisition time (when different) !maximum pixel count := ;for scaling purposes for all images in this ;time window (and energy window) only R-R histogram := N Y|N ;flag to indicate that one exists!! } ;Repeat for each subsequent time window. ;start of tomographic keys number of detector heads := 1 ;default=1 if unspecified for ( number of detector heads ) { !number of images/energy window := ;total number of images (for all heads) for ;THIS energy window!! !process status := Reconstructed Acquired|Reconstructed ;used below in conditional- MUST be defined !number of projections := ;for example- 64 ;note this is the actual number of images per ;head per energy window if ;the data are acquired, but NOT if the data are ;reconstructed where the number of images is ;specified separately as number of slices !extent of rotation := ;e.g 180, 360 !time per projection (sec) := ;important for Acquired data patient orientation := head_in head_in|feet_in|other patient rotation := supine prone|supine|other if( process status = "acquired") { !SPECT STUDY (acquired data):= !direction of rotation := CW CW|CCW ;CW = clockwise, CCW = counter clockwise start angle := ;0 is top-dead-centre, in degrees ;in orientation as specified above first projection angle in data set := ;in degrees expressed with respect to ;anterior- angles in direction as ;specified CW or CCW acquisition mode := stepped stepped|continuous Centre_of_rotation := Corrected Corrected|Single_value|For_every_angle ;default is "Corrected" ;"Corrected" corresponds to a null centre of rotation ;correction, as previous required by Interfile, that ;is, no centre of rotation information is to be ;passed. The key "Single value" indicates the ;conventional definition of the centre of rotation ;offset to be a single value specified for all angles, ;specified for each head given a multiple head ;acquisition. ;The key "For_every_angle" indicates that the centre ;of rotation offset will be specified for each head ;and every angle. This is not currently implemented in ;this Interfile definition, but will be introduced in ;V4. ;The mathematical centre of rotation is assumed to be ;in the exact middle of the projection for example at ;x= 32.5 y=32.5 for a 64x64 image where the count ;starts from 1. Note that the choice of coordinates ;does not matter, the only constraint being the ;assumption that all projections have a length which ;is an even number of pixels. The centre of rotation ;is specified as the offset from that position to the ;perpendicular dropped from a point on the axis of ;rotation onto the head. if( Centre_of_rotation = "Single_value" ) { !X_offset := ;x offset for all angles in mm. ;x_offset is the x offset between the perpendicular ;dropped from the centre of rotation and the dead ;centre of the matrix, ;The positive direction for the offset is considered ;to be that of the increasing projection index, e.g. ;for a projection with pixels of size 6mm, which ;should be centred at 32.5, an offset of +6mm ;indicates that the centre of rotation is at 33.5 ;Note that since offset is specified in mm, the pixel ;size must be known. Y_offset := ;y offset for all angles in mm ;y_offset is the y offset between that perpendicular ;dropped from the centre of rotation from that point ;on the axis of rotation where the y_offset is ;considered to be zero, and the centre of the camera's ;field of view. Thus y_offset is the RELATIVE shift of ;the y-axis with respect to some arbitrary position, ;normally that from the centre of the filed of view of ;the first at the top dead centre position. Thus for ;a single head, this value would normally be expected ;to be equal to zero. Radius := ;radial distance to centre of rotation in mm, ;for this head. } ;end of centre of rotation specification orbit := Circular Circular|non-circular preprocessed := ;preprocessing method } ; end of process status acquired if( process status = "reconstructed") { !SPECT STUDY (reconstructed data) := method of reconstruction := !number of slices := ;i.e. number of images in this set for this ;head and this energy window number of reference frame := 0 ;if unspecified the frame number ;originally used for defining slice positions ;0=default [Note- not a very useful key] slice orientation := Transverse Transverse|Coronal|Sagittal|Other ;default is transverse if unspecified slice thickness (pixels) := 1 ;if unspecified 1=default centre-centre slice separation (pixels):= 1 ;e.g.1,2,3,4... as distinct from slice thickness ;the word centre can also be spelt as center filter name := ;e.g. Hann, Hamming, Butterworth filter parameters := ;Nyquist freq etc. z-axis filter := ;method [1,2,1] etc. attenuation correction coefficient/cm := 0.0 ;default 0 means not done if unspecified method of attenuation correction := none scatter corrected := N Y|N method of scatter correction := none oblique reconstruction := N Y|N oblique orientation := ;free text [Note ACR-NEMA convention preferred] } ;end of reconstructed tomo } ;End of GATED SPECT } ;end of loop for energy windows if( type of data = "Curve") { !CURVE DATA := ;label to indicate that this is the curve definition ;curves should always be kept in separate data files ;and not together with the administrative data Curve_dimensions := 2 ;how many dimensions- ONLY 2 is permitted in V3.3. ;Even if a single vector of values is required ;both matrix size[1] and [2] must be defined ;although one of them should take the value 1. ;A set of x,y values is 2 dimensional with normally ;matrix size[1] or matrix size[2] equal to 2. ;and the other matrix size specifying ;the number of PAIRS of values present (see Fig 1). ;Matrix sizes greater than 2 for BOTH dimensions are not ;recommended. !matrix size[1] := ;matrix size across (number of columns) !matrix size[2] := ;matrix size down (number of rows) !number format := unsigned integer signed integer|unsigned integer| long float|short float|bit|ASCII !number of bytes per pixel := ;e.g. 1|2|4|.. [this key ignored for bit data] Type_of_curve := ;what kind of curve is it, for example time activity curve ;ROI indicates that this is a list ;of vectors corresponding to an ROI. for( Curve_dimensions, dimension) { ;When matrix size[1] or matrix size[2] equals 2 (the normal ;case) such that the data comprise pairs of values, ;then Label[1], Units[1] etc. refers to the set of first ;values for each pair, and Label[2] etc. refers the set of ;second values for each pair. Label[] := ;a text label for the corresponding axis e.g. "counts" Units[] := ;units of measurement for the corresponding axis ;e.g. "units[1]:=counts/sec" Min[] := ;Minimum of set of values as indicated in units as defined, ;optional Max[] := ;Maximum value as above, optional } ;End of loop for curve dimensions } !END OF INTERFILE := .fi .PP .in 0.2i .SH FILES .PP .in 0.2i .nf /usr/local/xmedcon/source/m-intf.h The header file. /usr/local/xmedcon/source/m-intf.c The source file. .PP .in 0.2i .SH SEE ALSO .PP .in 0.2i medcon(1), xmedcon(1), xmedcon-config(1) .PP .in 0.2i m-acr(4), m-anlz(4), m-gif(5), m-inw(4), m-ecat(4) .PP .in 0.2i medcon(3) .PP .in 0.2i .SH AUTHOR .PP .in 0.2i .I (X)MedCon project was originally written by Erik Nolf (eNlf) for the former PET-Centre at Ghent University (Belgium). .PP .in 0.2i .TS tab(=); lB l lB l. e-mail:=enlf-at-users.sourceforge.net=www:=http://xmedcon.sourceforge.net .TE xmedcon-0.14.1/man/xmedcon.10000644000175000017510000000271210415033212012437 00000000000000'\" t .TH MEDCON 1 .SH NAME xmedcon - MedCon with GUI for the X Window System .SH SYNOPSIS .PP .in 0.2i .HP 7 .B xmedcon [options] [-f ] .PP .in 0.8i or .PP .B xmedcon [--help | ] .PP .br .SH DESCRIPTION .PP .in 0.2i .I XMedCon is an X-Windows graphical userinterface built around the MedCon library. The program is capable of reading grayscale (reconstructed) medical image formats with multiple images and is based on the amazing Gtk+ and Imlib libraries. .PP .in 0.2i For more help read the related HTML files which can be send to a Netscape Browser from within the program. For information about the possible MedCon options that can be set directly from the command-line type 'xmedcon --help' or read the man-page medcon(1). .SH FILES .PP .in 0.2i .TS tab(@); l l. /usr/local/xmedcon/include@Directory with header files. /usr/local/xmedcon/lib/@Directory with libraries. /usr/local/xmedcon/bin/@Directory with executables. /usr/local/xmedcon/man/@Directory with man-pages. /usr/local/xmedcon/etc/@Directory with rcfiles. .TE .PP .in 0.2i .SH SEE ALSO .PP .in 0.2i .PP medcon(1), xmedcon-config(1) .in 0.2i m-acr(4), m-anlz(4), m-gif(4), m-inw(4), m-intf(4), m-ecat(4) .PP .in 0.2i medcon(3) .PP .in 0.2i .SH AUTHOR .PP .in 0.2i .I (X)MedCon project was originally written by Erik Nolf (eNlf) for the former PET-Centre at Ghent University (Belgium). .PP .in 0.2i .TS tab(=); lB l lB l. e-mail:=enlf-at-users.sourceforge.net=www:=http://xmedcon.sourceforge.net .TE xmedcon-0.14.1/man/Makefile.in0000644000175000017510000005017212637622763013017 00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = man DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/source/m-depend.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" \ "$(DESTDIR)$(man4dir)" man3dir = $(mandir)/man3 man4dir = $(mandir)/man4 NROFF = nroff MANS = $(man_MANS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DECOMPRESS = @DECOMPRESS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_ACR = @ENABLE_ACR@ ENABLE_ANLZ = @ENABLE_ANLZ@ ENABLE_CONC = @ENABLE_CONC@ ENABLE_DICM = @ENABLE_DICM@ ENABLE_ECAT = @ENABLE_ECAT@ ENABLE_GIF = @ENABLE_GIF@ ENABLE_INTF = @ENABLE_INTF@ ENABLE_INW = @ENABLE_INW@ ENABLE_NIFTI = @ENABLE_NIFTI@ ENABLE_PNG = @ENABLE_PNG@ ENABLE_TPC = @ENABLE_TPC@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIBMDCETC = @GLIBMDCETC@ GLIBSUPPORTED = @GLIBSUPPORTED@ GREP = @GREP@ GTKONE = @GTKONE@ GTKSUPPORTED = @GTKSUPPORTED@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NIFTI_CFLAGS = @NIFTI_CFLAGS@ NIFTI_LDFLAGS = @NIFTI_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PNG_CFLAGS = @PNG_CFLAGS@ PNG_LDFLAGS = @PNG_LDFLAGS@ PNG_LIBS = @PNG_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TPC_CFLAGS = @TPC_CFLAGS@ TPC_LDFLAGS = @TPC_LDFLAGS@ VERSION = @VERSION@ XMDCETC = @XMDCETC@ XMEDCON_DATE = @XMEDCON_DATE@ XMEDCON_GLIB_CFLAGS = @XMEDCON_GLIB_CFLAGS@ XMEDCON_GLIB_LIBS = @XMEDCON_GLIB_LIBS@ XMEDCON_GTK_CFLAGS = @XMEDCON_GTK_CFLAGS@ XMEDCON_GTK_LIBS = @XMEDCON_GTK_LIBS@ XMEDCON_LIBVERS = @XMEDCON_LIBVERS@ XMEDCON_MAJOR = @XMEDCON_MAJOR@ XMEDCON_MICRO = @XMEDCON_MICRO@ XMEDCON_MINOR = @XMEDCON_MINOR@ XMEDCON_PRGR = @XMEDCON_PRGR@ XMEDCON_VERSION = @XMEDCON_VERSION@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LDFLAGS = @ZLIB_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_sizeof_int = @ac_cv_sizeof_int@ ac_cv_sizeof_long = @ac_cv_sizeof_long@ ac_cv_sizeof_long_long = @ac_cv_sizeof_long_long@ ac_cv_sizeof_short = @ac_cv_sizeof_short@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mdc_cv_bigendian = @mdc_cv_bigendian@ mdc_cv_enable_lnglng = @mdc_cv_enable_lnglng@ mdc_cv_glibsupport = @mdc_cv_glibsupport@ mdc_cv_gui = @mdc_cv_gui@ mdc_cv_include_acr = @mdc_cv_include_acr@ mdc_cv_include_anlz = @mdc_cv_include_anlz@ mdc_cv_include_conc = @mdc_cv_include_conc@ mdc_cv_include_dicm = @mdc_cv_include_dicm@ mdc_cv_include_ecat = @mdc_cv_include_ecat@ mdc_cv_include_gif = @mdc_cv_include_gif@ mdc_cv_include_intf = @mdc_cv_include_intf@ mdc_cv_include_inw = @mdc_cv_include_inw@ mdc_cv_include_nifti = @mdc_cv_include_nifti@ mdc_cv_include_png = @mdc_cv_include_png@ mdc_cv_include_tpc = @mdc_cv_include_tpc@ mdc_cv_ljpg = @mdc_cv_ljpg@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = gnu man_MANS = \ medcon.1 \ xmedcon.1 \ xmedcon-config.1 \ medcon.3 \ m-acr.4 \ m-anlz.4 \ m-ecat.4 \ m-gif.4 \ m-intf.4 \ m-inw.4 EXTRA_DIST = $(man_MANS) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu man/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man1: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-man3: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man3dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.3[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \ done; } uninstall-man3: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man3dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.3[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir) install-man4: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man4dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man4dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man4dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.4[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^4][0-9a-z]*$$,4,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man4dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man4dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man4dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man4dir)" || exit $$?; }; \ done; } uninstall-man4: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man4dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.4[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^4][0-9a-z]*$$,4,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man4dir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man4dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-man3 install-man4 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man1 uninstall-man3 uninstall-man4 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man1 install-man3 install-man4 install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am uninstall-man uninstall-man1 uninstall-man3 \ uninstall-man4 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xmedcon-0.14.1/INSTALL0000644000175000017510000002243210352357440011213 00000000000000Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Here is a another example: /bin/bash ./configure CONFIG_SHELL=/bin/bash Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent configuration-related scripts to be executed by `/bin/bash'. `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. xmedcon-0.14.1/mkinstalldirs0000755000175000017510000000662210352357440012773 00000000000000#! /bin/sh # mkinstalldirs --- make directory hierarchy scriptversion=2005-06-29.22 # Original author: Noah Friedman # Created: 1993-05-16 # Public domain. # # This file is maintained in Automake, please report # bugs to or send patches to # . errstatus=0 dirmode= usage="\ Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... Create each directory DIR (with mode MODE, if specified), including all leading file name components. Report bugs to ." # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" exit $? ;; -m) # -m PERM arg shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } dirmode=$1 shift ;; --version) echo "$0 $scriptversion" exit $? ;; --) # stop option processing shift break ;; -*) # unknown option echo "$usage" 1>&2 exit 1 ;; *) # first non-opt arg break ;; esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and # mkdir -p a/c at the same time, both will detect that a is missing, # one will create a, then the other will try to create a and die with # a "File exists" error. This is a problem when calling mkinstalldirs # from a parallel make. We use --version in the probe to restrict # ourselves to GNU mkdir, which is thread-safe. case $dirmode in '') if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. test -d ./-p && rmdir ./-p test -d ./--version && rmdir ./--version fi ;; *) if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" else # Clean up after NextStep and OpenStep mkdir. for d in ./-m ./-p ./--version "./$dirmode"; do test -d $d && rmdir $d done fi ;; esac for file do case $file in /*) pathcomp=/ ;; *) pathcomp= ;; esac oIFS=$IFS IFS=/ set fnord $file shift IFS=$oIFS for d do test "x$d" = x && continue pathcomp=$pathcomp$d case $pathcomp in -*) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr= chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp=$pathcomp/ done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: xmedcon-0.14.1/AUTHORS0000644000175000017510000000111010715163524011221 00000000000000Original -------- E. Nolf (project) Contributors ------------ T. Voet (dicom library) A. Loening (conc, gtk2 & more) R. M. Rutschmann (mosaic support) M. Zaitsev (mosaic forced) B. Jaslet (dicom rle,ljpg) H. Merisaari (ecat7 writing) xmedcon-0.14.1/depcomp0000755000175000017510000005601612637622446011555 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2013 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: xmedcon-0.14.1/COPYING.LIB0000644000175000017510000006365007353207211011626 00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. ^L Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. ^L GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. ^L Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. ^L 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. ^L 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. ^L 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. ^L 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS ^L How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! xmedcon-0.14.1/libs/0000755000175000017510000000000012637632716011202 500000000000000xmedcon-0.14.1/libs/Makefile.am0000644000175000017510000000207711442766441013160 00000000000000## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## filename: Makefile.am ## ## ## ## UTIL Make : Medical Image Conversion Utility ## ## ## ## purpose : libs dir Makefile template (automake) ## ## ## ## project : (X)MedCon by Erik Nolf ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## $Id: Makefile.am,v 1.4 2010/09/11 20:57:05 enlf Exp $ if DO_LJPG DIR_LJPG = ljpg endif if DO_DICM DIR_DICM = dicom endif if DO_NIFTI if DO_NIFTI_INTERNAL DIR_NIFTI = nifti endif endif if DO_TPC if DO_TPC_INTERNAL DIR_TPC = tpc endif endif SUBDIRS = $(DIR_LJPG) $(DIR_DICM) $(DIR_NIFTI) $(DIR_TPC) xmedcon-0.14.1/libs/tpc/0000755000175000017510000000000012637632716011770 500000000000000xmedcon-0.14.1/libs/tpc/Makefile.am0000644000175000017510000000211411442766341013735 00000000000000## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## filename: Makefile.am ## ## ## ## UTIL Make : Medical Image Conversion Utility ## ## ## ## purpose : Turku PET Centre subdir Makefile template (automake) ## ## ## ## project : (X)MedCon by Erik Nolf ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## $Id: Makefile.am,v 1.1 2010/09/11 20:56:01 enlf Exp $ AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libtpcmisc.la libtpcimgio.la libtpcmisc_la_SOURCES = swap.c petc99.c #libtpcmisc_la_LDFLAGS = libtpcimgio_la_SOURCES = ecat7r.c ecat7w.c ecat7ml.c #libtpcimgio_la_LDFLAGS = noinst_HEADERS = ecat7.h petc99.h swap.h xmedcon-0.14.1/libs/tpc/swap.c0000644000175000017510000000776711442766341013042 00000000000000/****************************************************************************** Copyright (c) 2001-2004 by Turku PET Centre swap.c Byte swapping for little to big endian (and vice versa) conversion to be implemented in C programs. Written by Vesa Oikonen Based on free codes in web. 2001-05-15 VO 2002-01-20 VO Added new functions. 2002-02-01 VO Change in swawbip(), no effect on results. 2002-02-21 VO little_endian() algorithm changed. 2002-08-23 VO Added function swawip(). Also included function printf32bits() for testing purposes. 2004-09-17 VO Doxygen style comments. ******************************************************************************/ #include #include #include #include /*****************************************************************************/ #include "swap.h" /*****************************************************************************/ /*****************************************************************************/ /** Check whether current platform uses little endian byte order. * See H&S Sec. 6.1.2 pp. 163-4. \return Returns 1, if current platform is little endian, and 0 if not. */ int little_endian() { int x=1; if(*(char *)&x==1) return(1); else return(0); } /*****************************************************************************/ /*****************************************************************************/ /*! * Swaps the specified short int, int, long int, float, or double * from little endian to big endian or vice versa. * Arguments are allowed to overlap. * * @param from Pointer to a short int, int, long int, float, or double variable * @param to Pointer to a short int, int, long int, float, or double variable * @param size Size of from and to (byte nr) must be 1, 2, 4 or 8. */ void swap(void *from, void *to, int size) { unsigned char c; unsigned short int s; unsigned long l; switch(size) { case 1: *(char *)to=*(char *)from; break; case 2: c=*(unsigned char *)from; *(unsigned char *)to = *((unsigned char *)from+1); *((unsigned char *)to+1) = c; /*swab(from, to, size); // NOT ANSI */ break; case 4: s=*(unsigned short *)from; *(unsigned short *)to = *((unsigned short *)from+1); *((unsigned short *)to+1) = s; swap((char*)to, (char*)to, 2); swap((char*)((unsigned short *)to+1), (char*)((unsigned short *)to+1), 2); break; case 8: l=*(unsigned long *)from; *(unsigned long *)to = *((unsigned long *)from+1); *((unsigned long *)to+1) = l; swap((char *)to, (char *)to, 4); swap((char*)((unsigned long *)to+1), (char*)((unsigned long *)to+1), 4); break; } } /*****************************************************************************/ /*****************************************************************************/ /*! * In-place swab, replaces the non-ANSI function swab(), which may not * work if data is overlapping. * * @param buf Pointer to memory * @param size Size of buf in bytes */ void swabip(void *buf, int size) { int i; unsigned char c; for(i=1; i #include #include /****************************************************************************/ #include "petc99.h" /****************************************************************************/ /*****************************************************************************/ /*! * int roundf(float e) - Rounds up float e to nearest int * * @param e float value * @return rounded integer */ int temp_roundf(float e) { #if defined(__STDC_VERSION__) && __STD_VERSION__>=199901L return(roundf(e)); #else if(e<0.0) { return (int)(e-0.5); } else { return (int)(e+0.5); } #endif } /****************************************************************************/ /****************************************************************************/ xmedcon-0.14.1/libs/tpc/swap.h0000644000175000017510000000117311442766341013030 00000000000000/****************************************************************************** Copyright (c) 2001,2002 by Turku PET Centre swap.h Versions: 2002-02-21 Vesa Oikonen 2002-08-23 VO ******************************************************************************/ #ifndef _SWAP_H #define _SWAP_H /*****************************************************************************/ extern int little_endian(); extern void swap(void *orig, void *new, int size); extern void swabip(void *buf, int size); extern void swawbip(void *buf, int size); /*****************************************************************************/ #endif xmedcon-0.14.1/libs/tpc/ecat7r.c0000644000175000017510000000605211442766341013237 00000000000000/****************************************************************************** Copyright (c) 2003-2010 Turku PET Centre Library file: ecat7r.c Description: Functions for reading ECAT 7.x format. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details: http://www.gnu.org/copyleft/lesser.html You should have received a copy of the GNU Lesser General Public License along with this library/program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Turku PET Centre, Turku, Finland, http://www.turkupetcentre.fi Modification history: 2003-07-24 Vesa Oikonen First created. 2003-09-08 VO Added support for 3D sinograms, ecat7ReadScanMatrix(). 2004-05-23 VO Comments changed into Doxygen format. 2004-06-21 VO ecat7ReadScanMatrix(): Before: reads datablocks based on matrix list. After: if block number based on bin nr is smaller, then read only those Reason: simulated file with erroneous matrix list. 2004-09-20 VO Doxygen style comments are corrected. 2004-11-10 VO Calculation of trueblockNr simplified in ecat7ReadScanMatrix(). 2006-02-07 Jarkko Johansson Comments added in ecat7ReadScanMatrix(). 2007-03-21 VO ecat7ReadImageheader(): fill_cti[] and fill_user[] are read correctly. 2007-03-27 VO Added ecat7ReadPolarmapMatrix(). 2010-08-19 VO Main header field patient_birth_date can be in two different int formats, either YYYYMMDD or as seconds from start of year 1970. In latter case the number can be negative, which is not identified correctly by all C library versions. Therefore those are converted to YYYYMMDD format. ******************************************************************************/ #include #include #include #include #include #include #include #include /*****************************************************************************/ #include "ecat7.h" /*****************************************************************************/ /*****************************************************************************/ int ecat7pxlbytes(short int data_type) { int byteNr=0; switch(data_type) { case ECAT7_BYTE: byteNr=1; break; case ECAT7_VAXI2: case ECAT7_SUNI2: byteNr=2; break; case ECAT7_VAXI4: case ECAT7_VAXR4: case ECAT7_IEEER4: case ECAT7_SUNI4: byteNr=4; break; } return(byteNr); } /*****************************************************************************/ /*****************************************************************************/ xmedcon-0.14.1/libs/tpc/README0000644000175000017510000000372711443505317012567 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: README # # # # UTILITY text: Medical Image Conversion Utility # # # # purpose : the Turku PET Centre libraries 'you-should-read' file # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: README,v 1.2 2010/09/13 20:34:23 enlf Exp $ These are the stripped down library source files from the Turku PET Centre, required for writing ECAT7 images. The files were borrowed from: libtpcmisc 1.4.6 (c) 2004-2010 by Turku PET Centre Build Aug 20 2010 08:50:48 libtpcimgio 1.5.8 (c) 2005-2010 by Turku PET Centre Build Aug 19 2010 10:58:48 /** Copyright (c) 2004-2010 by Turku PET Centre This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details: http://www.gnu.org/copyleft/lesser.html You should have received a copy of the GNU Lesser General Public License along with this library/program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Turku PET Centre, Turku, Finland, http://www.turkupetcentre.fi/ **/ xmedcon-0.14.1/libs/tpc/ecat7.h0000644000175000017510000002512712161666727013074 00000000000000/****************************************************************************** ecat7.h (c) 2003-2010 Turku PET Centre Date: 2003-07-26 Vesa Oikonen 2003-08-03 VO Included definitions for patient orientation. 2003-09-04 VO Introduced functions for 3D scan r/w. 2003-10-08 VO ECAT7_MAGICNR changed from MATRIX7 to MATRIX72v 2004-02-07 VO ECAT7_MAGICNR replaced by separate defines for image volumes and sinograms: ECAT7V_MAGICNR and ECAT7S_MAGICNR. Included define for sw_version = 72. 2004-05-23 VO Introduced new function for ecat7p.c. Added a few comments. 2004-06-27 VO Introduced new function for ecat7ml.c. 2004-07-26 VO Comment style changes. 2004-09-20 VO Added empty comments. 2004-09-24 VO Added comments. 2004-12-28 VO Introduced new function ecat7_is_scaling_needed(). 2007-02-27 VO Introduced new functions. 2007-03-13 VO Introduced new functions. 2007-03-27 VO Introduced new functions. 2008-07-24 VO Introduced new functions. 2010-08-19 VO Changed comment, not affecting compiled code. ******************************************************************************/ #ifndef _ECAT7_H_ #define _ECAT7_H_ /*****************************************************************************/ #ifndef MatBLKSIZE #define MatBLKSIZE 512 #endif #ifndef MatFirstDirBlk #define MatFirstDirBlk 2 #endif /*****************************************************************************/ #define ECAT7V_MAGICNR "MATRIX72v" #define ECAT7S_MAGICNR "MATRIX7011" #define ECAT7_SW_VERSION 72 /*****************************************************************************/ /** Matrix data types */ #define ECAT7_BYTE 1 #define ECAT7_VAXI2 2 #define ECAT7_VAXI4 3 #define ECAT7_VAXR4 4 #define ECAT7_IEEER4 5 #define ECAT7_SUNI2 6 #define ECAT7_SUNI4 7 /*****************************************************************************/ /** Matrix filetypes */ #define ECAT7_UNKNOWN 0 #define ECAT7_2DSCAN 1 #define ECAT7_IMAGE16 2 #define ECAT7_ATTEN 3 #define ECAT7_2DNORM 4 #define ECAT7_POLARMAP 5 #define ECAT7_VOLUME8 6 #define ECAT7_VOLUME16 7 #define ECAT7_PROJ 8 #define ECAT7_PROJ16 9 #define ECAT7_IMAGE8 10 #define ECAT7_3DSCAN 11 #define ECAT7_3DSCAN8 12 #define ECAT7_3DNORM 13 #define ECAT7_3DSCANFIT 14 /*****************************************************************************/ /** Patient orientation */ #define ECAT7_Feet_First_Prone 0 #define ECAT7_Head_First_Prone 1 #define ECAT7_Feet_First_Supine 2 #define ECAT7_Head_First_Supine 3 #define ECAT7_Feet_First_Decubitus_Right 4 #define ECAT7_Head_First_Decubitus_Right 5 #define ECAT7_Feet_First_Decubitus_Left 6 #define ECAT7_Head_First_Decubitus_Left 7 #define ECAT7_Unknown_Orientation 8 /*****************************************************************************/ /* Backup file extension */ #ifndef BACKUP_EXTENSION #define BACKUP_EXTENSION ".bak" #endif /*****************************************************************************/ extern char ecat7errmsg[128]; /* declared in ecat7w.c */ /*****************************************************************************/ extern int ECAT7_TEST; /* declared in ecat7w.c */ /*****************************************************************************/ typedef struct ecat7_mainheader { /* 512 bytes */ /** Unix file type indentification number */ char magic_number[14]; /** Scan file's creation number */ char original_file_name[32]; /** */ short int sw_version; /** Scanner model */ short int system_type; /** Matrix file type */ short int file_type; /** Serial number of the gantry */ char serial_number[10]; /** Date and time when acquisition was started (sec from base time) */ int scan_start_time; /** String representation of the isotope */ char isotope_name[8]; /** Half-life of isotope (sec) */ float isotope_halflife; /** String representation of the tracer name */ char radiopharmaceutical[32]; /** Angle (degrees) */ float gantry_tilt; /** Angle (degrees) */ float gantry_rotation; /** Bed height from lowest point (cm) */ float bed_elevation; /** */ float intrinsic_tilt; /** */ short int wobble_speed; /** */ short int transm_source_type; /** Total distance scanned (cm) */ float distance_scanned; /** Diameter of transaxial view (cm) */ float transaxial_fov; /** 0=no mash, 1=mash of 2, 2=mash of 4 */ short int angular_compression; /** 0=Net trues, 1=Prompts and Delayed, 3=Prompts, Delayed, and Multiples */ short int coin_samp_mode; /** 0=Normal, 1=2X, 2=3X */ short int axial_samp_mode; float ecat_calibration_factor; /** 0=Uncalibrated; 1=Calibrated; 2=Processed */ short int calibration_units; /** Whether data_units[] is filled or not? */ short int calibration_units_label; /** */ short int compression_code; /** */ char study_type[12]; /** */ char patient_id[16]; /** */ char patient_name[32]; /** */ char patient_sex; /** */ char patient_dexterity; /** Patient age (years) */ float patient_age; /** Patient height (cm) */ float patient_height; /** Patient weight (kg) */ float patient_weight; /** YYYYMMDD. In HR+ files this field may contain birth date as seconds from * time zero, thus negative number when born before 1970, but those are * converted to YYYYMMDD when file is read */ int patient_birth_date; /** */ char physician_name[32]; /** */ char operator_name[32]; /** */ char study_description[32]; /** 0=Undefined; 1=Blank; 2=Transmission; 3=Static emission; 4=Dynamic emission; 5=Gated emission; 6=Transmission rectilinear; 7=Emission rectilinear */ short int acquisition_type; /** */ short int patient_orientation; /** */ char facility_name[20]; /** */ short int num_planes; /** Highest frame number in partially reconstruction files */ short int num_frames; /** */ short int num_gates; /** */ short int num_bed_pos; /** */ float init_bed_position; /** */ float bed_position[15]; /** Physical distance between adjacent planes (cm) */ float plane_separation; /** */ short int lwr_sctr_thres; /** */ short int lwr_true_thres; /** */ short int upr_true_thres; /** */ char user_process_code[10]; /** */ short int acquisition_mode; /** Width of view sample (cm) */ float bin_size; /** Fraction of decay by positron emission */ float branching_fraction; /** Time of injection */ int dose_start_time; /** Radiopharmaceutical dosage at time of injection (Bq/cc) */ float dosage; /** */ float well_counter_corr_factor; /** Free text field; fixed strings: "ECAT counts/sec", "Bq/cc" */ char data_units[32]; /** */ short int septa_state; /** */ short int fill_cti[6]; } ECAT7_mainheader; /*****************************************************************************/ typedef struct ecat7_imageheader { /* 512 bytes */ /** */ short int data_type; /** */ short int num_dimensions; /** */ short int x_dimension; /** */ short int y_dimension; /** */ short int z_dimension; /** cm */ float x_offset; /** cm */ float y_offset; /** cm */ float z_offset; /** Reconstruction magnification factor */ float recon_zoom; /** */ float scale_factor; /** */ short int image_min; /** */ short int image_max; /** X dimension pixel size (cm) */ float x_pixel_size; /** Y dimension pixel size (cm) */ float y_pixel_size; /** Z dimension pixel size (cm) */ float z_pixel_size; /** msec */ int frame_duration; /** Offset from first frame (msec) */ int frame_start_time; /** */ short int filter_code; /** cm */ float x_resolution; /** cm */ float y_resolution; /** cm */ float z_resolution; /** Number R elements from sinogram */ float num_r_elements; /** Nr of angles from sinogram */ float num_angles; /** Rotation in the xy plane (degrees) */ float z_rotation_angle; /** */ float decay_corr_fctr; /** */ int processing_code; /** */ int gate_duration; /** */ int r_wave_offset; /** */ int num_accepted_beats; /** */ float filter_cutoff_frequency; /** */ float filter_resolution; /** */ float filter_ramp_slope; /** */ short int filter_order; /** */ float filter_scatter_fraction; /** */ float filter_scatter_slope; /** */ char annotation[40]; /** */ float mt_1_1; /** */ float mt_1_2; /** */ float mt_1_3; /** */ float mt_2_1; /** */ float mt_2_2; /** */ float mt_2_3; /** */ float mt_3_1; /** */ float mt_3_2; /** */ float mt_3_3; /** */ float rfilter_cutoff; /** */ float rfilter_resolution; /** */ short int rfilter_code; /** */ short int rfilter_order; /** */ float zfilter_cutoff; /** */ float zfilter_resolution; /** */ short int zfilter_code; /** */ short int zfilter_order; /** */ float mt_1_4; /** */ float mt_2_4; /** */ float mt_3_4; /** */ short int scatter_type; /** */ short int recon_type; /** */ short int recon_views; /** */ short int fill_cti[87]; /** */ short int fill_user[49]; } ECAT7_imageheader; /*****************************************************************************/ typedef struct { int id; int strtblk; int endblk; int status; } ECAT7_MatDir; typedef struct { int matrixNr; int matrixSpace; ECAT7_MatDir *matdir; } ECAT7_MATRIXLIST; typedef struct { int frame, plane, gate, data, bed; } ECAT7_Matval; /*****************************************************************************/ /* Read functions */ extern int ecat7pxlbytes(short int data_type); extern int ecat7EnterMatrix(FILE *fp, int matrix_id, int block_nr); /*****************************************************************************/ /* Write functions */ extern int ecat7WriteMainheader(FILE *fp, ECAT7_mainheader *h); extern int ecat7WriteImageheader(FILE *fp, int blk, ECAT7_imageheader *h); extern int ecat7WriteMatrixdata(FILE *fp, int start_block, char *data, int pxl_nr, int pxl_size); extern FILE *ecat7Create(const char *fname, ECAT7_mainheader *h); extern int ecat7WriteImageMatrix(FILE *fp, int matrix_id, ECAT7_imageheader *h, float *fdata); extern int ecat7_is_scaling_needed(float amax, float *data, int nr); /*****************************************************************************/ #endif xmedcon-0.14.1/libs/tpc/ecat7ml.c0000644000175000017510000001461611442766341013413 00000000000000/****************************************************************************** Copyright (c) 2003-2007 Turku PET Centre Library: ecat7ml.c Description: Reading and writing ECAT 7.x matrix list. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details: http://www.gnu.org/copyleft/lesser.html You should have received a copy of the GNU Lesser General Public License along with this library/program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Turku PET Centre, Turku, Finland, http://www.turkupetcentre.fi/ Modification history: 2003-07-21 Vesa Oikonen First created. 2004-06-20 VO ecat7PrintMatlist(): blkNr is printed correctly (+1). 2004-06-27 VO Included ecat7DeleteLateFrames(). 2007-02-27 VO Added functions ecat7GetMatrixBlockSize() and ecat7GetPlaneAndFrameNr(). 2007-03-13 VO Added functions ecat7GetNums() and ecat7GatherMatlist(). 2007-17-07 Harri Merisaari fixed for ANSI ******************************************************************************/ #include #include #include #include #include #include #include /*****************************************************************************/ #include "swap.h" #include "ecat7.h" /*****************************************************************************/ /*****************************************************************************/ /*! * Prepare matrix list for additional matrix data and return block number * for matrix header. Directory records are written in big endian byte order. * Set block_nr to the number of data blocks + (nr of header blocks - 1) * * @param fp file pointer * @param matrix_id matrix identifier coding * @param block_nr matrix number [1..number of matrixes] * @return returns the block number for matrix header, -1 if invalid input, * -2 if first directory block is not found, -3 if failed to read first block, * -9 if other directory block is not found, -10 if failed to read other block, * -11 if place for new directory block is not found, -12 if failed clear new * block, -15 if place for new directory block is not found, -16 if failed to * write into new block */ int ecat7EnterMatrix(FILE *fp, int matrix_id, int block_nr) { unsigned int i=0, dirblk, little, busy=1, nxtblk=0, oldsize; /*unsigned*/ int dirbuf[MatBLKSIZE/4]; if(ECAT7_TEST) printf("ecat7EnterMatrix(fp, %d, %d)\n", matrix_id, block_nr); /* Check the input */ if(fp==NULL || matrix_id<1 || block_nr<1) return(-1); /* Is this a little endian machine? */ little=little_endian(); /* Read first directory record block */ dirblk=MatFirstDirBlk; fseek(fp, (dirblk-1)*MatBLKSIZE, SEEK_SET); if(ftell(fp)!=(dirblk-1)*MatBLKSIZE) return(-2); if(fread(dirbuf, sizeof(int), MatBLKSIZE/4, fp) != MatBLKSIZE/4) return(-3); /* Byte order conversion for ints in little endian platforms */ if(little) swawbip(dirbuf, MatBLKSIZE); /* Read through the existing directory records */ while(busy) { /* Go through the directory entries in this record */ for(i=4, nxtblk=dirblk+1; i #include #include #include #include #include /*****************************************************************************/ #include "swap.h" #include "petc99.h" #include "ecat7.h" /*****************************************************************************/ /* global variables */ char ecat7errmsg[128]; int ECAT7_TEST; /*****************************************************************************/ /*! * Write ECAT 7.x main header. * * @param fp output file pointer * @param h Ecat7 main header * Writes header always in big endian byte order. * @return 0 in case of success, 1 == invalid parameters, 4 == file pointer is * at wrong position, 5 == writing of MatBLKSIZE bytes was not success */ int ecat7WriteMainheader(FILE *fp, ECAT7_mainheader *h) { unsigned char buf[MatBLKSIZE]; int little; if(ECAT7_TEST) printf("ecat7WriteMainheader()\n"); /* Check arguments */ if(fp==NULL || h==NULL) return(1); little=little_endian(); /* Clear buf */ memset(buf, 0, MatBLKSIZE); /* Copy header contents into buffer and change byte order if necessary */ memcpy(buf+0, &h->magic_number, 14); memcpy(buf+14, &h->original_file_name, 32); memcpy(buf+46, &h->sw_version, 2); if(little) swabip(buf+46, 2); memcpy(buf+48, &h->system_type, 2); if(little) swabip(buf+48, 2); memcpy(buf+50, &h->file_type, 2); if(little) swabip(buf+50, 2); memcpy(buf+52, &h->serial_number, 10); memcpy(buf+62, &h->scan_start_time, 4); if(little) swawbip(buf+62, 4); memcpy(buf+66, &h->isotope_name, 8); memcpy(buf+74, &h->isotope_halflife, 4); if(little) swawbip(buf+74, 4); memcpy(buf+78, &h->radiopharmaceutical, 32); memcpy(buf+110, &h->gantry_tilt, 4); if(little) swawbip(buf+110, 4); memcpy(buf+114, &h->gantry_rotation, 4); if(little) swawbip(buf+114, 4); memcpy(buf+118, &h->bed_elevation, 4); if(little) swawbip(buf+118, 4); memcpy(buf+122, &h->intrinsic_tilt, 4); if(little) swawbip(buf+122, 4); memcpy(buf+126, &h->wobble_speed, 2); if(little) swabip(buf+126, 2); memcpy(buf+128, &h->transm_source_type, 2); if(little) swabip(buf+128, 2); memcpy(buf+130, &h->distance_scanned, 4); if(little) swawbip(buf+130, 4); memcpy(buf+134, &h->transaxial_fov, 4); if(little) swawbip(buf+134, 4); memcpy(buf+138, &h->angular_compression, 2); if(little) swabip(buf+138, 2); memcpy(buf+140, &h->coin_samp_mode, 2); if(little) swabip(buf+140, 2); memcpy(buf+142, &h->axial_samp_mode, 2); if(little) swabip(buf+142, 2); memcpy(buf+144, &h->ecat_calibration_factor, 4); if(little) swawbip(buf+144, 4); memcpy(buf+148, &h->calibration_units, 2); if(little) swabip(buf+148, 2); memcpy(buf+150, &h->calibration_units_label, 2); if(little) swabip(buf+150, 2); memcpy(buf+152, &h->compression_code, 2); if(little) swabip(buf+152, 2); memcpy(buf+154, &h->study_type, 12); memcpy(buf+166, &h->patient_id, 16); memcpy(buf+182, &h->patient_name, 32); memcpy(buf+214, &h->patient_sex, 1); memcpy(buf+215, &h->patient_dexterity, 1); memcpy(buf+216, &h->patient_age, 4); if(little) swawbip(buf+216, 4); memcpy(buf+220, &h->patient_height, 4); if(little) swawbip(buf+220, 4); memcpy(buf+224, &h->patient_weight, 4); if(little) swawbip(buf+224, 4); memcpy(buf+228, &h->patient_birth_date, 4); if(little) swawbip(buf+228, 4); memcpy(buf+232, &h->physician_name, 32); memcpy(buf+264, &h->operator_name, 32); memcpy(buf+296, &h->study_description, 32); memcpy(buf+328, &h->acquisition_type, 2); if(little) swabip(buf+328, 2); memcpy(buf+330, &h->patient_orientation, 2); if(little) swabip(buf+330, 2); memcpy(buf+332, &h->facility_name, 20); memcpy(buf+352, &h->num_planes, 2); if(little) swabip(buf+352, 2); memcpy(buf+354, &h->num_frames, 2); if(little) swabip(buf+354, 2); memcpy(buf+356, &h->num_gates, 2); if(little) swabip(buf+356, 2); memcpy(buf+358, &h->num_bed_pos, 2); if(little) swabip(buf+358, 2); memcpy(buf+360, &h->init_bed_position, 4); if(little) swawbip(buf+360, 4); memcpy(buf+364, h->bed_position, 15*4); if(little) swawbip(buf+364, 15*4); memcpy(buf+424, &h->plane_separation, 4); if(little) swawbip(buf+424, 4); memcpy(buf+428, &h->lwr_sctr_thres, 2); if(little) swabip(buf+428, 2); memcpy(buf+430, &h->lwr_true_thres, 2); if(little) swabip(buf+430, 2); memcpy(buf+432, &h->upr_true_thres, 2); if(little) swabip(buf+432, 2); memcpy(buf+434, &h->user_process_code, 10); memcpy(buf+444, &h->acquisition_mode, 2); if(little) swabip(buf+444, 2); memcpy(buf+446, &h->bin_size, 4); if(little) swawbip(buf+446, 4); memcpy(buf+450, &h->branching_fraction, 4); if(little) swawbip(buf+450, 4); memcpy(buf+454, &h->dose_start_time, 4); if(little) swawbip(buf+454, 4); memcpy(buf+458, &h->dosage, 4); if(little) swawbip(buf+458, 4); memcpy(buf+462, &h->well_counter_corr_factor, 4); if(little) swawbip(buf+462, 4); memcpy(buf+466, &h->data_units, 32); memcpy(buf+498, &h->septa_state, 2); if(little) swabip(buf+498, 2); memcpy(buf+500, &h->fill_cti, 12); /* Write main header */ fseek(fp, 0*MatBLKSIZE, SEEK_SET); if(ftell(fp)!=0*MatBLKSIZE) return(4); if(fwrite(buf, 1, 1*MatBLKSIZE, fp) != 1*MatBLKSIZE) return(5); return(0); } /*****************************************************************************/ /*****************************************************************************/ /*! * Write ECAT 7.x image header. Changes data type to big endian. * * @param fp output file pointer * @param blk header block number, blk >= 2 * @param h Ecat7 image header * @return 0 in case of success, 1 == invalid parameters, 4 == file pointer is * at wrong position, 5 == writing of MatBLKSIZE bytes was not success */ int ecat7WriteImageheader(FILE *fp, int blk, ECAT7_imageheader *h) { unsigned char buf[MatBLKSIZE]; int little; /* 1 if current platform is little endian (i386), else 0 */ if(ECAT7_TEST) printf("ecat7WriteImageheader()\n"); if(fp==NULL || blk<2 || h==NULL) return(1); little=little_endian(); if(ECAT7_TEST) printf("little=%d\n", little); /* Clear buf */ memset(buf, 0, MatBLKSIZE); if(h->data_type==ECAT7_VAXI2) h->data_type=ECAT7_SUNI2; else if(h->data_type==ECAT7_VAXI4) h->data_type=ECAT7_SUNI4; else if(h->data_type==ECAT7_VAXR4) h->data_type=ECAT7_IEEER4; /* Copy the header fields and swap if necessary */ memcpy(buf+0, &h->data_type, 2); if(little) swabip(buf+0, 2); memcpy(buf+2, &h->num_dimensions, 2); if(little) swabip(buf+2, 2); memcpy(buf+4, &h->x_dimension, 2); if(little) swabip(buf+4, 2); memcpy(buf+6, &h->y_dimension, 2); if(little) swabip(buf+6, 2); memcpy(buf+8, &h->z_dimension, 2); if(little) swabip(buf+8, 2); memcpy(buf+10, &h->x_offset, 4); if(little) swawbip(buf+10, 4); memcpy(buf+14, &h->y_offset, 4); if(little) swawbip(buf+14, 4); memcpy(buf+18, &h->z_offset, 4); if(little) swawbip(buf+18, 4); memcpy(buf+22, &h->recon_zoom, 4); if(little) swawbip(buf+22, 4); memcpy(buf+26, &h->scale_factor, 4); if(little) swawbip(buf+26, 4); memcpy(buf+30, &h->image_min, 2); if(little) swabip(buf+30, 2); memcpy(buf+32, &h->image_max, 2); if(little) swabip(buf+32, 2); memcpy(buf+34, &h->x_pixel_size, 4); if(little) swawbip(buf+34, 4); memcpy(buf+38, &h->y_pixel_size, 4); if(little) swawbip(buf+38, 4); memcpy(buf+42, &h->z_pixel_size, 4); if(little) swawbip(buf+42, 4); memcpy(buf+46, &h->frame_duration, 4); if(little) swawbip(buf+46, 4); memcpy(buf+50, &h->frame_start_time, 4); if(little) swawbip(buf+50, 4); memcpy(buf+54, &h->filter_code, 2); if(little) swabip(buf+54, 2); memcpy(buf+56, &h->x_resolution, 4); if(little) swawbip(buf+56, 4); memcpy(buf+60, &h->y_resolution, 4); if(little) swawbip(buf+60, 4); memcpy(buf+64, &h->z_resolution, 4); if(little) swawbip(buf+64, 4); memcpy(buf+68, &h->num_r_elements, 4); if(little) swawbip(buf+68, 4); memcpy(buf+72, &h->num_angles, 4); if(little) swawbip(buf+72, 4); memcpy(buf+76, &h->z_rotation_angle, 4); if(little) swawbip(buf+76, 4); memcpy(buf+80, &h->decay_corr_fctr, 4); if(little) swawbip(buf+80, 4); memcpy(buf+84, &h->processing_code, 4); if(little) swawbip(buf+84, 4); memcpy(buf+88, &h->gate_duration, 4); if(little) swawbip(buf+88, 4); memcpy(buf+92, &h->r_wave_offset, 4); if(little) swawbip(buf+92, 4); memcpy(buf+96, &h->num_accepted_beats, 4); if(little) swawbip(buf+96, 4); memcpy(buf+100, &h->filter_cutoff_frequency, 4); if(little) swawbip(buf+100, 4); memcpy(buf+104, &h->filter_resolution, 4); if(little) swawbip(buf+104, 4); memcpy(buf+108, &h->filter_ramp_slope, 4); if(little) swawbip(buf+108, 4); memcpy(buf+112, &h->filter_order, 2); if(little) swabip(buf+112, 2); memcpy(buf+114, &h->filter_scatter_fraction, 4); if(little) swawbip(buf+114, 4); memcpy(buf+118, &h->filter_scatter_slope, 4); if(little) swawbip(buf+118, 4); memcpy(buf+122, &h->annotation, 40); memcpy(buf+162, &h->mt_1_1, 4); if(little) swawbip(buf+162, 4); memcpy(buf+166, &h->mt_1_2, 4); if(little) swawbip(buf+166, 4); memcpy(buf+170, &h->mt_1_3, 4); if(little) swawbip(buf+170, 4); memcpy(buf+174, &h->mt_2_1, 4); if(little) swawbip(buf+174, 4); memcpy(buf+178, &h->mt_2_2, 4); if(little) swawbip(buf+178, 4); memcpy(buf+182, &h->mt_2_3, 4); if(little) swawbip(buf+182, 4); memcpy(buf+186, &h->mt_3_1, 4); if(little) swawbip(buf+186, 4); memcpy(buf+190, &h->mt_3_2, 4); if(little) swawbip(buf+190, 4); memcpy(buf+194, &h->mt_3_3, 4); if(little) swawbip(buf+194, 4); memcpy(buf+198, &h->rfilter_cutoff, 4); if(little) swawbip(buf+198, 4); memcpy(buf+202, &h->rfilter_resolution, 4); if(little) swawbip(buf+202, 4); memcpy(buf+206, &h->rfilter_code, 2); if(little) swabip(buf+206, 2); memcpy(buf+208, &h->rfilter_order, 2); if(little) swabip(buf+208, 2); memcpy(buf+210, &h->zfilter_cutoff, 4); if(little) swawbip(buf+210, 4); memcpy(buf+214, &h->zfilter_resolution, 4); if(little) swawbip(buf+214, 4); memcpy(buf+218, &h->zfilter_code, 2); if(little) swabip(buf+218, 2); memcpy(buf+220, &h->zfilter_order, 2); if(little) swabip(buf+220, 2); memcpy(buf+222, &h->mt_1_4, 4); if(little) swawbip(buf+222, 4); memcpy(buf+226, &h->mt_2_4, 4); if(little) swawbip(buf+226, 4); memcpy(buf+230, &h->mt_3_4, 4); if(little) swawbip(buf+230, 4); memcpy(buf+234, &h->scatter_type, 2); if(little) swabip(buf+234, 2); memcpy(buf+236, &h->recon_type, 2); if(little) swabip(buf+236, 2); memcpy(buf+238, &h->recon_views, 2); if(little) swabip(buf+238, 2); memcpy(buf+240, &h->fill_cti, 87); memcpy(buf+414, &h->fill_user, 48); /* Write header */ fseek(fp, (blk-1)*MatBLKSIZE, SEEK_SET); if(ftell(fp)!=(blk-1)*MatBLKSIZE) return(4); if(fwrite(buf, 1, 1*MatBLKSIZE, fp) != 1*MatBLKSIZE) return(5); return(0); } /*****************************************************************************/ /*****************************************************************************/ /*! * Create a new ECAT 7.x file. If file exists, it is renamed as fname% if possible. * Directory list is written in big endian byte order. * * @param fname filename * @param h Ecat7 main header * @return file pointer or NULL in case of an error. */ FILE *ecat7Create(const char *fname, ECAT7_mainheader *h) { FILE *fp; char tmp[FILENAME_MAX]; int buf[MatBLKSIZE/4]; if(ECAT7_TEST) printf("ecat7Create(%s, h)\n", fname); /* Check the arguments */ if(fname==NULL || h==NULL) return(NULL); /* Check if file exists; backup, if necessary */ if(access(fname, 0) != -1) { strcpy(tmp, fname); strcat(tmp, BACKUP_EXTENSION); if(access(tmp, 0) != -1) remove(tmp); if(ECAT7_TEST) printf("Renaming %s -> %s\n", fname, tmp); rename(fname, tmp); } /* Open file */ fp=fopen(fname, "wb+"); if(fp==NULL) return(fp); /* Write main header */ if(ecat7WriteMainheader(fp, h)) return(NULL); /* Construct an empty matrix list ; convert to little endian if necessary */ memset(buf, 0, MatBLKSIZE); buf[0]=31; buf[1]=MatFirstDirBlk; if(little_endian()) swawbip(buf, MatBLKSIZE); /* Write data buffer */ fseek(fp, (MatFirstDirBlk-1)*MatBLKSIZE, SEEK_SET); if(ftell(fp)!=(MatFirstDirBlk-1)*MatBLKSIZE) return(NULL); if(fwrite(buf, 4, MatBLKSIZE/4, fp) != MatBLKSIZE/4) return(NULL); /* OK, then return file pointer */ return(fp); } /*****************************************************************************/ /*****************************************************************************/ /*! * Check if pixel float values need to be scaled to be saved as short ints, * or if they are already all very close to integers. * * @param amax absolute maximum value * @param data float array * @param nr float array size * @return 1, if scaling is necessary, and 0 if not. */ int ecat7_is_scaling_needed(float amax, float *data, int nr) { int i; double d; if(nr<1 || data==NULL) return(0); /* scaling is necessary if all values are between -1 - 1 */ if(amax<0.9999) return(1); /* Lets check first if at least the max value is close to integers or not */ if(modf(amax, &d)>0.0001) return(1); /* if it is, then check all pixels */ for(i=0; i0.0001) return(1); return(0); } /*****************************************************************************/ /*****************************************************************************/ /*! * Write ECAT 7.x image or volume matrix header and data * * @param fp output file pointer * @param matrix_id coded matrix id * @param h Ecat7 image header * @param fdata float data to be written * @return 0 if ok. */ int ecat7WriteImageMatrix(FILE *fp, int matrix_id, ECAT7_imageheader *h, float *fdata) { int i, nxtblk, blkNr, data_size, pxlNr, ret; float *fptr, fmin, fmax, g, f; char *mdata, *mptr; short int *sptr; if(ECAT7_TEST) printf("ecat7WriteImageMatrix(fp, %d, h, data)\n", matrix_id); if(fp==NULL || matrix_id<1 || h==NULL || fdata==NULL) { sprintf(ecat7errmsg, "invalid function parameter.\n"); return(1); } if(h->data_type!=ECAT7_SUNI2) { sprintf(ecat7errmsg, "invalid data_type.\n"); return(2); } /* nr of pixels */ pxlNr=h->x_dimension*h->y_dimension; if(h->num_dimensions>2) pxlNr*=h->z_dimension; if(pxlNr<1) { sprintf(ecat7errmsg, "invalid matrix dimension.\n"); return(3); } /* How much memory is needed for ALL pixels */ data_size=pxlNr*ecat7pxlbytes(h->data_type); /* block nr taken by all pixels */ blkNr=(data_size+MatBLKSIZE-1)/MatBLKSIZE; if(blkNr<1) { sprintf(ecat7errmsg, "invalid block number.\n"); return(4); } /* Allocate memory for matrix data */ mdata=(char*)calloc(blkNr, MatBLKSIZE); if(mdata==NULL) { sprintf(ecat7errmsg, "out of memory.\n"); return(5); } /* Search for min and max for calculation of scale factor */ fptr=fdata; fmin=fmax=*fptr; for(i=0; ifmax) fmax=*fptr; else if(*fptrfabs(fmax)) g=fabs(fmin); else g=fabs(fmax); if(g>0) f=32766./g; else f=1.0; /* Check if pixels values can be left as such with scale_factor = 1 */ fptr=fdata; if(f>=1.0 && ecat7_is_scaling_needed(g, fptr, pxlNr)==0) f=1.0; /* Scale matrix data to shorts */ h->scale_factor=1.0/f; sptr=(short int*)mdata; fptr=fdata; for(i=0; iimage_min=(short int)temp_roundf(f*fmin); h->image_max=(short int)temp_roundf(f*fmax); /* Get block number for matrix header and data */ nxtblk=ecat7EnterMatrix(fp, matrix_id, blkNr); if(nxtblk<1) { sprintf(ecat7errmsg, "cannot determine matrix block (%d).\n", -nxtblk); free(mdata); return(8); } if(ECAT7_TEST>2) printf(" block=%d fmin=%g fmax=%g\n", nxtblk, fmin, fmax); /* Write header */ ret=ecat7WriteImageheader(fp, nxtblk, h); if(ret) { sprintf(ecat7errmsg, "cannot write subheader (%d).\n", ret); free(mdata); return(10); } /* Write matrix data */ mptr=mdata; ret=ecat7WriteMatrixdata(fp, nxtblk+1, mptr, pxlNr, ecat7pxlbytes(h->data_type)); free(mdata); if(ret) { sprintf(ecat7errmsg, "cannot write matrix data (%d).\n", ret); return(13); } return(0); } /*****************************************************************************/ /*****************************************************************************/ /*! * Write ECAT 7.x matrix data to a specified file position. * Data does not need to be allocated for full blocks. * Data must be represented in current machines byte order, and it is * always saved in big endian byte order. * * @param fp Pointer to an opened ECAT file * @param start_block Block number where matrix data is written * @param data Pointer to matrix data * @param pxl_nr Number of pixels * @param pxl_size Size of data for one pixel in bytes * @return >0 in case of an error. */ int ecat7WriteMatrixdata(FILE *fp, int start_block, char *data, int pxl_nr, int pxl_size) { unsigned char buf[MatBLKSIZE]; char *dptr; int i, blkNr, dataSize, byteNr, little; if(ECAT7_TEST) printf("ecat7WriteMatrixdata(fp, %d, data, %d, %d)\n", start_block, pxl_nr, pxl_size); if(fp==NULL || start_block<1 || data==NULL || pxl_nr<1 || pxl_size<1) return(1); little=little_endian(); memset(buf, 0, MatBLKSIZE); dataSize=pxl_nr*pxl_size; /* block nr taken by all pixels */ blkNr=(dataSize+MatBLKSIZE-1)/MatBLKSIZE; if(blkNr<1) return(1); if(ECAT7_TEST>2) printf(" blkNr=%d\n", blkNr); /* Search the place for writing */ fseek(fp, (start_block-1)*MatBLKSIZE, SEEK_SET); if(ftell(fp)!=(start_block-1)*MatBLKSIZE) return(2); /* Save blocks one at a time */ for(i=0, dptr=data; i0; i++) { byteNr=(dataSize&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = libs/tpc DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp \ $(noinst_HEADERS) README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/source/m-depend.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libtpcimgio_la_LIBADD = am_libtpcimgio_la_OBJECTS = ecat7r.lo ecat7w.lo ecat7ml.lo libtpcimgio_la_OBJECTS = $(am_libtpcimgio_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libtpcmisc_la_LIBADD = am_libtpcmisc_la_OBJECTS = swap.lo petc99.lo libtpcmisc_la_OBJECTS = $(am_libtpcmisc_la_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/source depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libtpcimgio_la_SOURCES) $(libtpcmisc_la_SOURCES) DIST_SOURCES = $(libtpcimgio_la_SOURCES) $(libtpcmisc_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DECOMPRESS = @DECOMPRESS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_ACR = @ENABLE_ACR@ ENABLE_ANLZ = @ENABLE_ANLZ@ ENABLE_CONC = @ENABLE_CONC@ ENABLE_DICM = @ENABLE_DICM@ ENABLE_ECAT = @ENABLE_ECAT@ ENABLE_GIF = @ENABLE_GIF@ ENABLE_INTF = @ENABLE_INTF@ ENABLE_INW = @ENABLE_INW@ ENABLE_NIFTI = @ENABLE_NIFTI@ ENABLE_PNG = @ENABLE_PNG@ ENABLE_TPC = @ENABLE_TPC@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIBMDCETC = @GLIBMDCETC@ GLIBSUPPORTED = @GLIBSUPPORTED@ GREP = @GREP@ GTKONE = @GTKONE@ GTKSUPPORTED = @GTKSUPPORTED@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NIFTI_CFLAGS = @NIFTI_CFLAGS@ NIFTI_LDFLAGS = @NIFTI_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PNG_CFLAGS = @PNG_CFLAGS@ PNG_LDFLAGS = @PNG_LDFLAGS@ PNG_LIBS = @PNG_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TPC_CFLAGS = @TPC_CFLAGS@ TPC_LDFLAGS = @TPC_LDFLAGS@ VERSION = @VERSION@ XMDCETC = @XMDCETC@ XMEDCON_DATE = @XMEDCON_DATE@ XMEDCON_GLIB_CFLAGS = @XMEDCON_GLIB_CFLAGS@ XMEDCON_GLIB_LIBS = @XMEDCON_GLIB_LIBS@ XMEDCON_GTK_CFLAGS = @XMEDCON_GTK_CFLAGS@ XMEDCON_GTK_LIBS = @XMEDCON_GTK_LIBS@ XMEDCON_LIBVERS = @XMEDCON_LIBVERS@ XMEDCON_MAJOR = @XMEDCON_MAJOR@ XMEDCON_MICRO = @XMEDCON_MICRO@ XMEDCON_MINOR = @XMEDCON_MINOR@ XMEDCON_PRGR = @XMEDCON_PRGR@ XMEDCON_VERSION = @XMEDCON_VERSION@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LDFLAGS = @ZLIB_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_sizeof_int = @ac_cv_sizeof_int@ ac_cv_sizeof_long = @ac_cv_sizeof_long@ ac_cv_sizeof_long_long = @ac_cv_sizeof_long_long@ ac_cv_sizeof_short = @ac_cv_sizeof_short@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mdc_cv_bigendian = @mdc_cv_bigendian@ mdc_cv_enable_lnglng = @mdc_cv_enable_lnglng@ mdc_cv_glibsupport = @mdc_cv_glibsupport@ mdc_cv_gui = @mdc_cv_gui@ mdc_cv_include_acr = @mdc_cv_include_acr@ mdc_cv_include_anlz = @mdc_cv_include_anlz@ mdc_cv_include_conc = @mdc_cv_include_conc@ mdc_cv_include_dicm = @mdc_cv_include_dicm@ mdc_cv_include_ecat = @mdc_cv_include_ecat@ mdc_cv_include_gif = @mdc_cv_include_gif@ mdc_cv_include_intf = @mdc_cv_include_intf@ mdc_cv_include_inw = @mdc_cv_include_inw@ mdc_cv_include_nifti = @mdc_cv_include_nifti@ mdc_cv_include_png = @mdc_cv_include_png@ mdc_cv_include_tpc = @mdc_cv_include_tpc@ mdc_cv_ljpg = @mdc_cv_ljpg@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = gnu noinst_LTLIBRARIES = libtpcmisc.la libtpcimgio.la libtpcmisc_la_SOURCES = swap.c petc99.c #libtpcmisc_la_LDFLAGS = libtpcimgio_la_SOURCES = ecat7r.c ecat7w.c ecat7ml.c #libtpcimgio_la_LDFLAGS = noinst_HEADERS = ecat7.h petc99.h swap.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libs/tpc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu libs/tpc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libtpcimgio.la: $(libtpcimgio_la_OBJECTS) $(libtpcimgio_la_DEPENDENCIES) $(EXTRA_libtpcimgio_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libtpcimgio_la_OBJECTS) $(libtpcimgio_la_LIBADD) $(LIBS) libtpcmisc.la: $(libtpcmisc_la_OBJECTS) $(libtpcmisc_la_DEPENDENCIES) $(EXTRA_libtpcmisc_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libtpcmisc_la_OBJECTS) $(libtpcmisc_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecat7ml.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecat7r.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecat7w.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/petc99.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swap.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xmedcon-0.14.1/libs/ChangeLog0000644000175000017510000000000011152103413012634 00000000000000xmedcon-0.14.1/libs/README0000644000175000017510000000167010673312650011774 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: README # # # # UTILITY text: Medical Image Conversion Utility # # # # purpose : the libs 'you-should-read' file # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: README,v 1.2 2007/09/16 20:44:24 enlf Exp $ Extra libs to extend (X)MedCon's capabilities: - dicom : DICOM 3.0 format - ljpg : LossLess JPEG decompression - nifti : NIfTI-1 format xmedcon-0.14.1/libs/ljpg/0000755000175000017510000000000012637632716012136 500000000000000xmedcon-0.14.1/libs/ljpg/read.c0000644000175000017510000003462710110746143013131 00000000000000/* * read.c -- * * Code for reading and processing JPEG markers. Large parts are grabbed * from the IJG software */ /* * $Id: read.c,v 1.6 2004/08/18 21:38:43 enlf Exp $ */ #include #include #include #include "jpeg.h" #include "mcu.h" #include "io.h" #include "proto.h" /* * To fix a memory leak (memory malloc'd then never freed) in the original * version of lossless JPEG decompression, memory is allocated for 4 * Huffman tables once here, then pointers set later as needed */ static HuffmanTable HuffmanTableMemory[4]; /* * Enumerate all the JPEG marker codes */ typedef enum { M_SOF0 = 0xc0, M_SOF1 = 0xc1, M_SOF2 = 0xc2, M_SOF3 = 0xc3, M_SOF5 = 0xc5, M_SOF6 = 0xc6, M_SOF7 = 0xc7, M_JPG = 0xc8, M_SOF9 = 0xc9, M_SOF10 = 0xca, M_SOF11 = 0xcb, M_SOF13 = 0xcd, M_SOF14 = 0xce, M_SOF15 = 0xcf, M_DHT = 0xc4, M_DAC = 0xcc, M_RST0 = 0xd0, M_RST1 = 0xd1, M_RST2 = 0xd2, M_RST3 = 0xd3, M_RST4 = 0xd4, M_RST5 = 0xd5, M_RST6 = 0xd6, M_RST7 = 0xd7, M_SOI = 0xd8, M_EOI = 0xd9, M_SOS = 0xda, M_DQT = 0xdb, M_DNL = 0xdc, M_DRI = 0xdd, M_DHP = 0xde, M_EXP = 0xdf, M_APP0 = 0xe0, M_APP15 = 0xef, M_JPG0 = 0xf0, M_JPG13 = 0xfd, M_COM = 0xfe, M_TEM = 0x01, M_ERROR = 0x100 } JpegMarker; /* *-------------------------------------------------------------- * * Get2bytes -- * * Get a 2-byte unsigned integer (e.g., a marker parameter length * field) * * Results: * Next two byte of input as an integer. * * Side effects: * Bitstream is parsed. * *-------------------------------------------------------------- */ static Uint Get2bytes (void) { int a; a = GetJpegChar(); return (a << 8) + GetJpegChar(); } /* *-------------------------------------------------------------- * * SkipVariable -- * * Skip over an unknown or uninteresting variable-length marker * * Results: * None. * * Side effects: * Bitstream is parsed over marker. * * *-------------------------------------------------------------- */ static void SkipVariable (DecompressInfo *dcPtr) { int length; length = Get2bytes () - 2; while (length--) { GetJpegChar(); } } /* *-------------------------------------------------------------- * * GetDht -- * * Process a DHT marker * * Results: * None * * Side effects: * A huffman table is read. * Exits on error. * *-------------------------------------------------------------- */ static void GetDht (DecompressInfo *dcPtr) { int length; Uchar bits[17]; Uchar huffval[256]; int i, index, count; HuffmanTable **htblptr=NULL; length = Get2bytes () - 2; while (length) { index = GetJpegChar(); bits[0] = 0; count = 0; for (i = 1; i <= 16; i++) { bits[i] = GetJpegChar(); count += bits[i]; } if (count > 256) { fprintf (stderr, "Bogus DHT counts\n"); /* exit (1); */ dcPtr->error = -1; return; } for (i = 0; i < count; i++) huffval[i] = GetJpegChar(); length -= 1 + 16 + count; if (index & 0x10) { /* AC table definition */ fprintf(stderr,"Huffman table for lossless JPEG is not defined.\n"); } else { /* DC table definition */ htblptr = &dcPtr->dcHuffTblPtrs[index]; } if (index < 0 || index >= 4) { fprintf (stderr, "Bogus DHT index %d\n", index); /* exit (1); */ dcPtr->error = -1; return; } if (*htblptr == NULL) { *htblptr = &HuffmanTableMemory[index]; if (*htblptr==NULL) { fprintf(stderr,"Can't malloc HuffmanTable\n"); /* exit(-1); */ dcPtr->error = -1; return; } } MEMCPY((*htblptr)->bits, bits, sizeof ((*htblptr)->bits)); MEMCPY((*htblptr)->huffval, huffval, sizeof ((*htblptr)->huffval)); } } /* *-------------------------------------------------------------- * * GetDri -- * * Process a DRI marker * * Results: * None * * Side effects: * Exits on error. * Bitstream is parsed. * *-------------------------------------------------------------- */ static void GetDri (DecompressInfo *dcPtr) { if (Get2bytes () != 4) { fprintf (stderr, "Bogus length in DRI\n"); /* exit (1); */ dcPtr->error = -1; return; } dcPtr->restartInterval = (Ushort) Get2bytes (); } /* *-------------------------------------------------------------- * * GetApp0 -- * * Process an APP0 marker. * * Results: * None * * Side effects: * Bitstream is parsed * *-------------------------------------------------------------- */ static void GetApp0 (DecompressInfo *dcPtr) { int length; length = Get2bytes () - 2; while (length-- > 0) /* skip any remaining data */ (void)GetJpegChar(); } /* *-------------------------------------------------------------- * * GetSof -- * * Process a SOFn marker * * Results: * None. * * Side effects: * Bitstream is parsed * Exits on error * dcPtr structure is filled in * *-------------------------------------------------------------- */ static void GetSof (DecompressInfo *dcPtr, int code) { int length; short ci; int c; JpegComponentInfo *compptr; code = code; length = Get2bytes (); dcPtr->dataPrecision = GetJpegChar(); dcPtr->imageHeight = Get2bytes (); dcPtr->imageWidth = Get2bytes (); dcPtr->numComponents = GetJpegChar(); /* * We don't support files in which the image height is initially * specified as 0 and is later redefined by DNL. As long as we * have to check that, might as well have a general sanity check. */ if ((dcPtr->imageHeight <= 0 ) || (dcPtr->imageWidth <= 0) || (dcPtr->numComponents <= 0)) { fprintf (stderr, "Empty JPEG image (DNL not supported)\n"); /* exit(1); */ dcPtr->error = -1; return; } if ((dcPtr->dataPrecisiondataPrecision>MaxPrecisionBits)) { fprintf (stderr, "Unsupported JPEG data precision\n"); /* exit(1); */ dcPtr->error = -1; return; } if (length != (dcPtr->numComponents * 3 + 8)) { fprintf (stderr, "Bogus SOF length\n"); /* exit (1); */ dcPtr->error = -1; return; } for (ci = 0; ci < dcPtr->numComponents; ci++) { compptr = &dcPtr->compInfo[ci]; compptr->componentIndex = ci; compptr->componentId = GetJpegChar(); c = GetJpegChar(); compptr->hSampFactor = (c >> 4) & 15; compptr->vSampFactor = (c) & 15; (void) GetJpegChar(); /* skip Tq */ } }/*endof GetSof */ /* *-------------------------------------------------------------- * * GetSos -- * * Process a SOS marker * * Results: * None. * * Side effects: * Bitstream is parsed. * Exits on error. * *-------------------------------------------------------------- */ static void GetSos (DecompressInfo *dcPtr) { int length; int i, ci, n, c, cc; JpegComponentInfo *compptr; length = Get2bytes (); /* * Get the number of image components. */ n = GetJpegChar(); dcPtr->compsInScan = n; length -= 3; if (length != (n * 2 + 3) || n < 1 || n > 4) { fprintf (stderr, "Bogus SOS length\n"); /* exit (1); */ dcPtr->error = -1; return; } for (i = 0; i < n; i++) { cc = GetJpegChar(); c = GetJpegChar(); length -= 2; for (ci = 0; ci < dcPtr->numComponents; ci++) if (cc == dcPtr->compInfo[ci].componentId) { break; } if (ci >= dcPtr->numComponents) { fprintf (stderr, "Invalid component number in SOS\n"); /* exit (1); */ dcPtr->error = -1; return; } compptr = &dcPtr->compInfo[ci]; dcPtr->curCompInfo[i] = compptr; compptr->dcTblNo = (c >> 4) & 15; } /* * Get the PSV, skip Se, and get the point transform parameter. */ dcPtr->Ss = GetJpegChar(); (void)GetJpegChar(); c = GetJpegChar(); dcPtr->Pt = c & 0x0F; }/*endof GetSos */ /* *-------------------------------------------------------------- * * GetSoi -- * * Process an SOI marker * * Results: * None. * * Side effects: * Bitstream is parsed. * Exits on error. * *-------------------------------------------------------------- */ static void GetSoi (DecompressInfo *dcPtr) { /* * Reset all parameters that are defined to be reset by SOI */ dcPtr->restartInterval = 0; } /* *-------------------------------------------------------------- * * NextMarker -- * * Find the next JPEG marker Note that the output might not * be a valid marker code but it will never be 0 or FF * * Results: * The marker found. * * Side effects: * Bitstream is parsed. * *-------------------------------------------------------------- */ static int NextMarker (void) { int c, nbytes; nbytes = 0; do { /* * skip any non-FF bytes */ do { nbytes++; c = GetJpegChar(); } while (c != 0xFF); /* * skip any duplicate FFs without incrementing nbytes, since * extra FFs are legal */ do { c = GetJpegChar(); } while (c == 0xFF); } while (c == 0); /* repeat if it was a stuffed FF/00 */ return c; } /* *-------------------------------------------------------------- * * ProcessTables -- * * Scan and process JPEG markers that can appear in any order * Return when an SOI, EOI, SOFn, or SOS is found * * Results: * The marker found. * * Side effects: * Bitstream is parsed. * *-------------------------------------------------------------- */ static JpegMarker ProcessTables (DecompressInfo *dcPtr) { int c; while (1) { c = NextMarker (); switch (c) { case M_SOF0: case M_SOF1: case M_SOF2: case M_SOF3: case M_SOF5: case M_SOF6: case M_SOF7: case M_JPG: case M_SOF9: case M_SOF10: case M_SOF11: case M_SOF13: case M_SOF14: case M_SOF15: case M_SOI: case M_EOI: case M_SOS: return ((JpegMarker)c); case M_DHT: GetDht (dcPtr); if (dcPtr->error) return 0; break; case M_DQT: fprintf(stderr,"Not a lossless JPEG file.\n"); break; case M_DRI: GetDri (dcPtr); if (dcPtr->error) return 0; break; case M_APP0: GetApp0 (dcPtr); break; case M_RST0: /* these are all parameterless */ case M_RST1: case M_RST2: case M_RST3: case M_RST4: case M_RST5: case M_RST6: case M_RST7: case M_TEM: fprintf (stderr, "Warning: unexpected marker 0x%02x\n", c); break; default: /* must be DNL, DHP, EXP, APPn, JPGn, COM, * or RESn */ SkipVariable (dcPtr); break; } } }/*endof ProcessTables */ /* *-------------------------------------------------------------- * * ReadFileHeader -- * * Initialize and read the file header (everything through * the SOF marker). * * Results: * None * * Side effects: * Exit on error. * *-------------------------------------------------------------- */ void ReadFileHeader (DecompressInfo *dcPtr) { int c, c2; /* * Demand an SOI marker at the start of the file --- otherwise it's * probably not a JPEG file at all. */ c = GetJpegChar(); c2 = GetJpegChar(); if ((c != 0xFF) || (c2 != M_SOI)) { if( c == EOF ) { fprintf(stderr, "Reached end of input file. All done!\n"); /* fclose(outFile); */ /* exit(1); */ dcPtr->error = -1; return; } else { fprintf (stderr, "Not a JPEG file. Found %02X %02X\n", c, c2); /* exit (1); */ dcPtr->error = -1; return; } }/*endif*/ GetSoi (dcPtr); if (dcPtr->error) return; /* OK, process SOI */ /* * Process markers until SOF */ c = ProcessTables (dcPtr); if (dcPtr->error) return; switch (c) { case M_SOF0: case M_SOF1: case M_SOF3: GetSof (dcPtr, c); break; default: fprintf (stderr, "Unsupported SOF marker type 0x%02x\n", c); break; } }/*endof ReadFileHeader*/ /* *-------------------------------------------------------------- * * ReadScanHeader -- * * Read the start of a scan (everything through the SOS marker). * * Results: * 1 if find SOS, 0 if find EOI * * Side effects: * Bitstream is parsed, may exit on errors. * *-------------------------------------------------------------- */ int ReadScanHeader (DecompressInfo *dcPtr) { int c; /* * Process markers until SOS or EOI */ c = ProcessTables (dcPtr); if (dcPtr->error) return 0; switch (c) { case M_SOS: GetSos (dcPtr); return 1; case M_EOI: return 0; default: fprintf (stderr, "Unexpected marker 0x%02x\n", c); break; } return 0; }/*endof ReadScanHeader*/ /* *-------------------------------------------------------------- * * GetJpegChar, UnGetJpegChar -- * * * Results: * GetJpegChar returns the next character in the stream, or EOF * UnGetJpegChar returns nothing. * * Side effects: * A byte is consumed or put back into the inputBuffer. * *-------------------------------------------------------------- */ int GetJpegChar(void) { return (int)inputBuffer[inputBufferOffset++]; } void UnGetJpegChar(int ch) { inputBuffer[--inputBufferOffset] = ch; } xmedcon-0.14.1/libs/ljpg/Makefile.am0000644000175000017510000000207307571521303014102 00000000000000## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## filename: Makefile.am ## ## ## ## UTIL Make : Medical Image Conversion Utility ## ## ## ## purpose : ljpg subdir Makefile template (automake) ## ## ## ## project : (X)MedCon by Erik Nolf ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## $Id: Makefile.am,v 1.5 2002/11/28 23:12:03 enlf Exp $ AUTOMAKE_OPTIONS = gnu AM_CFLAGS = noinst_LTLIBRARIES = libljpg.la libljpg_la_SOURCES = \ decomp.c \ huffd.c \ jpegutil.c \ mcu.c \ predict.c \ read.c noinst_HEADERS = \ io.h \ jpeg.h \ jpegless.h \ mcu.h \ predict.h \ proto.h xmedcon-0.14.1/libs/ljpg/mcu.c0000644000175000017510000000542610110746143012775 00000000000000/* * mcu.c -- * * Support for MCU allocation, deallocation, and printing. * */ /* * $Id: mcu.c,v 1.5 2004/08/18 21:38:43 enlf Exp $ */ #include #include #include #include "jpeg.h" #include "mcu.h" #include "proto.h" MCU *mcuTable=NULL; /* the global mcu table that buffers the source image */ MCU *mcuROW1=NULL; /* point to two rows of MCU in encoding & decoding */ MCU *mcuROW2=NULL; int numMCU=0; /* number of MCUs in mcuTable */ /* *-------------------------------------------------------------- * * MakeMCU, InitMcuTable -- * * InitMcuTable does a big malloc to get the amount of memory * we'll need for storing MCU's, once we know the size of our * input and output images. * MakeMCU returns an MCU for input parsing. * * Results: * A new MCU * * Side effects: * None. * *-------------------------------------------------------------- */ void InitMcuTable (int numMCU,int compsInScan) { int i, mcuSize; char *buffer; /* * Compute size of on MCU (in bytes). Round up so it's on a * boundary for any alignment. In this code, we assume this * is a whole multiple of sizeof(double). */ mcuSize = compsInScan * sizeof(ComponentType); mcuSize = JroundUp(mcuSize,sizeof(double)); /* * Allocate the MCU table, and a buffer which will contain all * the data. Then carve up the buffer by hand. Note that * mcuTable[0] points to the buffer, in case we want to free * it up later. */ mcuTable = (MCU *)malloc(numMCU * sizeof(MCU)); if (mcuTable==NULL) fprintf(stderr,"Not enough memory for mcuTable\n"); buffer = (char *)malloc((unsigned)(numMCU * mcuSize)); if (buffer==NULL) fprintf(stderr,"Not enough memory for buffer\n"); for (i=0; i #include "mcu.h" #ifdef DEBUG /* *-------------------------------------------------------------- * * Predict -- * * Calculate the predictor for pixel[row][col][curComp], * i.e. curRowBuf[col][curComp]. It handles the all special * cases at image edges, such as first row and first column * of a scan. * * Results: * predictor is passed out. * * Side effects: * None. * *-------------------------------------------------------------- */ void Predict(int row,int col, /* position of the pixel to be predicted */ int curComp, /* the pixel's component that is predicting */ MCU *curRowBuf,MCU *prevRowBuf, /* current and previous row of image */ int Pr, /* data precision */ int Pt, /* point transformation */ int psv, /* predictor selection value */ int *predictor) /* preditor value (output) */ { register int left,upper,diag,leftcol; leftcol=col-1; if (row==0) { /* * The predictor of first pixel is (1<<(Pr-Pt-1), and the * predictors for rest of first row are left neighbors. */ if (col==0) { *predictor = (1<<(Pr-Pt-1)); } else { *predictor = curRowBuf[leftcol][curComp]; } } else { /* * The predictors of first column are upper neighbors. * All other preditors are calculated according to psv. */ upper=prevRowBuf[col][curComp]; if (col==0) *predictor = upper; else { left=curRowBuf[leftcol][curComp]; diag=prevRowBuf[leftcol][curComp]; switch (psv) { case 0: *predictor = 0; break; case 1: *predictor = left; break; case 2: *predictor = upper; break; case 3: *predictor = diag; break; case 4: *predictor = left+upper-diag; break; case 5: *predictor = left+((upper-diag)>>1); break; case 6: *predictor = upper+((left-diag)>>1); break; case 7: *predictor = (left+upper)>>1; break; default: fprintf(stderr,"Warning: Undefined PSV\n"); *predictor = 0; } } } } /* *-------------------------------------------------------------- * * QuickPredict -- * * Calculate the predictor for sample curRowBuf[col][curComp]. * It does not handle the special cases at image edges, such * as first row and first column of a scan. We put the special * case checkings outside so that the computations in main * loop can be simpler. This has enhenced the performance * significantly. * * Results: * predictor is passed out. * * Side effects: * None. * *-------------------------------------------------------------- */ void QuickPredict(int col /* column # of the pixel to be predicted */, int curComp /* the pixel's component that is predicting */, MCU *curRowBuf,MCU *prevRowBuf,/* current and previous row of image */ int psv /* predictor selection value */, int predictor /* preditor value (output) */) { register int left,upper,diag,leftcol; /* * All predictor are calculated according to psv. */ switch (psv) { case 0: *predictor = 0; break; case 1: leftcol = col-1; left = curRowBuf[leftcol][curComp]; *predictor = left; break; case 2: upper = prevRowBuf[col][curComp]; *predictor = upper; break; case 3: leftcol = col-1; diag = prevRowBuf[leftcol][curComp]; *predictor = diag; break; case 4: leftcol = col-1; upper = prevRowBuf[col][curComp]; left = curRowBuf[leftcol][curComp]; diag = prevRowBuf[leftcol][curComp]; *predictor = left + upper - diag; break; case 5: leftcol = col-1; upper = prevRowBuf[col][curComp]; left = curRowBuf[leftcol][curComp]; diag = prevRowBuf[leftcol][curComp]; *predictor = left+((upper-diag)>>1); break; case 6: leftcol = col-1; upper = prevRowBuf[col][curComp]; left = curRowBuf[leftcol][curComp]; diag = prevRowBuf[leftcol][curComp]; *predictor = upper+((left-diag)>>1); break; case 7: leftcol = col-1; upper = prevRowBuf[col][curComp]; left = curRowBuf[leftcol][curComp]; *predictor = (left+upper)>>1; break; default: fprintf(stderr,"Warning: Undefined PSV\n"); *predictor = 0; } } #endif /*DEBUG*/ xmedcon-0.14.1/libs/ljpg/ChangeLog0000644000175000017510000000000011152103414013571 00000000000000xmedcon-0.14.1/libs/ljpg/jpegutil.c0000644000175000017510000001471610536124155014043 00000000000000/* * jpegutil.c -- * * Various utility routines used in the jpeg encoder/decoder. Large parts * are stolen from the IJG code */ /* * $Id: jpegutil.c,v 1.6 2006/12/07 23:49:01 enlf Exp $ */ #include #include #include #include "jpeg.h" #include "mcu.h" #include "proto.h" /* * To fix memory leaks, memory is allocated once for the mcu buffers. * Enough memory is reserved to accomodate up to MDC_LJPG_LIMIT-wide images * with up to 4 components. */ #define MDC_LJPG_LIMIT 4096 /* hardcoded limit of image width */ static char mcuROW1Memory[MDC_LJPG_LIMIT * sizeof(MCU)]; static char mcuROW2Memory[MDC_LJPG_LIMIT * sizeof(MCU)]; static char buf1Memory[MDC_LJPG_LIMIT * 4 * sizeof(ComponentType)]; static char buf2Memory[MDC_LJPG_LIMIT * 4 * sizeof(ComponentType)]; unsigned int bitMask[] = { 0xffffffff, 0x7fffffff, 0x3fffffff, 0x1fffffff, 0x0fffffff, 0x07ffffff, 0x03ffffff, 0x01ffffff, 0x00ffffff, 0x007fffff, 0x003fffff, 0x001fffff, 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff, 0x0000ffff, 0x00007fff, 0x00003fff, 0x00001fff, 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff, 0x000000ff, 0x0000007f, 0x0000003f, 0x0000001f, 0x0000000f, 0x00000007, 0x00000003, 0x00000001}; /* *-------------------------------------------------------------- * * JroundUp -- * * Compute a rounded up to next multiple of b; a >= 0, b > 0 * * Results: * Rounded up value. * * Side effects: * None. * *-------------------------------------------------------------- */ int JroundUp (int a, int b) { a += b - 1; return a - (a % b); } /* *-------------------------------------------------------------- * * DecoderStructInit -- * * Initalize the rest of the fields in the decompression * structure. * * Results: * None. * * Side effects: * None. * *-------------------------------------------------------------- */ void DecoderStructInit (DecompressInfo *dcPtr) { char *buf1,*buf2; short ci,i; JpegComponentInfo *compPtr; int mcuSize; /* * Check sampling factor validity. */ for (ci = 0; ci < dcPtr->numComponents; ci++) { compPtr = &dcPtr->compInfo[ci]; if ((compPtr->hSampFactor != 1) || (compPtr->vSampFactor != 1)) { fprintf (stderr, "Error: Downsampling is not supported.\n"); /* exit(-1); */ dcPtr->error = -1; return; } } /* * Prepare array describing MCU composition */ if (dcPtr->compsInScan == 1) { dcPtr->MCUmembership[0] = 0; } else { short ci; if (dcPtr->compsInScan > 4) { fprintf (stderr, "Too many components for interleaved scan\n"); /* exit (1); */ dcPtr->error = -1; return; } for (ci = 0; ci < dcPtr->compsInScan; ci++) { dcPtr->MCUmembership[ci] = ci; } } /* * Initialize mucROW1 and mcuROW2 which buffer two rows of * pixels for predictor calculation. */ mcuROW1 = (MCU *) mcuROW1Memory; mcuROW2 = (MCU *) mcuROW2Memory; mcuSize=dcPtr->compsInScan * sizeof(ComponentType); buf1 = buf1Memory; buf2 = buf2Memory; for (i=0;iimageWidth;i++) { mcuROW1[i]=(MCU)(buf1+i*mcuSize); mcuROW2[i]=(MCU)(buf2+i*mcuSize); } dcPtr->error = 0; }/*endof DecoderStructInit*/ /* *-------------------------------------------------------------- * * FixHuffTbl -- * * Compute derived values for a Huffman table one the DHT marker * has been processed. This generates both the encoding and * decoding tables. * * Results: * None. * * Side effects: * None. * *-------------------------------------------------------------- */ void FixHuffTbl (HuffmanTable *htbl) { int p, i, l, lastp, si; char huffsize[257]; Ushort huffcode[257]; Ushort code; int size; int value, ll, ul; /* * Figure C.1: make table of Huffman code length for each symbol * Note that this is in code-length order. */ p = 0; for (l = 1; l <= 16; l++) { for (i = 1; i <= (int)htbl->bits[l]; i++) huffsize[p++] = (char)l; } huffsize[p] = 0; lastp = p; /* * Figure C.2: generate the codes themselves * Note that this is in code-length order. */ code = 0; si = huffsize[0]; p = 0; while (huffsize[p]) { while (((int)huffsize[p]) == si) { huffcode[p++] = code; code++; } code <<= 1; si++; } /* * Figure C.3: generate encoding tables * These are code and size indexed by symbol value * Set any codeless symbols to have code length 0; this allows * EmitBits to detect any attempt to emit such symbols. */ MEMSET(htbl->ehufsi, 0, sizeof(htbl->ehufsi)); for (p = 0; p < lastp; p++) { htbl->ehufco[htbl->huffval[p]] = huffcode[p]; htbl->ehufsi[htbl->huffval[p]] = huffsize[p]; } /* * Figure F.15: generate decoding tables */ p = 0; for (l = 1; l <= 16; l++) { if (htbl->bits[l]) { htbl->valptr[l] = p; htbl->mincode[l] = huffcode[p]; p += htbl->bits[l]; htbl->maxcode[l] = huffcode[p - 1]; } else { htbl->maxcode[l] = -1; } } /* * We put in this value to ensure HuffDecode terminates. */ htbl->maxcode[17] = 0xFFFFFL; /* * Build the numbits, value lookup tables. * These table allow us to gather 8 bits from the bits stream, * and immediately lookup the size and value of the huffman codes. * If size is zero, it means that more than 8 bits are in the huffman * code (this happens about 3-4% of the time). */ /*bzero (htbl->numbits, sizeof(htbl->numbits));*/ memset(htbl->numbits, 0, sizeof(htbl->numbits)); for (p=0; phuffval[p]; code = huffcode[p]; ll = code << (8-size); if (size < 8) { ul = ll | bitMask[24+size]; } else { ul = ll; } for (i=ll; i<=ul; i++) { htbl->numbits[i] = size; htbl->value[i] = value; } } } } xmedcon-0.14.1/libs/ljpg/huffd.c0000644000175000017510000006125712157431176013323 00000000000000/* * huffd.c -- * * Code for JPEG lossless decoding. Large parts are grabbed from the IJG * software */ /* * $Id: huffd.c,v 1.8 2013/06/16 21:47:42 enlf Exp $ */ #include #include #include #include "jpeg.h" #include "mcu.h" #include "io.h" #include "proto.h" #include "predict.h" #define RST0 0xD0 /* RST0 marker code */ static long getBuffer; /* current bit-extraction buffer */ static int bitsLeft; /* # of unused bits in it */ /* * The following variables keep track of the input buffer * for the JPEG data, which is read by ReadJpegData. */ Uchar *inputBuffer = 0; /* Input buffer for JPEG data */ int inputBufferOffset = 0; /* Offset of current byte */ /* * Code for extracting the next N bits from the input stream. * (N never exceeds 15 for JPEG data.) * This needs to go as fast as possible! * * We read source bytes into getBuffer and dole out bits as needed. * If getBuffer already contains enough bits, they are fetched in-line * by the macros get_bits() and get_bit(). When there aren't enough bits, * FillBitBuffer is called; it will attempt to fill getBuffer to the * "high water mark", then extract the desired number of bits. The idea, * of course, is to minimize the function-call overhead cost of entering * FillBitBuffer. * On most machines MIN_GET_BITS should be 25 to allow the full 32-bit width * of getBuffer to be used. (On machines with wider words, an even larger * buffer could be used.) */ #define BITS_PER_LONG (8*sizeof(long)) #define MIN_GET_BITS (BITS_PER_LONG-7) /* max value for long getBuffer */ /* * bmask[n] is mask for n rightmost bits */ static int bmask[] = {0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF}; /* *-------------------------------------------------------------- * * FillBitBuffer -- * * Load up the bit buffer with at least nbits * Process any stuffed bytes at this time. * * Results: * None * * Side effects: * The bitwise global variables are updated. * *-------------------------------------------------------------- */ #define FillBitBuffer(nbits) { \ int c, c2; \ while (bitsLeft < MIN_GET_BITS) { \ c = GetJpegChar (); \ /* If it's 0xFF, check and discard stuffed zero byte */ \ if (c == 0xFF) { \ c2 = GetJpegChar (); \ if (c2 != 0) { \ UnGetJpegChar (c2); \ UnGetJpegChar (c); \ c = 0; \ } \ }/*endif 0xFF*/ \ /* OK, load c into getBuffer */ \ getBuffer = (getBuffer << 8) | c; \ bitsLeft += 8; \ }/*endwhile*/ \ }/*endof FillBitBuffer*/ /* Macros to make things go at some speed! */ /* NB: parameter to get_bits should be simple variable, not expression */ #define show_bits(nbits,rv) { \ if (bitsLeft < nbits) FillBitBuffer(nbits); \ rv = (getBuffer >> (bitsLeft-(nbits))) & bmask[nbits]; \ } #define show_bits8(rv) { \ if (bitsLeft < 8) FillBitBuffer(8); \ rv = (getBuffer >> (bitsLeft-8)) & 0xff; \ } #define flush_bits(nbits) { \ bitsLeft -= (nbits); \ } #define get_bits(nbits,rv) { \ if (bitsLeft < nbits) FillBitBuffer(nbits); \ rv = ((getBuffer >> (bitsLeft -= (nbits)))) & bmask[nbits]; \ } #define get_bit(rv) { \ if (!bitsLeft) FillBitBuffer(1); \ rv = (getBuffer >> (--bitsLeft)) & 1; \ } /* *-------------------------------------------------------------- * * PmPutRow -- * * Output one row of pixels stored in RowBuf. * * Results: * None * * Side effects: * One row of pixels are write to file pointed by outFile. * *-------------------------------------------------------------- */ void PmPutRow24(MCU *RowBuf, int numCol, unsigned char **image) { register int col; for (col = 0; col < numCol; col++) { /* take each RGB column */ **image = (unsigned char) RowBuf[col][0]; *(*image+1) = (unsigned char) RowBuf[col][1]; *(*image+2) = (unsigned char) RowBuf[col][2]; (*image)+=3; } } void PmPutRow16(MCU *RowBuf, int numCol, unsigned short **image) { register int col; for (col = 0; col < numCol; col++) { **image = (unsigned short) RowBuf[col][0]; (*image)++; } } void PmPutRow8(MCU *RowBuf, int numCol, unsigned char **image) { register int col; for (col = 0; col < numCol; col++) { **image = (unsigned char) RowBuf[col][0]; (*image)++; } } /* *-------------------------------------------------------------- * * HuffDecode -- * * Taken from Figure F.16: extract next coded symbol from * input stream. This should becode a macro. * * Results: * Next coded symbol * * Side effects: * Bitstream is parsed. * *-------------------------------------------------------------- */ #define HuffDecode(htbl,rv) \ { \ int l, code, temp; \ \ /* \ * If the huffman code is less than 8 bits, we can use the fast \ * table lookup to get its value. It's more than 8 bits about \ * 3-4% of the time. \ */ \ show_bits8(code); \ if (htbl->numbits[code]) { \ flush_bits(htbl->numbits[code]); \ rv=htbl->value[code]; \ } \ else { \ flush_bits(8); \ l = 8; \ while (code > htbl->maxcode[l]) { \ get_bit(temp); \ code = (code << 1) | temp; \ l++; \ } \ \ /* \ * With garbage input we may reach the sentinel value l = 17. \ */ \ \ if (l > 16) { \ fprintf (stderr, "Corrupt JPEG data: bad Huffman code\n"); \ rv = 0; /* fake a zero as the safest result */ \ } else { \ rv = htbl->huffval[htbl->valptr[l] + \ ((int)(code - htbl->mincode[l]))]; \ } \ }/*endelse*/ \ }/*HuffDecode*/ /* *-------------------------------------------------------------- * * HuffExtend -- * * Code and table for Figure F.12: extend sign bit * * Results: * The extended value. * * Side effects: * None. * *-------------------------------------------------------------- */ static int extendTest[16] = /* entry n is 2**(n-1) */ {0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000}; static int extendOffset[16] = /* entry n is (-1 << n) + 1 */ {0, ((-1) << 1) + 1, ((-1) << 2) + 1, ((-1) << 3) + 1, ((-1) << 4) + 1, ((-1) << 5) + 1, ((-1) << 6) + 1, ((-1) << 7) + 1, ((-1) << 8) + 1, ((-1) << 9) + 1, ((-1) << 10) + 1, ((-1) << 11) + 1, ((-1) << 12) + 1, ((-1) << 13) + 1, ((-1) << 14) + 1, ((-1) << 15) + 1}; #define HuffExtend(x,s) { \ if ((x) < extendTest[s]) { \ (x) += extendOffset[s]; \ } \ } /* *-------------------------------------------------------------- * * HuffDecoderInit -- * * Initialize for a Huffman-compressed scan. * This is invoked after reading the SOS marker. * * Results: * None * * Side effects: * None. * *-------------------------------------------------------------- */ void HuffDecoderInit (DecompressInfo *dcPtr) { short ci; JpegComponentInfo *compptr; /* * Initialize static variables */ bitsLeft = 0; for (ci = 0; ci < dcPtr->compsInScan; ci++) { compptr = dcPtr->curCompInfo[ci]; /* * Make sure requested tables are present */ if (dcPtr->dcHuffTblPtrs[compptr->dcTblNo] == NULL) { fprintf (stderr, "Error: Use of undefined Huffman table\n"); /* exit (1); */ dcPtr->error = -1; return; } /* * Compute derived values for Huffman tables. * We may do this more than once for same table, but it's not a * big deal */ FixHuffTbl (dcPtr->dcHuffTblPtrs[compptr->dcTblNo]); } /* * Initialize restart stuff */ dcPtr->restartInRows = (dcPtr->restartInterval)/(dcPtr->imageWidth); dcPtr->restartRowsToGo = dcPtr->restartInRows; dcPtr->nextRestartNum = 0; } /* *-------------------------------------------------------------- * * ProcessRestart -- * * Check for a restart marker & resynchronize decoder. * * Results: * None. * * Side effects: * BitStream is parsed, bit buffer is reset, etc. * *-------------------------------------------------------------- */ static void ProcessRestart(DecompressInfo *dcPtr) { int c, nbytes; /*short ci;*/ /* * Throw away any unused bits remaining in bit buffer */ nbytes = bitsLeft / 8; bitsLeft = 0; /* * Scan for next JPEG marker */ do { do { /* skip any non-FF bytes */ nbytes++; c = GetJpegChar(); } while (c != 0xFF); do { /* skip any duplicate FFs */ /* * we don't increment nbytes here since extra FFs are legal */ c = GetJpegChar (); } while (c == 0xFF); } while (c == 0); /* repeat if it was a stuffed FF/00 */ if (c != (RST0 + dcPtr->nextRestartNum)) { /* * Uh-oh, the restart markers have been messed up too. * Just bail out. */ fprintf (stderr, "Error: Corrupt JPEG data. Exiting...\n"); /* exit(-1); */ dcPtr->error = -1; return; } /* * Update restart state */ dcPtr->restartRowsToGo = dcPtr->restartInRows; dcPtr->nextRestartNum = (dcPtr->nextRestartNum + 1) & 7; } /* *-------------------------------------------------------------- * * DecodeFirstRow -- * * Decode the first raster line of samples at the start of * the scan and at the beginning of each restart interval. * This includes modifying the component value so the real * value, not the difference is returned. * * Results: * None. * * Side effects: * Bitstream is parsed. * *-------------------------------------------------------------- */ void DecodeFirstRow (DecompressInfo *dcPtr, MCU *curRowBuf) { register short curComp,ci; register int s,col,compsInScan,numCOL; register JpegComponentInfo *compptr; int Pr,Pt,d; HuffmanTable *dctbl; Pr=dcPtr->dataPrecision; Pt=dcPtr->Pt; compsInScan=dcPtr->compsInScan; numCOL=dcPtr->imageWidth; /* * the start of the scan or at the beginning of restart interval. */ for (curComp = 0; curComp < compsInScan; curComp++) { ci = dcPtr->MCUmembership[curComp]; compptr = dcPtr->curCompInfo[ci]; dctbl = dcPtr->dcHuffTblPtrs[compptr->dcTblNo]; /* * Section F.2.2.1: decode the difference */ HuffDecode (dctbl,s); if (s) { if (s == 16) { /* special case: always output 32768 */ d = 32768; } else { /* normal case: fetch subsequent bits */ get_bits(s,d); HuffExtend(d,s); } } else { d = 0; } /* * Add the predictor to the difference. */ curRowBuf[0][curComp]=d+(1<<(Pr-Pt-1)); } /* * the rest of the first row */ for (col=1; colMCUmembership[curComp]; compptr = dcPtr->curCompInfo[ci]; dctbl = dcPtr->dcHuffTblPtrs[compptr->dcTblNo]; /* * Section F.2.2.1: decode the difference */ HuffDecode (dctbl,s); if (s) { if (s == 16) { /* special case: always output 32768 */ d = 32768; } else { /* normal case: fetch subsequent bits */ get_bits(s,d); HuffExtend(d,s); } } else { d = 0; } /* * Add the predictor to the difference. */ curRowBuf[col][curComp]=d+curRowBuf[col-1][curComp]; } } if (dcPtr->restartInRows) { (dcPtr->restartRowsToGo)--; } }/*endof DecodeFirstRow*/ /* *-------------------------------------------------------------- * * DecodeImage -- * * Decode the input stream. This includes modifying * the component value so the real value, not the * difference is returned. * * Results: * None. * * Side effects: * Bitstream is parsed. * *-------------------------------------------------------------- */ void DecodeImage (DecompressInfo *dcPtr, unsigned short **image, int depth) { register int s, d, col, row; register short curComp, ci; HuffmanTable *dctbl; JpegComponentInfo *compptr; int predictor; int numCOL, numROW, compsInScan; MCU *prevRowBuf, *curRowBuf; int imagewidth, /*Pt,*/ psv; unsigned short *image16tmp; unsigned char *image8tmp, *image24tmp; numCOL = imagewidth=dcPtr->imageWidth; numROW = dcPtr->imageHeight; compsInScan = dcPtr->compsInScan; /*Pt = dcPtr->Pt;*/ psv = dcPtr->Ss; prevRowBuf = mcuROW2; curRowBuf = mcuROW1; if (depth == 8) image8tmp = (unsigned char *) *image; else if (depth == 16) image16tmp = (unsigned short *) *image; else if (depth == 24) image24tmp = (unsigned char *) *image; else { fprintf(stderr,"Unsupported image depth %d\n",depth); dcPtr->error = -1; return; } /* * Decode the first row of image. Output the row and * turn this row into a previous row for later predictor * calculation. */ row = 0; DecodeFirstRow (dcPtr, curRowBuf); if (depth == 8) PmPutRow8 (curRowBuf, numCOL, &image8tmp); else if (depth == 16) PmPutRow16 (curRowBuf, numCOL, &image16tmp); else if (depth == 24) PmPutRow24 (curRowBuf, numCOL, &image24tmp); swap(MCU *, prevRowBuf, curRowBuf); /* optimal case : 8 bit image, one color component, no restartInRows */ if ((depth == 8) && (compsInScan == 1) && (dcPtr->restartInRows == 0)) { unsigned char *curPixelPtr; int left,upper,diag; /* initializations */ curComp = 0; ci = dcPtr->MCUmembership[curComp]; compptr = dcPtr->curCompInfo[ci]; dctbl = dcPtr->dcHuffTblPtrs[compptr->dcTblNo]; curPixelPtr = image8tmp; for (row=1; row>1); break; case 6: upper = *(curPixelPtr - numCOL); left = *(curPixelPtr - 1); diag = *(curPixelPtr - numCOL - 1); predictor = upper+((left-diag)>>1); break; case 7: upper = *(curPixelPtr - numCOL); left = *(curPixelPtr - 1); predictor = (left+upper)>>1; break; default : predictor = 0; }/*endsandwich*/ *curPixelPtr = (unsigned char) (d + predictor); curPixelPtr++; }/*endfor col*/ }/*endelse*/ }/*endfor row*/ }/*endif fast case*/ else { /*normal case with 16 bits or color or ...*/ for (row=1; rowrestartInRows) { if (dcPtr->restartRowsToGo == 0) { ProcessRestart (dcPtr); if (dcPtr->error) return; /* * Reset predictors at restart. */ DecodeFirstRow(dcPtr,curRowBuf); if (depth == 8) PmPutRow8 (curRowBuf, numCOL, &image8tmp); else if (depth == 16) PmPutRow16 (curRowBuf, numCOL, &image16tmp); else if (depth == 24) PmPutRow24 (curRowBuf, numCOL, &image24tmp); swap(MCU *,prevRowBuf,curRowBuf); continue; } dcPtr->restartRowsToGo--; }/*endif*/ /* * For the rest of the column on this row, predictor * calculations are base on PSV. */ /* several color components to decode (RGB colors)*/ /* The upper neighbors are predictors for the first column. */ for (curComp = 0; curComp < compsInScan; curComp++) { ci = dcPtr->MCUmembership[curComp]; compptr = dcPtr->curCompInfo[ci]; dctbl = dcPtr->dcHuffTblPtrs[compptr->dcTblNo]; /* Section F.2.2.1: decode the difference */ HuffDecode (dctbl,s); if (s) { if (s == 16) { /* special case: always output 32768 */ d = 32768; } else { /* normal case: fetch subsequent bits */ get_bits(s,d); HuffExtend(d,s); } } else { d = 0; } curRowBuf[0][curComp]=d+prevRowBuf[0][curComp]; }/*endfor curComp*/ for (col=1; col < numCOL; col++) { for (curComp = 0; curComp < compsInScan; curComp++) { ci = dcPtr->MCUmembership[curComp]; compptr = dcPtr->curCompInfo[ci]; dctbl = dcPtr->dcHuffTblPtrs[compptr->dcTblNo]; /* Section F.2.2.1: decode the difference */ HuffDecode (dctbl, s); if (s) { if (s == 16) { /* special case: always output 32768 */ d = 32768; } else { /* normal case: fetch subsequent bits */ get_bits(s,d); HuffExtend(d,s); } } else { d = 0; } QuickPredict (col,curComp,curRowBuf,prevRowBuf,psv,&predictor); curRowBuf[col][curComp]=d+predictor; }/*endfor curComp*/ }/*endfor col*/ if (depth == 8) PmPutRow8 (curRowBuf, numCOL, &image8tmp); else if (depth == 16) PmPutRow16 (curRowBuf, numCOL, &image16tmp); else if (depth == 24) PmPutRow24 (curRowBuf, numCOL, &image24tmp); swap(MCU *, prevRowBuf, curRowBuf); }/*endfor row*/ }/*endelse*/ }/*endofmethod DecodeImage*/ xmedcon-0.14.1/libs/ljpg/README0000644000175000017510000001223507576203724012740 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: README # # # # UTILITY text: Medical Image Conversion Utility # # # # purpose : the ljpg 'you-should-read' file # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: README,v 1.3 2002/12/12 22:04:04 enlf Exp $ (X)MedCon's LossLess JPEG Decompression Library (DICOM) ----------------------------------------------- This library code was originally contributed by 'Jaslet Bertrand'. The software is based in part on the work of: a) the Cornell University LossLess JPEG library see ftp://ftp.cs.cornell.edu/pub/multimed b) the Independent JPEG Group's JPEG software see http://www.ijg.org License & Copyright notices: --------------------------- 1) (X)MedCon's LJPG (C) 2002, Jaslet Bertrand. Read the file ./COPYING.LIB 2) Cornell University Copyright (c) 1993 Cornell University, Kongji Huang All rights reserved. Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without written agreement is hereby granted, provided that the above copyright notice and the following two paragraphs appear in all copies of this software. IN NO EVENT SHALL THE CORNELL UNIVERSITY BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF CORNELL UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE CORNELL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND CORNELL UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. --------------------------------------------------------------------------- Copyright (c) 1993 The Regents of the University of California, Brian C. Smith All rights reserved. Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without written agreement is hereby granted, provided that the above copyright notice and the following two paragraphs appear in all copies of this software. IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. --------------------------------------------------------------------------- 3) Independent JPEG Group (IJG) The authors make NO WARRANTY or representation, either express or implied, with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose. This software is provided "AS IS", and you, its user, assume the entire risk as to its quality and accuracy. This software is copyright (C) 1991, 1992, Thomas G. Lane. All Rights Reserved except as specified below. Permission is hereby granted to use, copy, modify, and distribute this software (or portions thereof) for any purpose, without fee, subject to these conditions: (1) If any part of the source code for this software is distributed, then this README file must be included, with this copyright and no-warranty notice unaltered; and any additions, deletions, or changes to the original files must be clearly indicated in accompanying documentation. (2) If only executable code is distributed, then the accompanying documentation must state that "this software is based in part on the work of the Independent JPEG Group". (3) Permission for use of this software is granted only if the user accepts full responsibility for any undesirable consequences; the authors accept NO LIABILITY for damages of any kind. Permission is NOT granted for the use of any IJG author's name or company name in advertising or publicity relating to this software or products derived from it. This software may be referred to only as "the Independent JPEG Group's software". We specifically permit and encourage the use of this software as the basis of commercial products, provided that all warranty or liability claims are assumed by the product vendor. --------------------------------------------------------------------------- xmedcon-0.14.1/libs/ljpg/mcu.h0000644000175000017510000000167410157670126013013 00000000000000/* * mcu.h -- * * Part of the Independent JPEG Group's software. * See the file Copyright for more details. * */ /* * $Id: mcu.h,v 1.2 2004/12/14 22:59:34 enlf Exp $ */ #ifndef _MCU #define _MCU /* * An MCU (minimum coding unit) is an array of samples. */ typedef unsigned short ComponentType; /* the type of image components */ typedef ComponentType *MCU; /* MCU - array of samples */ extern MCU *mcuTable; /* the global mcu table that buffers the source image */ extern int numMCU; /* number of MCUs in mcuTable */ extern MCU *mcuROW1,*mcuROW2; /* pt to two rows of MCU in encoding & decoding */ /* *-------------------------------------------------------------- * * MakeMCU -- * * MakeMCU returns an MCU for input parsing. * * Results: * A new MCU * * Side effects: * None. * *-------------------------------------------------------------- */ #define MakeMCU(dcPtr) (mcuTable[numMCU++]) #endif /* _MCU */ xmedcon-0.14.1/libs/ljpg/predict.h0000644000175000017510000002277107552636563013676 00000000000000/* * predict.h -- * * Code for predictor calculation. Its function version, predictor.c, * is used in debugging compilation. */ /* * $Id: predict.h,v 1.1 2002/10/14 21:56:03 enlf Exp $ */ #ifndef _PREDICTOR #define _PREDICTOR #ifndef DEBUG /* *-------------------------------------------------------------- * * Predict -- * * Calculate the predictor for pixel[row][col][curComp], * i.e. curRowBuf[col][curComp]. It handles the all special * cases at image edges, such as first row and first column * of a scan. * * Results: * predictor is passed out. * * Side effects: * None. * *-------------------------------------------------------------- */ #define Predict(row,col,curComp,curRowBuf,prevRowBuf,Pr,Pt,psv,predictor) \ { register int left,upper,diag,leftcol; \ \ leftcol=col-1; \ if (row==0) { \ \ /* \ * The predictor of first pixel is (1<<(Pr-Pt-1), and the \ * predictors for rest of first row are left neighbors. \ */ \ if (col==0) { \ *predictor = (1<<(Pr-Pt-1)); \ } \ else { \ *predictor = curRowBuf[leftcol][curComp]; \ } \ } \ else { \ \ /* \ * The predictors of first column are upper neighbors. \ * All other preditors are calculated according to psv. \ */ \ upper=prevRowBuf[col][curComp]; \ if (col==0) \ *predictor = upper; \ else { \ left=curRowBuf[leftcol][curComp]; \ diag=prevRowBuf[leftcol][curComp]; \ switch (psv) { \ case 0: \ *predictor = 0; \ break; \ case 1: \ *predictor = left; \ break; \ case 2: \ *predictor = upper; \ break; \ case 3: \ *predictor = diag; \ break; \ case 4: \ *predictor = left+upper-diag; \ break; \ case 5: \ *predictor = left+((upper-diag)>>1); \ break; \ case 6: \ *predictor = upper+((left-diag)>>1); \ break; \ case 7: \ *predictor = (left+upper)>>1; \ break; \ default: \ fprintf(stderr,"Warning: Undefined PSV\n"); \ *predictor = 0; \ } \ } \ } \ } /* *-------------------------------------------------------------- * * QuickPredict -- * * Calculate the predictor for sample curRowBuf[col][curComp]. * It does not handle the special cases at image edges, such * as first row and first column of a scan. We put the special * case checkings outside so that the computations in main * loop can be simpler. This has enhenced the performance * significantly. * * Results: * predictor is passed out. * * Side effects: * None. * *-------------------------------------------------------------- */ #define QuickPredict(col,curComp,curRowBuf,prevRowBuf,psv,predictor){ \ register int left,upper,diag,leftcol; \ \ /* \ * All predictor are calculated according to psv. \ */ \ switch (psv) { \ case 0: \ *predictor = 0; \ break; \ case 1: \ *predictor = curRowBuf [col-1] [curComp]; \ break; \ case 2: \ *predictor = prevRowBuf[col][curComp]; \ break; \ case 3: \ *predictor = prevRowBuf [col-1] [curComp]; \ break; \ case 4: \ leftcol = col-1; \ upper = prevRowBuf[col][curComp]; \ left = curRowBuf[leftcol][curComp]; \ diag = prevRowBuf[leftcol][curComp]; \ *predictor = left + upper - diag; \ break; \ case 5: \ leftcol = col-1; \ upper = prevRowBuf[col][curComp]; \ left = curRowBuf[leftcol][curComp]; \ diag = prevRowBuf[leftcol][curComp]; \ *predictor = left+((upper-diag)>>1); \ break; \ case 6: \ leftcol = col-1; \ upper = prevRowBuf[col][curComp]; \ left = curRowBuf[leftcol][curComp]; \ diag = prevRowBuf[leftcol][curComp]; \ *predictor = upper+((left-diag)>>1); \ break; \ case 7: \ leftcol = col-1; \ upper = prevRowBuf[col][curComp]; \ left = curRowBuf[leftcol][curComp]; \ *predictor = (left+upper)>>1; \ break; \ default: \ fprintf(stderr,"Warning: Undefined PSV\n"); \ *predictor = 0; \ } \ } #endif /* DEBUG */ #endif /* _PREDICTOR */ xmedcon-0.14.1/libs/ljpg/COPYING.LIB0000644000175000017510000006365007552744114013524 00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. ^L Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. ^L GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. ^L Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. ^L 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. ^L 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. ^L 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. ^L 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS ^L How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! xmedcon-0.14.1/libs/ljpg/decomp.c0000644000175000017510000000463312162406144013462 00000000000000/* * decomp.c -- * * This is the routine that is called to decompress a frame * image data. It is based on the program originally named ljpgtopnm.c. * Major portions taken from the Independent JPEG Group' software, and * from the Cornell lossless JPEG code */ /* * $Id: decomp.c,v 1.6 2013/06/25 21:32:20 enlf Exp $ */ #include #include #include #include "io.h" #include "jpeg.h" #include "mcu.h" #include "proto.h" static DecompressInfo dcInfo; static StreamIN JpegInFile; /* *-------------------------------------------------------------- * * ReadJpegData -- * * This is an interface routine to the JPEG library. The * JPEG library calls this routine to "get more data" * * Results: * Number of bytes actually returned. * * Side effects: * None. * *-------------------------------------------------------------- */ static void efree(void **ptr) { if((*ptr) != 0) free((*ptr)); *ptr = 0; } int ReadJpegData (Uchar *buffer, int numBytes) { unsigned long size = sizeof(unsigned char); int r; r = fread(buffer,size,(unsigned)numBytes,JpegInFile); if (r != numBytes) return r; return numBytes; } short JPEGLosslessDecodeImage (StreamIN inFile, unsigned short *image16, int depth, int length) { /* Initialization */ JpegInFile = inFile; MEMSET (&dcInfo, 0, sizeof (dcInfo)); inputBufferOffset = 0; /* Allocate input buffer */ inputBuffer = (unsigned char*)malloc((size_t)length+5); if (inputBuffer == NULL) return -1; /* Read input buffer */ ReadJpegData (inputBuffer, length); inputBuffer [length] = (unsigned char)EOF; /* Read JPEG File header */ ReadFileHeader (&dcInfo); if (dcInfo.error) { efree ((void **)&inputBuffer); return -1; } /* Read the scan header */ if (!ReadScanHeader (&dcInfo)) { efree ((void **)&inputBuffer); return -1; } /* * Decode the image bits stream. Clean up everything when * finished decoding. */ DecoderStructInit (&dcInfo); if (dcInfo.error) { efree ((void **)&inputBuffer); return -1; } HuffDecoderInit (&dcInfo); if (dcInfo.error) { efree ((void **)&inputBuffer); return -1; } DecodeImage (&dcInfo, (unsigned short **) &image16, depth); /* Free input buffer */ efree ((void **)&inputBuffer); return 0; } xmedcon-0.14.1/libs/ljpg/io.h0000644000175000017510000000117707552636561012646 00000000000000/* * io.h -- * */ /* * $Id: io.h,v 1.1 2002/10/14 21:56:01 enlf Exp $ */ #ifndef _IO #define _IO #include "jpeg.h" /* * Size of the input and output buffer */ #define JPEG_BUF_SIZE 4096 /* * The following variables keep track of the input and output * buffer for the JPEG data. */ extern char outputBuffer[JPEG_BUF_SIZE]; /* output buffer */ extern int numOutputBytes; /* bytes in the output buffer */ extern Uchar *inputBuffer; /* Input buffer for JPEG data */ extern int inputBufferOffset; /* Offset of current byte */ #endif /* _IO */ xmedcon-0.14.1/libs/ljpg/jpeg.h0000644000175000017510000001115307552655615013160 00000000000000/* * jpeg.h * * Basic jpeg data structure definitions. */ /* * $Id: jpeg.h,v 1.2 2002/10/15 00:04:29 enlf Exp $ */ #ifndef _JPEG #define _JPEG typedef unsigned char Uchar; typedef unsigned short Ushort; typedef unsigned int Uint; typedef FILE * StreamIN ; /* * The following structure stores basic information about one component. */ typedef struct JpegComponentInfo { /* * These values are fixed over the whole image. * They are read from the SOF marker. */ short componentId; /* identifier for this component (0..255) */ short componentIndex; /* its index in SOF or cPtr->compInfo[] */ /* * Downsampling is not normally used in lossless JPEG, although * it is permitted by the JPEG standard (DIS). We set all sampling * factors to 1 in this program. */ short hSampFactor; /* horizontal sampling factor */ short vSampFactor; /* vertical sampling factor */ /* * Huffman table selector (0..3). The value may vary * between scans. It is read from the SOS marker. */ short dcTblNo; } JpegComponentInfo; /* * One of the following structures is created for each huffman coding * table. We use the same structure for encoding and decoding, so there * may be some extra fields for encoding that aren't used in the decoding * and vice-versa. */ typedef struct HuffmanTable { /* * These two fields directly represent the contents of a JPEG DHT * marker */ Uchar bits[17]; Uchar huffval[256]; /* * This field is used only during compression. It's initialized * FALSE when the table is created, and set TRUE when it's been * output to the file. */ int sentTable; /* * The remaining fields are computed from the above to allow more * efficient coding and decoding. These fields should be considered * private to the Huffman compression & decompression modules. */ Ushort ehufco[256]; char ehufsi[256]; Ushort mincode[17]; int maxcode[18]; short valptr[17]; int numbits[256]; int value[256]; } HuffmanTable; /* * One of the following structures is used to pass around the * compression information. */ /* * One of the following structures is used to pass around the * decompression information. */ typedef struct DecompressInfo { /* * Image width, height, and image data precision (bits/sample) * These fields are set by ReadFileHeader or ReadScanHeader */ int imageWidth; int imageHeight; int dataPrecision; /* * compInfo[i] describes component that appears i'th in SOF * numComponents is the # of color components in JPEG image. */ JpegComponentInfo compInfo[4]; short numComponents; /* * *curCompInfo[i] describes component that appears i'th in SOS. * compsInScan is the # of color components in current scan. */ JpegComponentInfo *curCompInfo[4]; short compsInScan; /* * MCUmembership[i] indexes the i'th component of MCU into the * curCompInfo array. */ short MCUmembership[10]; /* * ptrs to Huffman coding tables, or NULL if not defined */ HuffmanTable *dcHuffTblPtrs[4]; /* * prediction seletion value (PSV) and point transform parameter (Pt) */ int Ss; int Pt; /* * In lossless JPEG, restart interval shall be an integer * multiple of the number of MCU in a MCU row. */ int restartInterval;/* MCUs per restart interval, 0 = no restart */ int restartInRows; /*if > 0, MCU rows per restart interval; 0 = no restart*/ /* * these fields are private data for the entropy decoder */ int restartRowsToGo; /* MCUs rows left in this restart interval */ short nextRestartNum; /* # of next RSTn marker (0..7) */ int error; /* an ERROR flag */ } DecompressInfo; /* *-------------------------------------------------------------- * * swap -- * * Swap the contents stored in a and b. * "type" is the variable type of a and b. * * Results: * The values in a and b are swapped. * * Side effects: * None. * *-------------------------------------------------------------- */ #define swap(type,a,b) {type c; c=(a); (a)=(b); (b)=c;} #define MEMSET(s,c,n) memset((void *)(s),(int)(c),(int)(n)) #define MEMCPY(s1,s2,n) memcpy((void *)(s1),(void *)(s2),(int)(n)) /* * Lossless JPEG specifies data precision to be from 2 to 16 bits/sample. */ #define MinPrecisionBits 2 #define MaxPrecisionBits 16 #define MinPrecisionValue 2 #define MaxPrecisionValue 65535 #endif /* _JPEG */ xmedcon-0.14.1/libs/ljpg/jpegless.h0000644000175000017510000000310407552636562014044 00000000000000/* * JPEGLess.h * * --------------------------------------------------------------- * * Lossless JPEG compression and decompression algorithms. * * --------------------------------------------------------------- * * It is based on the program originally named ljpgtopnm and pnmtoljpg. * Major portions taken from the Independetn JPEG Group' software, and * from the Cornell lossless JPEG code (the original copyright notices * for those packages appears below). * * --------------------------------------------------------------- * * This is the main routine for the lossless JPEG decoder. Large * parts are stolen from the IJG code */ /* * $Id: jpegless.h,v 1.1 2002/10/14 21:56:02 enlf Exp $ */ #include "jpeg.h" #ifndef _JPEGLOSSLESS_ #define _JPEGLOSSLESS_ #if defined(__cplusplus) extern "C" { #endif /* Global variables for lossless encoding process */ int psvSet[7]; /* the PSV (prediction selection value) set */ int numSelValue; /* number of PSVs in psvSet */ long inputFileBytes; /* the input file size in bytes */ long outputFileBytes; /* the output file size in bytes */ long totalHuffSym[7]; /* total bits of category symbols for each PSV */ long totalAddBits[7]; /* total bits of additional bits for each PSV */ int verbose; /* the verbose flag */ /* * read a JPEG lossless (8 or 16 bit) image in a file and decode it */ short JPEGLosslessDecodeImage (StreamIN, unsigned short *, int , int); #if defined(__cplusplus) } #endif #endif /* _JPEGLOSSLESS_ */ xmedcon-0.14.1/libs/ljpg/Makefile.in0000644000175000017510000004701112637622763014127 00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = libs/ljpg DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp \ $(noinst_HEADERS) COPYING.LIB ChangeLog README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/source/m-depend.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libljpg_la_LIBADD = am_libljpg_la_OBJECTS = decomp.lo huffd.lo jpegutil.lo mcu.lo \ predict.lo read.lo libljpg_la_OBJECTS = $(am_libljpg_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/source depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libljpg_la_SOURCES) DIST_SOURCES = $(libljpg_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DECOMPRESS = @DECOMPRESS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_ACR = @ENABLE_ACR@ ENABLE_ANLZ = @ENABLE_ANLZ@ ENABLE_CONC = @ENABLE_CONC@ ENABLE_DICM = @ENABLE_DICM@ ENABLE_ECAT = @ENABLE_ECAT@ ENABLE_GIF = @ENABLE_GIF@ ENABLE_INTF = @ENABLE_INTF@ ENABLE_INW = @ENABLE_INW@ ENABLE_NIFTI = @ENABLE_NIFTI@ ENABLE_PNG = @ENABLE_PNG@ ENABLE_TPC = @ENABLE_TPC@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIBMDCETC = @GLIBMDCETC@ GLIBSUPPORTED = @GLIBSUPPORTED@ GREP = @GREP@ GTKONE = @GTKONE@ GTKSUPPORTED = @GTKSUPPORTED@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NIFTI_CFLAGS = @NIFTI_CFLAGS@ NIFTI_LDFLAGS = @NIFTI_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PNG_CFLAGS = @PNG_CFLAGS@ PNG_LDFLAGS = @PNG_LDFLAGS@ PNG_LIBS = @PNG_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TPC_CFLAGS = @TPC_CFLAGS@ TPC_LDFLAGS = @TPC_LDFLAGS@ VERSION = @VERSION@ XMDCETC = @XMDCETC@ XMEDCON_DATE = @XMEDCON_DATE@ XMEDCON_GLIB_CFLAGS = @XMEDCON_GLIB_CFLAGS@ XMEDCON_GLIB_LIBS = @XMEDCON_GLIB_LIBS@ XMEDCON_GTK_CFLAGS = @XMEDCON_GTK_CFLAGS@ XMEDCON_GTK_LIBS = @XMEDCON_GTK_LIBS@ XMEDCON_LIBVERS = @XMEDCON_LIBVERS@ XMEDCON_MAJOR = @XMEDCON_MAJOR@ XMEDCON_MICRO = @XMEDCON_MICRO@ XMEDCON_MINOR = @XMEDCON_MINOR@ XMEDCON_PRGR = @XMEDCON_PRGR@ XMEDCON_VERSION = @XMEDCON_VERSION@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LDFLAGS = @ZLIB_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_sizeof_int = @ac_cv_sizeof_int@ ac_cv_sizeof_long = @ac_cv_sizeof_long@ ac_cv_sizeof_long_long = @ac_cv_sizeof_long_long@ ac_cv_sizeof_short = @ac_cv_sizeof_short@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mdc_cv_bigendian = @mdc_cv_bigendian@ mdc_cv_enable_lnglng = @mdc_cv_enable_lnglng@ mdc_cv_glibsupport = @mdc_cv_glibsupport@ mdc_cv_gui = @mdc_cv_gui@ mdc_cv_include_acr = @mdc_cv_include_acr@ mdc_cv_include_anlz = @mdc_cv_include_anlz@ mdc_cv_include_conc = @mdc_cv_include_conc@ mdc_cv_include_dicm = @mdc_cv_include_dicm@ mdc_cv_include_ecat = @mdc_cv_include_ecat@ mdc_cv_include_gif = @mdc_cv_include_gif@ mdc_cv_include_intf = @mdc_cv_include_intf@ mdc_cv_include_inw = @mdc_cv_include_inw@ mdc_cv_include_nifti = @mdc_cv_include_nifti@ mdc_cv_include_png = @mdc_cv_include_png@ mdc_cv_include_tpc = @mdc_cv_include_tpc@ mdc_cv_ljpg = @mdc_cv_ljpg@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = gnu AM_CFLAGS = noinst_LTLIBRARIES = libljpg.la libljpg_la_SOURCES = \ decomp.c \ huffd.c \ jpegutil.c \ mcu.c \ predict.c \ read.c noinst_HEADERS = \ io.h \ jpeg.h \ jpegless.h \ mcu.h \ predict.h \ proto.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libs/ljpg/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu libs/ljpg/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libljpg.la: $(libljpg_la_OBJECTS) $(libljpg_la_DEPENDENCIES) $(EXTRA_libljpg_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(libljpg_la_OBJECTS) $(libljpg_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decomp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/huffd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jpegutil.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mcu.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/predict.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xmedcon-0.14.1/libs/ljpg/proto.h0000644000175000017510000000252607773653571013406 00000000000000/* * proto.h -- * * Part of the Independent JPEG Group's software. * See the file Copyright for more details. */ /* * $Id: proto.h,v 1.3 2003/12/28 22:21:45 enlf Exp $ */ #ifndef _PROTO #define _PROTO #ifdef __STDC__ # define P(s) s #else # define P(s) () #endif #include "mcu.h" /* huffd.c */ void HuffDecoderInit P((DecompressInfo *dcPtr )); void DecodeImage P((DecompressInfo *dcPtr, unsigned short **image, int depth)); void FixHuffTbl (HuffmanTable *htbl); void PmPutRow24(MCU *RowBuf, int numCol, unsigned char **image); void PmPutRow16(MCU *RowBuf, int numCol, unsigned short **image); void PmPutRow8(MCU *RowBuf, int numCol, unsigned char **image); void DecodeFirstRow (DecompressInfo *dcPtr, MCU *curRowBuf); /* decomp.c */ int ReadJpegData P((Uchar *buffer , int numBytes)); short JPEGLosslessDecodeImage (StreamIN inFile, unsigned short *image16, int depth, int length); /* read.c */ void ReadFileHeader P((DecompressInfo *dcPtr )); int ReadScanHeader P((DecompressInfo *dcPtr )); int GetJpegChar(void); void UnGetJpegChar(int ch); /* util.c */ int JroundUp P((int a , int b )); void DecoderStructInit P((DecompressInfo *dcPtr )); /* mcu.c */ void InitMcuTable P((int numMCU , int blocksInMCU )); void FreeMcuTable(void); void PrintMCU P((int blocksInMCU , MCU mcu )); #undef P #endif /* _PROTO */ xmedcon-0.14.1/libs/nifti/0000755000175000017510000000000012637632716012313 500000000000000xmedcon-0.14.1/libs/nifti/Makefile.am0000644000175000017510000000214310674053467014266 00000000000000## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## filename: Makefile.am ## ## ## ## UTIL Make : Medical Image Conversion Utility ## ## ## ## purpose : NIfTI subdir Makefile template (automake) ## ## ## ## project : (X)MedCon by Erik Nolf ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## $Id: Makefile.am,v 1.2 2007/09/18 22:54:47 enlf Exp $ AUTOMAKE_OPTIONS = gnu AM_CFLAGS = @ZLIB_CFLAGS@ noinst_LTLIBRARIES = libznz.la libniftiio.la libznz_la_SOURCES = znzlib.c libznz_la_LDFLAGS = @ZLIB_LDFLAGS@ libniftiio_la_SOURCES = nifti1_io.c libniftiio_la_LDFLAGS = @ZLIB_LDFLAGS@ noinst_HEADERS = znzlib.h nifti1.h nifti1_io.h xmedcon-0.14.1/libs/nifti/ChangeLog0000644000175000017510000000000011152103414013746 00000000000000xmedcon-0.14.1/libs/nifti/README0000644000175000017510000000256311436274141013107 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: README # # # # UTILITY text: Medical Image Conversion Utility # # # # purpose : the NIfTI 'you-should-read' file # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: README,v 1.5 2010/08/28 20:58:09 enlf Exp $ Nifti-1 C libraries ------------------- Version 2.0.0 beta release Jul 2010 Version 1.1.0 beta release Aug 2008 Version 1.0.0 beta release Dec 2007 Version 0.6 beta release Aug 2007 Version 0.5 beta release May 2007 Version 0.4 beta release Sept. 2006 Version 0.3 beta release April 2006 Version 0.2 beta release August 12, 2005 Version 0.1 beta release March 11, 2005 niftilib code is released into the public domain. For more information -------------------- See the niftilib webpage at http://niftilib.sourceforge.net/ See the NIFTI webpage at http://nifti.nimh.nih.gov/ xmedcon-0.14.1/libs/nifti/znzlib.h0000644000175000017510000000572410673313046013712 00000000000000#ifndef _ZNZLIB_H_ #define _ZNZLIB_H_ /* znzlib.h (zipped or non-zipped library) ***** This code is released to the public domain. ***** ***** Author: Mark Jenkinson, FMRIB Centre, University of Oxford ***** ***** Date: September 2004 ***** ***** Neither the FMRIB Centre, the University of Oxford, nor any of ***** ***** its employees imply any warranty of usefulness of this software ***** ***** for any purpose, and do not assume any liability for damages, ***** ***** incidental or otherwise, caused by any use of this document. ***** */ /* This library provides an interface to both compressed (gzip/zlib) and uncompressed (normal) file IO. The functions are written to have the same interface as the standard file IO functions. To use this library instead of normal file IO, the following changes are required: - replace all instances of FILE* with znzFile - change the name of all function calls, replacing the initial character f with the znz (e.g. fseek becomes znzseek) - add a third parameter to all calls to znzopen (previously fopen) that specifies whether to use compression (1) or not (0) - use znz_isnull rather than any (pointer == NULL) comparisons in the code NB: seeks for writable files with compression are quite restricted */ /*=================*/ #ifdef __cplusplus extern "C" { #endif /*=================*/ #include #include #include #include /* include optional check for HAVE_FDOPEN here, from deleted config.h: uncomment the following line if fdopen() exists for your compiler and compiler options */ /* #define HAVE_FDOPEN */ #ifdef HAVE_ZLIB #if defined(ITKZLIB) #include "itk_zlib.h" #else #include "zlib.h" #endif #endif struct znzptr { int withz; FILE* nzfptr; #ifdef HAVE_ZLIB gzFile zfptr; #endif } ; /* the type for all file pointers */ typedef struct znzptr * znzFile; /* int znz_isnull(znzFile f); */ /* int znzclose(znzFile f); */ #define znz_isnull(f) ((f) == NULL) #define znzclose(f) Xznzclose(&(f)) /* Note extra argument (use_compression) where use_compression==0 is no compression use_compression!=0 uses zlib (gzip) compression */ znzFile znzopen(const char *path, const char *mode, int use_compression); znzFile znzdopen(int fd, const char *mode, int use_compression); int Xznzclose(znzFile * file); size_t znzread(void* buf, size_t size, size_t nmemb, znzFile file); size_t znzwrite(const void* buf, size_t size, size_t nmemb, znzFile file); long znzseek(znzFile file, long offset, int whence); int znzrewind(znzFile stream); long znztell(znzFile file); int znzputs(const char *str, znzFile file); char * znzgets(char* str, int size, znzFile file); int znzputc(int c, znzFile file); int znzgetc(znzFile file); #if !defined(WIN32) int znzprintf(znzFile stream, const char *format, ...); #endif /*=================*/ #ifdef __cplusplus } #endif /*=================*/ #endif xmedcon-0.14.1/libs/nifti/nifti1.h0000644000175000017510000020716410745732327013605 00000000000000/** \file nifti1.h \brief Official definition of the nifti1 header. Written by Bob Cox, SSCC, NIMH. HISTORY: 29 Nov 2007 [rickr] - added DT_RGBA32 and NIFTI_TYPE_RGBA32 - added NIFTI_INTENT codes: TIME_SERIES, NODE_INDEX, RGB_VECTOR, RGBA_VECTOR, SHAPE */ #ifndef _NIFTI_HEADER_ #define _NIFTI_HEADER_ /***************************************************************************** ** This file defines the "NIFTI-1" header format. ** ** It is derived from 2 meetings at the NIH (31 Mar 2003 and ** ** 02 Sep 2003) of the Data Format Working Group (DFWG), ** ** chartered by the NIfTI (Neuroimaging Informatics Technology ** ** Initiative) at the National Institutes of Health (NIH). ** **--------------------------------------------------------------** ** Neither the National Institutes of Health (NIH), the DFWG, ** ** nor any of the members or employees of these institutions ** ** imply any warranty of usefulness of this material for any ** ** purpose, and do not assume any liability for damages, ** ** incidental or otherwise, caused by any use of this document. ** ** If these conditions are not acceptable, do not use this! ** **--------------------------------------------------------------** ** Author: Robert W Cox (NIMH, Bethesda) ** ** Advisors: John Ashburner (FIL, London), ** ** Stephen Smith (FMRIB, Oxford), ** ** Mark Jenkinson (FMRIB, Oxford) ** ******************************************************************************/ /*---------------------------------------------------------------------------*/ /* Note that the ANALYZE 7.5 file header (dbh.h) is (c) Copyright 1986-1995 Biomedical Imaging Resource Mayo Foundation Incorporation of components of dbh.h are by permission of the Mayo Foundation. Changes from the ANALYZE 7.5 file header in this file are released to the public domain, including the functional comments and any amusing asides. -----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /*! INTRODUCTION TO NIFTI-1: ------------------------ The twin (and somewhat conflicting) goals of this modified ANALYZE 7.5 format are: (a) To add information to the header that will be useful for functional neuroimaging data analysis and display. These additions include: - More basic data types. - Two affine transformations to specify voxel coordinates. - "Intent" codes and parameters to describe the meaning of the data. - Affine scaling of the stored data values to their "true" values. - Optional storage of the header and image data in one file (.nii). (b) To maintain compatibility with non-NIFTI-aware ANALYZE 7.5 compatible software (i.e., such a program should be able to do something useful with a NIFTI-1 dataset -- at least, with one stored in a traditional .img/.hdr file pair). Most of the unused fields in the ANALYZE 7.5 header have been taken, and some of the lesser-used fields have been co-opted for other purposes. Notably, most of the data_history substructure has been co-opted for other purposes, since the ANALYZE 7.5 format describes this substructure as "not required". NIFTI-1 FLAG (MAGIC STRINGS): ---------------------------- To flag such a struct as being conformant to the NIFTI-1 spec, the last 4 bytes of the header must be either the C String "ni1" or "n+1"; in hexadecimal, the 4 bytes 6E 69 31 00 or 6E 2B 31 00 (in any future version of this format, the '1' will be upgraded to '2', etc.). Normally, such a "magic number" or flag goes at the start of the file, but trying to avoid clobbering widely-used ANALYZE 7.5 fields led to putting this marker last. However, recall that "the last shall be first" (Matthew 20:16). If a NIFTI-aware program reads a header file that is NOT marked with a NIFTI magic string, then it should treat the header as an ANALYZE 7.5 structure. NIFTI-1 FILE STORAGE: -------------------- "ni1" means that the image data is stored in the ".img" file corresponding to the header file (starting at file offset 0). "n+1" means that the image data is stored in the same file as the header information. We recommend that the combined header+data filename suffix be ".nii". When the dataset is stored in one file, the first byte of image data is stored at byte location (int)vox_offset in this combined file. The minimum allowed value of vox_offset is 352; for compatibility with some software, vox_offset should be an integral multiple of 16. GRACE UNDER FIRE: ---------------- Most NIFTI-aware programs will only be able to handle a subset of the full range of datasets possible with this format. All NIFTI-aware programs should take care to check if an input dataset conforms to the program's needs and expectations (e.g., check datatype, intent_code, etc.). If the input dataset can't be handled by the program, the program should fail gracefully (e.g., print a useful warning; not crash). SAMPLE CODES: ------------ The associated files nifti1_io.h and nifti1_io.c provide a sample implementation in C of a set of functions to read, write, and manipulate NIFTI-1 files. The file nifti1_test.c is a sample program that uses the nifti1_io.c functions. -----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* HEADER STRUCT DECLARATION: ------------------------- In the comments below for each field, only NIFTI-1 specific requirements or changes from the ANALYZE 7.5 format are described. For convenience, the 348 byte header is described as a single struct, rather than as the ANALYZE 7.5 group of 3 substructs. Further comments about the interpretation of various elements of this header are after the data type definition itself. Fields that are marked as ++UNUSED++ have no particular interpretation in this standard. (Also see the UNUSED FIELDS comment section, far below.) The presumption below is that the various C types have particular sizes: sizeof(int) = sizeof(float) = 4 ; sizeof(short) = 2 -----------------------------------------------------------------------------*/ /*=================*/ #ifdef __cplusplus extern "C" { #endif /*=================*/ /*! \struct nifti_1_header \brief Data structure defining the fields in the nifti1 header. This binary header should be found at the beginning of a valid NIFTI-1 header file. */ /*************************/ /************************/ struct nifti_1_header { /* NIFTI-1 usage */ /* ANALYZE 7.5 field(s) */ /*************************/ /************************/ /*--- was header_key substruct ---*/ int sizeof_hdr; /*!< MUST be 348 */ /* int sizeof_hdr; */ char data_type[10]; /*!< ++UNUSED++ */ /* char data_type[10]; */ char db_name[18]; /*!< ++UNUSED++ */ /* char db_name[18]; */ int extents; /*!< ++UNUSED++ */ /* int extents; */ short session_error; /*!< ++UNUSED++ */ /* short session_error; */ char regular; /*!< ++UNUSED++ */ /* char regular; */ char dim_info; /*!< MRI slice ordering. */ /* char hkey_un0; */ /*--- was image_dimension substruct ---*/ short dim[8]; /*!< Data array dimensions.*/ /* short dim[8]; */ float intent_p1 ; /*!< 1st intent parameter. */ /* short unused8; */ /* short unused9; */ float intent_p2 ; /*!< 2nd intent parameter. */ /* short unused10; */ /* short unused11; */ float intent_p3 ; /*!< 3rd intent parameter. */ /* short unused12; */ /* short unused13; */ short intent_code ; /*!< NIFTI_INTENT_* code. */ /* short unused14; */ short datatype; /*!< Defines data type! */ /* short datatype; */ short bitpix; /*!< Number bits/voxel. */ /* short bitpix; */ short slice_start; /*!< First slice index. */ /* short dim_un0; */ float pixdim[8]; /*!< Grid spacings. */ /* float pixdim[8]; */ float vox_offset; /*!< Offset into .nii file */ /* float vox_offset; */ float scl_slope ; /*!< Data scaling: slope. */ /* float funused1; */ float scl_inter ; /*!< Data scaling: offset. */ /* float funused2; */ short slice_end; /*!< Last slice index. */ /* float funused3; */ char slice_code ; /*!< Slice timing order. */ char xyzt_units ; /*!< Units of pixdim[1..4] */ float cal_max; /*!< Max display intensity */ /* float cal_max; */ float cal_min; /*!< Min display intensity */ /* float cal_min; */ float slice_duration;/*!< Time for 1 slice. */ /* float compressed; */ float toffset; /*!< Time axis shift. */ /* float verified; */ int glmax; /*!< ++UNUSED++ */ /* int glmax; */ int glmin; /*!< ++UNUSED++ */ /* int glmin; */ /*--- was data_history substruct ---*/ char descrip[80]; /*!< any text you like. */ /* char descrip[80]; */ char aux_file[24]; /*!< auxiliary filename. */ /* char aux_file[24]; */ short qform_code ; /*!< NIFTI_XFORM_* code. */ /*-- all ANALYZE 7.5 ---*/ short sform_code ; /*!< NIFTI_XFORM_* code. */ /* fields below here */ /* are replaced */ float quatern_b ; /*!< Quaternion b param. */ float quatern_c ; /*!< Quaternion c param. */ float quatern_d ; /*!< Quaternion d param. */ float qoffset_x ; /*!< Quaternion x shift. */ float qoffset_y ; /*!< Quaternion y shift. */ float qoffset_z ; /*!< Quaternion z shift. */ float srow_x[4] ; /*!< 1st row affine transform. */ float srow_y[4] ; /*!< 2nd row affine transform. */ float srow_z[4] ; /*!< 3rd row affine transform. */ char intent_name[16];/*!< 'name' or meaning of data. */ char magic[4] ; /*!< MUST be "ni1\0" or "n+1\0". */ } ; /**** 348 bytes total ****/ typedef struct nifti_1_header nifti_1_header ; /*---------------------------------------------------------------------------*/ /* HEADER EXTENSIONS: ----------------- After the end of the 348 byte header (e.g., after the magic field), the next 4 bytes are a char array field named "extension". By default, all 4 bytes of this array should be set to zero. In a .nii file, these 4 bytes will always be present, since the earliest start point for the image data is byte #352. In a separate .hdr file, these bytes may or may not be present. If not present (i.e., if the length of the .hdr file is 348 bytes), then a NIfTI-1 compliant program should use the default value of extension={0,0,0,0}. The first byte (extension[0]) is the only value of this array that is specified at present. The other 3 bytes are reserved for future use. If extension[0] is nonzero, it indicates that extended header information is present in the bytes following the extension array. In a .nii file, this extended header data is before the image data (and vox_offset must be set correctly to allow for this). In a .hdr file, this extended data follows extension and proceeds (potentially) to the end of the file. The format of extended header data is weakly specified. Each extension must be an integer multiple of 16 bytes long. The first 8 bytes of each extension comprise 2 integers: int esize , ecode ; These values may need to be byte-swapped, as indicated by dim[0] for the rest of the header. * esize is the number of bytes that form the extended header data + esize must be a positive integral multiple of 16 + this length includes the 8 bytes of esize and ecode themselves * ecode is a non-negative integer that indicates the format of the extended header data that follows + different ecode values are assigned to different developer groups + at present, the "registered" values for code are = 0 = unknown private format (not recommended!) = 2 = DICOM format (i.e., attribute tags and values) = 4 = AFNI group (i.e., ASCII XML-ish elements) In the interests of interoperability (a primary rationale for NIfTI), groups developing software that uses this extension mechanism are encouraged to document and publicize the format of their extensions. To this end, the NIfTI DFWG will assign even numbered codes upon request to groups submitting at least rudimentary documentation for the format of their extension; at present, the contact is mailto:rwcox@nih.gov. The assigned codes and documentation will be posted on the NIfTI website. All odd values of ecode (and 0) will remain unassigned; at least, until the even ones are used up, when we get to 2,147,483,646. Note that the other contents of the extended header data section are totally unspecified by the NIfTI-1 standard. In particular, if binary data is stored in such a section, its byte order is not necessarily the same as that given by examining dim[0]; it is incumbent on the programs dealing with such data to determine the byte order of binary extended header data. Multiple extended header sections are allowed, each starting with an esize,ecode value pair. The first esize value, as described above, is at bytes #352-355 in the .hdr or .nii file (files start at byte #0). If this value is positive, then the second (esize2) will be found starting at byte #352+esize1 , the third (esize3) at byte #352+esize1+esize2, et cetera. Of course, in a .nii file, the value of vox_offset must be compatible with these extensions. If a malformed file indicates that an extended header data section would run past vox_offset, then the entire extended header section should be ignored. In a .hdr file, if an extended header data section would run past the end-of-file, that extended header data should also be ignored. With the above scheme, a program can successively examine the esize and ecode values, and skip over each extended header section if the program doesn't know how to interpret the data within. Of course, any program can simply ignore all extended header sections simply by jumping straight to the image data using vox_offset. -----------------------------------------------------------------------------*/ /*! \struct nifti1_extender \brief This structure represents a 4-byte string that should follow the binary nifti_1_header data in a NIFTI-1 header file. If the char values are {1,0,0,0}, the file is expected to contain extensions, values of {0,0,0,0} imply the file does not contain extensions. Other sequences of values are not currently defined. */ struct nifti1_extender { char extension[4] ; } ; typedef struct nifti1_extender nifti1_extender ; /*! \struct nifti1_extension \brief Data structure defining the fields of a header extension. */ struct nifti1_extension { int esize ; /*!< size of extension, in bytes (must be multiple of 16) */ int ecode ; /*!< extension code, one of the NIFTI_ECODE_ values */ char * edata ; /*!< raw data, with no byte swapping (length is esize-8) */ } ; typedef struct nifti1_extension nifti1_extension ; /*---------------------------------------------------------------------------*/ /* DATA DIMENSIONALITY (as in ANALYZE 7.5): --------------------------------------- dim[0] = number of dimensions; - if dim[0] is outside range 1..7, then the header information needs to be byte swapped appropriately - ANALYZE supports dim[0] up to 7, but NIFTI-1 reserves dimensions 1,2,3 for space (x,y,z), 4 for time (t), and 5,6,7 for anything else needed. dim[i] = length of dimension #i, for i=1..dim[0] (must be positive) - also see the discussion of intent_code, far below pixdim[i] = voxel width along dimension #i, i=1..dim[0] (positive) - cf. ORIENTATION section below for use of pixdim[0] - the units of pixdim can be specified with the xyzt_units field (also described far below). Number of bits per voxel value is in bitpix, which MUST correspond with the datatype field. The total number of bytes in the image data is dim[1] * ... * dim[dim[0]] * bitpix / 8 In NIFTI-1 files, dimensions 1,2,3 are for space, dimension 4 is for time, and dimension 5 is for storing multiple values at each spatiotemporal voxel. Some examples: - A typical whole-brain FMRI experiment's time series: - dim[0] = 4 - dim[1] = 64 pixdim[1] = 3.75 xyzt_units = NIFTI_UNITS_MM - dim[2] = 64 pixdim[2] = 3.75 | NIFTI_UNITS_SEC - dim[3] = 20 pixdim[3] = 5.0 - dim[4] = 120 pixdim[4] = 2.0 - A typical T1-weighted anatomical volume: - dim[0] = 3 - dim[1] = 256 pixdim[1] = 1.0 xyzt_units = NIFTI_UNITS_MM - dim[2] = 256 pixdim[2] = 1.0 - dim[3] = 128 pixdim[3] = 1.1 - A single slice EPI time series: - dim[0] = 4 - dim[1] = 64 pixdim[1] = 3.75 xyzt_units = NIFTI_UNITS_MM - dim[2] = 64 pixdim[2] = 3.75 | NIFTI_UNITS_SEC - dim[3] = 1 pixdim[3] = 5.0 - dim[4] = 1200 pixdim[4] = 0.2 - A 3-vector stored at each point in a 3D volume: - dim[0] = 5 - dim[1] = 256 pixdim[1] = 1.0 xyzt_units = NIFTI_UNITS_MM - dim[2] = 256 pixdim[2] = 1.0 - dim[3] = 128 pixdim[3] = 1.1 - dim[4] = 1 pixdim[4] = 0.0 - dim[5] = 3 intent_code = NIFTI_INTENT_VECTOR - A single time series with a 3x3 matrix at each point: - dim[0] = 5 - dim[1] = 1 xyzt_units = NIFTI_UNITS_SEC - dim[2] = 1 - dim[3] = 1 - dim[4] = 1200 pixdim[4] = 0.2 - dim[5] = 9 intent_code = NIFTI_INTENT_GENMATRIX - intent_p1 = intent_p2 = 3.0 (indicates matrix dimensions) -----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* DATA STORAGE: ------------ If the magic field is "n+1", then the voxel data is stored in the same file as the header. In this case, the voxel data starts at offset (int)vox_offset into the header file. Thus, vox_offset=352.0 means that the data starts immediately after the NIFTI-1 header. If vox_offset is greater than 352, the NIFTI-1 format does not say much about the contents of the dataset file between the end of the header and the start of the data. FILES: ----- If the magic field is "ni1", then the voxel data is stored in the associated ".img" file, starting at offset 0 (i.e., vox_offset is not used in this case, and should be set to 0.0). When storing NIFTI-1 datasets in pairs of files, it is customary to name the files in the pattern "name.hdr" and "name.img", as in ANALYZE 7.5. When storing in a single file ("n+1"), the file name should be in the form "name.nii" (the ".nft" and ".nif" suffixes are already taken; cf. http://www.icdatamaster.com/n.html ). BYTE ORDERING: ------------- The byte order of the data arrays is presumed to be the same as the byte order of the header (which is determined by examining dim[0]). Floating point types are presumed to be stored in IEEE-754 format. -----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* DETAILS ABOUT vox_offset: ------------------------ In a .nii file, the vox_offset field value is interpreted as the start location of the image data bytes in that file. In a .hdr/.img file pair, the vox_offset field value is the start location of the image data bytes in the .img file. * If vox_offset is less than 352 in a .nii file, it is equivalent to 352 (i.e., image data never starts before byte #352 in a .nii file). * The default value for vox_offset in a .nii file is 352. * In a .hdr file, the default value for vox_offset is 0. * vox_offset should be an integer multiple of 16; otherwise, some programs may not work properly (e.g., SPM). This is to allow memory-mapped input to be properly byte-aligned. Note that since vox_offset is an IEEE-754 32 bit float (for compatibility with the ANALYZE-7.5 format), it effectively has a 24 bit mantissa. All integers from 0 to 2^24 can be represented exactly in this format, but not all larger integers are exactly storable as IEEE-754 32 bit floats. However, unless you plan to have vox_offset be potentially larger than 16 MB, this should not be an issue. (Actually, any integral multiple of 16 up to 2^27 can be represented exactly in this format, which allows for up to 128 MB of random information before the image data. If that isn't enough, then perhaps this format isn't right for you.) In a .img file (i.e., image data stored separately from the NIfTI-1 header), data bytes between #0 and #vox_offset-1 (inclusive) are completely undefined and unregulated by the NIfTI-1 standard. One potential use of having vox_offset > 0 in the .hdr/.img file pair storage method is to make the .img file be a copy of (or link to) a pre-existing image file in some other format, such as DICOM; then vox_offset would be set to the offset of the image data in this file. (It may not be possible to follow the "multiple-of-16 rule" with an arbitrary external file; using the NIfTI-1 format in such a case may lead to a file that is incompatible with software that relies on vox_offset being a multiple of 16.) In a .nii file, data bytes between #348 and #vox_offset-1 (inclusive) may be used to store user-defined extra information; similarly, in a .hdr file, any data bytes after byte #347 are available for user-defined extra information. The (very weak) regulation of this extra header data is described elsewhere. -----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* DATA SCALING: ------------ If the scl_slope field is nonzero, then each voxel value in the dataset should be scaled as y = scl_slope * x + scl_inter where x = voxel value stored y = "true" voxel value Normally, we would expect this scaling to be used to store "true" floating values in a smaller integer datatype, but that is not required. That is, it is legal to use scaling even if the datatype is a float type (crazy, perhaps, but legal). - However, the scaling is to be ignored if datatype is DT_RGB24. - If datatype is a complex type, then the scaling is to be applied to both the real and imaginary parts. The cal_min and cal_max fields (if nonzero) are used for mapping (possibly scaled) dataset values to display colors: - Minimum display intensity (black) corresponds to dataset value cal_min. - Maximum display intensity (white) corresponds to dataset value cal_max. - Dataset values below cal_min should display as black also, and values above cal_max as white. - Colors "black" and "white", of course, may refer to any scalar display scheme (e.g., a color lookup table specified via aux_file). - cal_min and cal_max only make sense when applied to scalar-valued datasets (i.e., dim[0] < 5 or dim[5] = 1). -----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* TYPE OF DATA (acceptable values for datatype field): --------------------------------------------------- Values of datatype smaller than 256 are ANALYZE 7.5 compatible. Larger values are NIFTI-1 additions. These are all multiples of 256, so that no bits below position 8 are set in datatype. But there is no need to use only powers-of-2, as the original ANALYZE 7.5 datatype codes do. The additional codes are intended to include a complete list of basic scalar types, including signed and unsigned integers from 8 to 64 bits, floats from 32 to 128 bits, and complex (float pairs) from 64 to 256 bits. Note that most programs will support only a few of these datatypes! A NIFTI-1 program should fail gracefully (e.g., print a warning message) when it encounters a dataset with a type it doesn't like. -----------------------------------------------------------------------------*/ #undef DT_UNKNOWN /* defined in dirent.h on some Unix systems */ /*! \defgroup NIFTI1_DATATYPES \brief nifti1 datatype codes @{ */ /*--- the original ANALYZE 7.5 type codes ---*/ #define DT_NONE 0 #define DT_UNKNOWN 0 /* what it says, dude */ #define DT_BINARY 1 /* binary (1 bit/voxel) */ #define DT_UNSIGNED_CHAR 2 /* unsigned char (8 bits/voxel) */ #define DT_SIGNED_SHORT 4 /* signed short (16 bits/voxel) */ #define DT_SIGNED_INT 8 /* signed int (32 bits/voxel) */ #define DT_FLOAT 16 /* float (32 bits/voxel) */ #define DT_COMPLEX 32 /* complex (64 bits/voxel) */ #define DT_DOUBLE 64 /* double (64 bits/voxel) */ #define DT_RGB 128 /* RGB triple (24 bits/voxel) */ #define DT_ALL 255 /* not very useful (?) */ /*----- another set of names for the same ---*/ #define DT_UINT8 2 #define DT_INT16 4 #define DT_INT32 8 #define DT_FLOAT32 16 #define DT_COMPLEX64 32 #define DT_FLOAT64 64 #define DT_RGB24 128 /*------------------- new codes for NIFTI ---*/ #define DT_INT8 256 /* signed char (8 bits) */ #define DT_UINT16 512 /* unsigned short (16 bits) */ #define DT_UINT32 768 /* unsigned int (32 bits) */ #define DT_INT64 1024 /* long long (64 bits) */ #define DT_UINT64 1280 /* unsigned long long (64 bits) */ #define DT_FLOAT128 1536 /* long double (128 bits) */ #define DT_COMPLEX128 1792 /* double pair (128 bits) */ #define DT_COMPLEX256 2048 /* long double pair (256 bits) */ #define DT_RGBA32 2304 /* 4 byte RGBA (32 bits/voxel) */ /* @} */ /*------- aliases for all the above codes ---*/ /*! \defgroup NIFTI1_DATATYPE_ALIASES \brief aliases for the nifti1 datatype codes @{ */ /*! unsigned char. */ #define NIFTI_TYPE_UINT8 2 /*! signed short. */ #define NIFTI_TYPE_INT16 4 /*! signed int. */ #define NIFTI_TYPE_INT32 8 /*! 32 bit float. */ #define NIFTI_TYPE_FLOAT32 16 /*! 64 bit complex = 2 32 bit floats. */ #define NIFTI_TYPE_COMPLEX64 32 /*! 64 bit float = double. */ #define NIFTI_TYPE_FLOAT64 64 /*! 3 8 bit bytes. */ #define NIFTI_TYPE_RGB24 128 /*! signed char. */ #define NIFTI_TYPE_INT8 256 /*! unsigned short. */ #define NIFTI_TYPE_UINT16 512 /*! unsigned int. */ #define NIFTI_TYPE_UINT32 768 /*! signed long long. */ #define NIFTI_TYPE_INT64 1024 /*! unsigned long long. */ #define NIFTI_TYPE_UINT64 1280 /*! 128 bit float = long double. */ #define NIFTI_TYPE_FLOAT128 1536 /*! 128 bit complex = 2 64 bit floats. */ #define NIFTI_TYPE_COMPLEX128 1792 /*! 256 bit complex = 2 128 bit floats */ #define NIFTI_TYPE_COMPLEX256 2048 /*! 4 8 bit bytes. */ #define NIFTI_TYPE_RGBA32 2304 /* @} */ /*-------- sample typedefs for complicated types ---*/ #if 0 typedef struct { float r,i; } complex_float ; typedef struct { double r,i; } complex_double ; typedef struct { long double r,i; } complex_longdouble ; typedef struct { unsigned char r,g,b; } rgb_byte ; #endif /*---------------------------------------------------------------------------*/ /* INTERPRETATION OF VOXEL DATA: ---------------------------- The intent_code field can be used to indicate that the voxel data has some particular meaning. In particular, a large number of codes is given to indicate that the the voxel data should be interpreted as being drawn from a given probability distribution. VECTOR-VALUED DATASETS: ---------------------- The 5th dimension of the dataset, if present (i.e., dim[0]=5 and dim[5] > 1), contains multiple values (e.g., a vector) to be stored at each spatiotemporal location. For example, the header values - dim[0] = 5 - dim[1] = 64 - dim[2] = 64 - dim[3] = 20 - dim[4] = 1 (indicates no time axis) - dim[5] = 3 - datatype = DT_FLOAT - intent_code = NIFTI_INTENT_VECTOR mean that this dataset should be interpreted as a 3D volume (64x64x20), with a 3-vector of floats defined at each point in the 3D grid. A program reading a dataset with a 5th dimension may want to reformat the image data to store each voxels' set of values together in a struct or array. This programming detail, however, is beyond the scope of the NIFTI-1 file specification! Uses of dimensions 6 and 7 are also not specified here. STATISTICAL PARAMETRIC DATASETS (i.e., SPMs): -------------------------------------------- Values of intent_code from NIFTI_FIRST_STATCODE to NIFTI_LAST_STATCODE (inclusive) indicate that the numbers in the dataset should be interpreted as being drawn from a given distribution. Most such distributions have auxiliary parameters (e.g., NIFTI_INTENT_TTEST has 1 DOF parameter). If the dataset DOES NOT have a 5th dimension, then the auxiliary parameters are the same for each voxel, and are given in header fields intent_p1, intent_p2, and intent_p3. If the dataset DOES have a 5th dimension, then the auxiliary parameters are different for each voxel. For example, the header values - dim[0] = 5 - dim[1] = 128 - dim[2] = 128 - dim[3] = 1 (indicates a single slice) - dim[4] = 1 (indicates no time axis) - dim[5] = 2 - datatype = DT_FLOAT - intent_code = NIFTI_INTENT_TTEST mean that this is a 2D dataset (128x128) of t-statistics, with the t-statistic being in the first "plane" of data and the degrees-of-freedom parameter being in the second "plane" of data. If the dataset 5th dimension is used to store the voxel-wise statistical parameters, then dim[5] must be 1 plus the number of parameters required by that distribution (e.g., intent_code=NIFTI_INTENT_TTEST implies dim[5] must be 2, as in the example just above). Note: intent_code values 2..10 are compatible with AFNI 1.5x (which is why there is no code with value=1, which is obsolescent in AFNI). OTHER INTENTIONS: ---------------- The purpose of the intent_* fields is to help interpret the values stored in the dataset. Some non-statistical values for intent_code and conventions are provided for storing other complex data types. The intent_name field provides space for a 15 character (plus 0 byte) 'name' string for the type of data stored. Examples: - intent_code = NIFTI_INTENT_ESTIMATE; intent_name = "T1"; could be used to signify that the voxel values are estimates of the NMR parameter T1. - intent_code = NIFTI_INTENT_TTEST; intent_name = "House"; could be used to signify that the voxel values are t-statistics for the significance of 'activation' response to a House stimulus. - intent_code = NIFTI_INTENT_DISPVECT; intent_name = "ToMNI152"; could be used to signify that the voxel values are a displacement vector that transforms each voxel (x,y,z) location to the corresponding location in the MNI152 standard brain. - intent_code = NIFTI_INTENT_SYMMATRIX; intent_name = "DTI"; could be used to signify that the voxel values comprise a diffusion tensor image. If no data name is implied or needed, intent_name[0] should be set to 0. -----------------------------------------------------------------------------*/ /*! default: no intention is indicated in the header. */ #define NIFTI_INTENT_NONE 0 /*-------- These codes are for probability distributions ---------------*/ /* Most distributions have a number of parameters, below denoted by p1, p2, and p3, and stored in - intent_p1, intent_p2, intent_p3 if dataset doesn't have 5th dimension - image data array if dataset does have 5th dimension Functions to compute with many of the distributions below can be found in the CDF library from U Texas. Formulas for and discussions of these distributions can be found in the following books: [U] Univariate Discrete Distributions, NL Johnson, S Kotz, AW Kemp. [C1] Continuous Univariate Distributions, vol. 1, NL Johnson, S Kotz, N Balakrishnan. [C2] Continuous Univariate Distributions, vol. 2, NL Johnson, S Kotz, N Balakrishnan. */ /*----------------------------------------------------------------------*/ /*! [C2, chap 32] Correlation coefficient R (1 param): p1 = degrees of freedom R/sqrt(1-R*R) is t-distributed with p1 DOF. */ /*! \defgroup NIFTI1_INTENT_CODES \brief nifti1 intent codes, to describe intended meaning of dataset contents @{ */ #define NIFTI_INTENT_CORREL 2 /*! [C2, chap 28] Student t statistic (1 param): p1 = DOF. */ #define NIFTI_INTENT_TTEST 3 /*! [C2, chap 27] Fisher F statistic (2 params): p1 = numerator DOF, p2 = denominator DOF. */ #define NIFTI_INTENT_FTEST 4 /*! [C1, chap 13] Standard normal (0 params): Density = N(0,1). */ #define NIFTI_INTENT_ZSCORE 5 /*! [C1, chap 18] Chi-squared (1 param): p1 = DOF. Density(x) proportional to exp(-x/2) * x^(p1/2-1). */ #define NIFTI_INTENT_CHISQ 6 /*! [C2, chap 25] Beta distribution (2 params): p1=a, p2=b. Density(x) proportional to x^(a-1) * (1-x)^(b-1). */ #define NIFTI_INTENT_BETA 7 /*! [U, chap 3] Binomial distribution (2 params): p1 = number of trials, p2 = probability per trial. Prob(x) = (p1 choose x) * p2^x * (1-p2)^(p1-x), for x=0,1,...,p1. */ #define NIFTI_INTENT_BINOM 8 /*! [C1, chap 17] Gamma distribution (2 params): p1 = shape, p2 = scale. Density(x) proportional to x^(p1-1) * exp(-p2*x). */ #define NIFTI_INTENT_GAMMA 9 /*! [U, chap 4] Poisson distribution (1 param): p1 = mean. Prob(x) = exp(-p1) * p1^x / x! , for x=0,1,2,.... */ #define NIFTI_INTENT_POISSON 10 /*! [C1, chap 13] Normal distribution (2 params): p1 = mean, p2 = standard deviation. */ #define NIFTI_INTENT_NORMAL 11 /*! [C2, chap 30] Noncentral F statistic (3 params): p1 = numerator DOF, p2 = denominator DOF, p3 = numerator noncentrality parameter. */ #define NIFTI_INTENT_FTEST_NONC 12 /*! [C2, chap 29] Noncentral chi-squared statistic (2 params): p1 = DOF, p2 = noncentrality parameter. */ #define NIFTI_INTENT_CHISQ_NONC 13 /*! [C2, chap 23] Logistic distribution (2 params): p1 = location, p2 = scale. Density(x) proportional to sech^2((x-p1)/(2*p2)). */ #define NIFTI_INTENT_LOGISTIC 14 /*! [C2, chap 24] Laplace distribution (2 params): p1 = location, p2 = scale. Density(x) proportional to exp(-abs(x-p1)/p2). */ #define NIFTI_INTENT_LAPLACE 15 /*! [C2, chap 26] Uniform distribution: p1 = lower end, p2 = upper end. */ #define NIFTI_INTENT_UNIFORM 16 /*! [C2, chap 31] Noncentral t statistic (2 params): p1 = DOF, p2 = noncentrality parameter. */ #define NIFTI_INTENT_TTEST_NONC 17 /*! [C1, chap 21] Weibull distribution (3 params): p1 = location, p2 = scale, p3 = power. Density(x) proportional to ((x-p1)/p2)^(p3-1) * exp(-((x-p1)/p2)^p3) for x > p1. */ #define NIFTI_INTENT_WEIBULL 18 /*! [C1, chap 18] Chi distribution (1 param): p1 = DOF. Density(x) proportional to x^(p1-1) * exp(-x^2/2) for x > 0. p1 = 1 = 'half normal' distribution p1 = 2 = Rayleigh distribution p1 = 3 = Maxwell-Boltzmann distribution. */ #define NIFTI_INTENT_CHI 19 /*! [C1, chap 15] Inverse Gaussian (2 params): p1 = mu, p2 = lambda Density(x) proportional to exp(-p2*(x-p1)^2/(2*p1^2*x)) / x^3 for x > 0. */ #define NIFTI_INTENT_INVGAUSS 20 /*! [C2, chap 22] Extreme value type I (2 params): p1 = location, p2 = scale cdf(x) = exp(-exp(-(x-p1)/p2)). */ #define NIFTI_INTENT_EXTVAL 21 /*! Data is a 'p-value' (no params). */ #define NIFTI_INTENT_PVAL 22 /*! Data is ln(p-value) (no params). To be safe, a program should compute p = exp(-abs(this_value)). The nifti_stats.c library returns this_value as positive, so that this_value = -log(p). */ #define NIFTI_INTENT_LOGPVAL 23 /*! Data is log10(p-value) (no params). To be safe, a program should compute p = pow(10.,-abs(this_value)). The nifti_stats.c library returns this_value as positive, so that this_value = -log10(p). */ #define NIFTI_INTENT_LOG10PVAL 24 /*! Smallest intent_code that indicates a statistic. */ #define NIFTI_FIRST_STATCODE 2 /*! Largest intent_code that indicates a statistic. */ #define NIFTI_LAST_STATCODE 24 /*---------- these values for intent_code aren't for statistics ----------*/ /*! To signify that the value at each voxel is an estimate of some parameter, set intent_code = NIFTI_INTENT_ESTIMATE. The name of the parameter may be stored in intent_name. */ #define NIFTI_INTENT_ESTIMATE 1001 /*! To signify that the value at each voxel is an index into some set of labels, set intent_code = NIFTI_INTENT_LABEL. The filename with the labels may stored in aux_file. */ #define NIFTI_INTENT_LABEL 1002 /*! To signify that the value at each voxel is an index into the NeuroNames labels set, set intent_code = NIFTI_INTENT_NEURONAME. */ #define NIFTI_INTENT_NEURONAME 1003 /*! To store an M x N matrix at each voxel: - dataset must have a 5th dimension (dim[0]=5 and dim[5]>1) - intent_code must be NIFTI_INTENT_GENMATRIX - dim[5] must be M*N - intent_p1 must be M (in float format) - intent_p2 must be N (ditto) - the matrix values A[i][[j] are stored in row-order: - A[0][0] A[0][1] ... A[0][N-1] - A[1][0] A[1][1] ... A[1][N-1] - etc., until - A[M-1][0] A[M-1][1] ... A[M-1][N-1] */ #define NIFTI_INTENT_GENMATRIX 1004 /*! To store an NxN symmetric matrix at each voxel: - dataset must have a 5th dimension - intent_code must be NIFTI_INTENT_SYMMATRIX - dim[5] must be N*(N+1)/2 - intent_p1 must be N (in float format) - the matrix values A[i][[j] are stored in row-order: - A[0][0] - A[1][0] A[1][1] - A[2][0] A[2][1] A[2][2] - etc.: row-by-row */ #define NIFTI_INTENT_SYMMATRIX 1005 /*! To signify that the vector value at each voxel is to be taken as a displacement field or vector: - dataset must have a 5th dimension - intent_code must be NIFTI_INTENT_DISPVECT - dim[5] must be the dimensionality of the displacment vector (e.g., 3 for spatial displacement, 2 for in-plane) */ #define NIFTI_INTENT_DISPVECT 1006 /* specifically for displacements */ #define NIFTI_INTENT_VECTOR 1007 /* for any other type of vector */ /*! To signify that the vector value at each voxel is really a spatial coordinate (e.g., the vertices or nodes of a surface mesh): - dataset must have a 5th dimension - intent_code must be NIFTI_INTENT_POINTSET - dim[0] = 5 - dim[1] = number of points - dim[2] = dim[3] = dim[4] = 1 - dim[5] must be the dimensionality of space (e.g., 3 => 3D space). - intent_name may describe the object these points come from (e.g., "pial", "gray/white" , "EEG", "MEG"). */ #define NIFTI_INTENT_POINTSET 1008 /*! To signify that the vector value at each voxel is really a triple of indexes (e.g., forming a triangle) from a pointset dataset: - dataset must have a 5th dimension - intent_code must be NIFTI_INTENT_TRIANGLE - dim[0] = 5 - dim[1] = number of triangles - dim[2] = dim[3] = dim[4] = 1 - dim[5] = 3 - datatype should be an integer type (preferably DT_INT32) - the data values are indexes (0,1,...) into a pointset dataset. */ #define NIFTI_INTENT_TRIANGLE 1009 /*! To signify that the vector value at each voxel is a quaternion: - dataset must have a 5th dimension - intent_code must be NIFTI_INTENT_QUATERNION - dim[0] = 5 - dim[5] = 4 - datatype should be a floating point type */ #define NIFTI_INTENT_QUATERNION 1010 /*! Dimensionless value - no params - although, as in _ESTIMATE the name of the parameter may be stored in intent_name. */ #define NIFTI_INTENT_DIMLESS 1011 /*---------- these values apply to GIFTI datasets ----------*/ /*! To signify that the value at each location is from a time series. */ #define NIFTI_INTENT_TIME_SERIES 2001 /*! To signify that the value at each location is a node index, from a complete surface dataset. */ #define NIFTI_INTENT_NODE_INDEX 2002 /*! To signify that the vector value at each location is an RGB triplet, of whatever type. - dataset must have a 5th dimension - dim[0] = 5 - dim[1] = number of nodes - dim[2] = dim[3] = dim[4] = 1 - dim[5] = 3 */ #define NIFTI_INTENT_RGB_VECTOR 2003 /*! To signify that the vector value at each location is a 4 valued RGBA vector, of whatever type. - dataset must have a 5th dimension - dim[0] = 5 - dim[1] = number of nodes - dim[2] = dim[3] = dim[4] = 1 - dim[5] = 4 */ #define NIFTI_INTENT_RGBA_VECTOR 2004 /*! To signify that the value at each location is a shape value, such as the curvature. */ #define NIFTI_INTENT_SHAPE 2005 /* @} */ /*---------------------------------------------------------------------------*/ /* 3D IMAGE (VOLUME) ORIENTATION AND LOCATION IN SPACE: --------------------------------------------------- There are 3 different methods by which continuous coordinates can attached to voxels. The discussion below emphasizes 3D volumes, and the continuous coordinates are referred to as (x,y,z). The voxel index coordinates (i.e., the array indexes) are referred to as (i,j,k), with valid ranges: i = 0 .. dim[1]-1 j = 0 .. dim[2]-1 (if dim[0] >= 2) k = 0 .. dim[3]-1 (if dim[0] >= 3) The (x,y,z) coordinates refer to the CENTER of a voxel. In methods 2 and 3, the (x,y,z) axes refer to a subject-based coordinate system, with +x = Right +y = Anterior +z = Superior. This is a right-handed coordinate system. However, the exact direction these axes point with respect to the subject depends on qform_code (Method 2) and sform_code (Method 3). N.B.: The i index varies most rapidly, j index next, k index slowest. Thus, voxel (i,j,k) is stored starting at location (i + j*dim[1] + k*dim[1]*dim[2]) * (bitpix/8) into the dataset array. N.B.: The ANALYZE 7.5 coordinate system is +x = Left +y = Anterior +z = Superior which is a left-handed coordinate system. This backwardness is too difficult to tolerate, so this NIFTI-1 standard specifies the coordinate order which is most common in functional neuroimaging. N.B.: The 3 methods below all give the locations of the voxel centers in the (x,y,z) coordinate system. In many cases, programs will wish to display image data on some other grid. In such a case, the program will need to convert its desired (x,y,z) values into (i,j,k) values in order to extract (or interpolate) the image data. This operation would be done with the inverse transformation to those described below. N.B.: Method 2 uses a factor 'qfac' which is either -1 or 1; qfac is stored in the otherwise unused pixdim[0]. If pixdim[0]=0.0 (which should not occur), we take qfac=1. Of course, pixdim[0] is only used when reading a NIFTI-1 header, not when reading an ANALYZE 7.5 header. N.B.: The units of (x,y,z) can be specified using the xyzt_units field. METHOD 1 (the "old" way, used only when qform_code = 0): ------------------------------------------------------- The coordinate mapping from (i,j,k) to (x,y,z) is the ANALYZE 7.5 way. This is a simple scaling relationship: x = pixdim[1] * i y = pixdim[2] * j z = pixdim[3] * k No particular spatial orientation is attached to these (x,y,z) coordinates. (NIFTI-1 does not have the ANALYZE 7.5 orient field, which is not general and is often not set properly.) This method is not recommended, and is present mainly for compatibility with ANALYZE 7.5 files. METHOD 2 (used when qform_code > 0, which should be the "normal" case): --------------------------------------------------------------------- The (x,y,z) coordinates are given by the pixdim[] scales, a rotation matrix, and a shift. This method is intended to represent "scanner-anatomical" coordinates, which are often embedded in the image header (e.g., DICOM fields (0020,0032), (0020,0037), (0028,0030), and (0018,0050)), and represent the nominal orientation and location of the data. This method can also be used to represent "aligned" coordinates, which would typically result from some post-acquisition alignment of the volume to a standard orientation (e.g., the same subject on another day, or a rigid rotation to true anatomical orientation from the tilted position of the subject in the scanner). The formula for (x,y,z) in terms of header parameters and (i,j,k) is: [ x ] [ R11 R12 R13 ] [ pixdim[1] * i ] [ qoffset_x ] [ y ] = [ R21 R22 R23 ] [ pixdim[2] * j ] + [ qoffset_y ] [ z ] [ R31 R32 R33 ] [ qfac * pixdim[3] * k ] [ qoffset_z ] The qoffset_* shifts are in the NIFTI-1 header. Note that the center of the (i,j,k)=(0,0,0) voxel (first value in the dataset array) is just (x,y,z)=(qoffset_x,qoffset_y,qoffset_z). The rotation matrix R is calculated from the quatern_* parameters. This calculation is described below. The scaling factor qfac is either 1 or -1. The rotation matrix R defined by the quaternion parameters is "proper" (has determinant 1). This may not fit the needs of the data; for example, if the image grid is i increases from Left-to-Right j increases from Anterior-to-Posterior k increases from Inferior-to-Superior Then (i,j,k) is a left-handed triple. In this example, if qfac=1, the R matrix would have to be [ 1 0 0 ] [ 0 -1 0 ] which is "improper" (determinant = -1). [ 0 0 1 ] If we set qfac=-1, then the R matrix would be [ 1 0 0 ] [ 0 -1 0 ] which is proper. [ 0 0 -1 ] This R matrix is represented by quaternion [a,b,c,d] = [0,1,0,0] (which encodes a 180 degree rotation about the x-axis). METHOD 3 (used when sform_code > 0): ----------------------------------- The (x,y,z) coordinates are given by a general affine transformation of the (i,j,k) indexes: x = srow_x[0] * i + srow_x[1] * j + srow_x[2] * k + srow_x[3] y = srow_y[0] * i + srow_y[1] * j + srow_y[2] * k + srow_y[3] z = srow_z[0] * i + srow_z[1] * j + srow_z[2] * k + srow_z[3] The srow_* vectors are in the NIFTI_1 header. Note that no use is made of pixdim[] in this method. WHY 3 METHODS? -------------- Method 1 is provided only for backwards compatibility. The intention is that Method 2 (qform_code > 0) represents the nominal voxel locations as reported by the scanner, or as rotated to some fiducial orientation and location. Method 3, if present (sform_code > 0), is to be used to give the location of the voxels in some standard space. The sform_code indicates which standard space is present. Both methods 2 and 3 can be present, and be useful in different contexts (method 2 for displaying the data on its original grid; method 3 for displaying it on a standard grid). In this scheme, a dataset would originally be set up so that the Method 2 coordinates represent what the scanner reported. Later, a registration to some standard space can be computed and inserted in the header. Image display software can use either transform, depending on its purposes and needs. In Method 2, the origin of coordinates would generally be whatever the scanner origin is; for example, in MRI, (0,0,0) is the center of the gradient coil. In Method 3, the origin of coordinates would depend on the value of sform_code; for example, for the Talairach coordinate system, (0,0,0) corresponds to the Anterior Commissure. QUATERNION REPRESENTATION OF ROTATION MATRIX (METHOD 2) ------------------------------------------------------- The orientation of the (x,y,z) axes relative to the (i,j,k) axes in 3D space is specified using a unit quaternion [a,b,c,d], where a*a+b*b+c*c+d*d=1. The (b,c,d) values are all that is needed, since we require that a = sqrt(1.0-(b*b+c*c+d*d)) be nonnegative. The (b,c,d) values are stored in the (quatern_b,quatern_c,quatern_d) fields. The quaternion representation is chosen for its compactness in representing rotations. The (proper) 3x3 rotation matrix that corresponds to [a,b,c,d] is [ a*a+b*b-c*c-d*d 2*b*c-2*a*d 2*b*d+2*a*c ] R = [ 2*b*c+2*a*d a*a+c*c-b*b-d*d 2*c*d-2*a*b ] [ 2*b*d-2*a*c 2*c*d+2*a*b a*a+d*d-c*c-b*b ] [ R11 R12 R13 ] = [ R21 R22 R23 ] [ R31 R32 R33 ] If (p,q,r) is a unit 3-vector, then rotation of angle h about that direction is represented by the quaternion [a,b,c,d] = [cos(h/2), p*sin(h/2), q*sin(h/2), r*sin(h/2)]. Requiring a >= 0 is equivalent to requiring -Pi <= h <= Pi. (Note that [-a,-b,-c,-d] represents the same rotation as [a,b,c,d]; there are 2 quaternions that can be used to represent a given rotation matrix R.) To rotate a 3-vector (x,y,z) using quaternions, we compute the quaternion product [0,x',y',z'] = [a,b,c,d] * [0,x,y,z] * [a,-b,-c,-d] which is equivalent to the matrix-vector multiply [ x' ] [ x ] [ y' ] = R [ y ] (equivalence depends on a*a+b*b+c*c+d*d=1) [ z' ] [ z ] Multiplication of 2 quaternions is defined by the following: [a,b,c,d] = a*1 + b*I + c*J + d*K where I*I = J*J = K*K = -1 (I,J,K are square roots of -1) I*J = K J*K = I K*I = J J*I = -K K*J = -I I*K = -J (not commutative!) For example [a,b,0,0] * [0,0,0,1] = [0,0,-b,a] since this expands to (a+b*I)*(K) = (a*K+b*I*K) = (a*K-b*J). The above formula shows how to go from quaternion (b,c,d) to rotation matrix and direction cosines. Conversely, given R, we can compute the fields for the NIFTI-1 header by a = 0.5 * sqrt(1+R11+R22+R33) (not stored) b = 0.25 * (R32-R23) / a => quatern_b c = 0.25 * (R13-R31) / a => quatern_c d = 0.25 * (R21-R12) / a => quatern_d If a=0 (a 180 degree rotation), alternative formulas are needed. See the nifti1_io.c function mat44_to_quatern() for an implementation of the various cases in converting R to [a,b,c,d]. Note that R-transpose (= R-inverse) would lead to the quaternion [a,-b,-c,-d]. The choice to specify the qoffset_x (etc.) values in the final coordinate system is partly to make it easy to convert DICOM images to this format. The DICOM attribute "Image Position (Patient)" (0020,0032) stores the (Xd,Yd,Zd) coordinates of the center of the first voxel. Here, (Xd,Yd,Zd) refer to DICOM coordinates, and Xd=-x, Yd=-y, Zd=z, where (x,y,z) refers to the NIFTI coordinate system discussed above. (i.e., DICOM +Xd is Left, +Yd is Posterior, +Zd is Superior, whereas +x is Right, +y is Anterior , +z is Superior. ) Thus, if the (0020,0032) DICOM attribute is extracted into (px,py,pz), then qoffset_x = -px qoffset_y = -py qoffset_z = pz is a reasonable setting when qform_code=NIFTI_XFORM_SCANNER_ANAT. That is, DICOM's coordinate system is 180 degrees rotated about the z-axis from the neuroscience/NIFTI coordinate system. To transform between DICOM and NIFTI, you just have to negate the x- and y-coordinates. The DICOM attribute (0020,0037) "Image Orientation (Patient)" gives the orientation of the x- and y-axes of the image data in terms of 2 3-vectors. The first vector is a unit vector along the x-axis, and the second is along the y-axis. If the (0020,0037) attribute is extracted into the value (xa,xb,xc,ya,yb,yc), then the first two columns of the R matrix would be [ -xa -ya ] [ -xb -yb ] [ xc yc ] The negations are because DICOM's x- and y-axes are reversed relative to NIFTI's. The third column of the R matrix gives the direction of displacement (relative to the subject) along the slice-wise direction. This orientation is not encoded in the DICOM standard in a simple way; DICOM is mostly concerned with 2D images. The third column of R will be either the cross-product of the first 2 columns or its negative. It is possible to infer the sign of the 3rd column by examining the coordinates in DICOM attribute (0020,0032) "Image Position (Patient)" for successive slices. However, this method occasionally fails for reasons that I (RW Cox) do not understand. -----------------------------------------------------------------------------*/ /* [qs]form_code value: */ /* x,y,z coordinate system refers to: */ /*-----------------------*/ /*---------------------------------------*/ /*! \defgroup NIFTI1_XFORM_CODES \brief nifti1 xform codes to describe the "standard" coordinate system @{ */ /*! Arbitrary coordinates (Method 1). */ #define NIFTI_XFORM_UNKNOWN 0 /*! Scanner-based anatomical coordinates */ #define NIFTI_XFORM_SCANNER_ANAT 1 /*! Coordinates aligned to another file's, or to anatomical "truth". */ #define NIFTI_XFORM_ALIGNED_ANAT 2 /*! Coordinates aligned to Talairach- Tournoux Atlas; (0,0,0)=AC, etc. */ #define NIFTI_XFORM_TALAIRACH 3 /*! MNI 152 normalized coordinates. */ #define NIFTI_XFORM_MNI_152 4 /* @} */ /*---------------------------------------------------------------------------*/ /* UNITS OF SPATIAL AND TEMPORAL DIMENSIONS: ---------------------------------------- The codes below can be used in xyzt_units to indicate the units of pixdim. As noted earlier, dimensions 1,2,3 are for x,y,z; dimension 4 is for time (t). - If dim[4]=1 or dim[0] < 4, there is no time axis. - A single time series (no space) would be specified with - dim[0] = 4 (for scalar data) or dim[0] = 5 (for vector data) - dim[1] = dim[2] = dim[3] = 1 - dim[4] = number of time points - pixdim[4] = time step - xyzt_units indicates units of pixdim[4] - dim[5] = number of values stored at each time point Bits 0..2 of xyzt_units specify the units of pixdim[1..3] (e.g., spatial units are values 1..7). Bits 3..5 of xyzt_units specify the units of pixdim[4] (e.g., temporal units are multiples of 8). This compression of 2 distinct concepts into 1 byte is due to the limited space available in the 348 byte ANALYZE 7.5 header. The macros XYZT_TO_SPACE and XYZT_TO_TIME can be used to mask off the undesired bits from the xyzt_units fields, leaving "pure" space and time codes. Inversely, the macro SPACE_TIME_TO_XYZT can be used to assemble a space code (0,1,2,...,7) with a time code (0,8,16,32,...,56) into the combined value for xyzt_units. Note that codes are provided to indicate the "time" axis units are actually frequency in Hertz (_HZ), in part-per-million (_PPM) or in radians-per-second (_RADS). The toffset field can be used to indicate a nonzero start point for the time axis. That is, time point #m is at t=toffset+m*pixdim[4] for m=0..dim[4]-1. -----------------------------------------------------------------------------*/ /*! \defgroup NIFTI1_UNITS \brief nifti1 units codes to describe the unit of measurement for each dimension of the dataset @{ */ /*! NIFTI code for unspecified units. */ #define NIFTI_UNITS_UNKNOWN 0 /** Space codes are multiples of 1. **/ /*! NIFTI code for meters. */ #define NIFTI_UNITS_METER 1 /*! NIFTI code for millimeters. */ #define NIFTI_UNITS_MM 2 /*! NIFTI code for micrometers. */ #define NIFTI_UNITS_MICRON 3 /** Time codes are multiples of 8. **/ /*! NIFTI code for seconds. */ #define NIFTI_UNITS_SEC 8 /*! NIFTI code for milliseconds. */ #define NIFTI_UNITS_MSEC 16 /*! NIFTI code for microseconds. */ #define NIFTI_UNITS_USEC 24 /*** These units are for spectral data: ***/ /*! NIFTI code for Hertz. */ #define NIFTI_UNITS_HZ 32 /*! NIFTI code for ppm. */ #define NIFTI_UNITS_PPM 40 /*! NIFTI code for radians per second. */ #define NIFTI_UNITS_RADS 48 /* @} */ #undef XYZT_TO_SPACE #undef XYZT_TO_TIME #define XYZT_TO_SPACE(xyzt) ( (xyzt) & 0x07 ) #define XYZT_TO_TIME(xyzt) ( (xyzt) & 0x38 ) #undef SPACE_TIME_TO_XYZT #define SPACE_TIME_TO_XYZT(ss,tt) ( (((char)(ss)) & 0x07) \ | (((char)(tt)) & 0x38) ) /*---------------------------------------------------------------------------*/ /* MRI-SPECIFIC SPATIAL AND TEMPORAL INFORMATION: --------------------------------------------- A few fields are provided to store some extra information that is sometimes important when storing the image data from an FMRI time series experiment. (After processing such data into statistical images, these fields are not likely to be useful.) { freq_dim } = These fields encode which spatial dimension (1,2, or 3) { phase_dim } = corresponds to which acquisition dimension for MRI data. { slice_dim } = Examples: Rectangular scan multi-slice EPI: freq_dim = 1 phase_dim = 2 slice_dim = 3 (or some permutation) Spiral scan multi-slice EPI: freq_dim = phase_dim = 0 slice_dim = 3 since the concepts of frequency- and phase-encoding directions don't apply to spiral scan slice_duration = If this is positive, AND if slice_dim is nonzero, indicates the amount of time used to acquire 1 slice. slice_duration*dim[slice_dim] can be less than pixdim[4] with a clustered acquisition method, for example. slice_code = If this is nonzero, AND if slice_dim is nonzero, AND if slice_duration is positive, indicates the timing pattern of the slice acquisition. The following codes are defined: NIFTI_SLICE_SEQ_INC == sequential increasing NIFTI_SLICE_SEQ_DEC == sequential decreasing NIFTI_SLICE_ALT_INC == alternating increasing NIFTI_SLICE_ALT_DEC == alternating decreasing NIFTI_SLICE_ALT_INC2 == alternating increasing #2 NIFTI_SLICE_ALT_DEC2 == alternating decreasing #2 { slice_start } = Indicates the start and end of the slice acquisition { slice_end } = pattern, when slice_code is nonzero. These values are present to allow for the possible addition of "padded" slices at either end of the volume, which don't fit into the slice timing pattern. If there are no padding slices, then slice_start=0 and slice_end=dim[slice_dim]-1 are the correct values. For these values to be meaningful, slice_start must be non-negative and slice_end must be greater than slice_start. Otherwise, they should be ignored. The following table indicates the slice timing pattern, relative to time=0 for the first slice acquired, for some sample cases. Here, dim[slice_dim]=7 (there are 7 slices, labeled 0..6), slice_duration=0.1, and slice_start=1, slice_end=5 (1 padded slice on each end). slice index SEQ_INC SEQ_DEC ALT_INC ALT_DEC ALT_INC2 ALT_DEC2 6 : n/a n/a n/a n/a n/a n/a n/a = not applicable 5 : 0.4 0.0 0.2 0.0 0.4 0.2 (slice time offset 4 : 0.3 0.1 0.4 0.3 0.1 0.0 doesn't apply to 3 : 0.2 0.2 0.1 0.1 0.3 0.3 slices outside 2 : 0.1 0.3 0.3 0.4 0.0 0.1 the range 1 : 0.0 0.4 0.0 0.2 0.2 0.4 slice_start .. 0 : n/a n/a n/a n/a n/a n/a slice_end) The SEQ slice_codes are sequential ordering (uncommon but not unknown), either increasing in slice number or decreasing (INC or DEC), as illustrated above. The ALT slice codes are alternating ordering. The 'standard' way for these to operate (without the '2' on the end) is for the slice timing to start at the edge of the slice_start .. slice_end group (at slice_start for INC and at slice_end for DEC). For the 'ALT_*2' slice_codes, the slice timing instead starts at the first slice in from the edge (at slice_start+1 for INC2 and at slice_end-1 for DEC2). This latter acquisition scheme is found on some Siemens scanners. The fields freq_dim, phase_dim, slice_dim are all squished into the single byte field dim_info (2 bits each, since the values for each field are limited to the range 0..3). This unpleasantness is due to lack of space in the 348 byte allowance. The macros DIM_INFO_TO_FREQ_DIM, DIM_INFO_TO_PHASE_DIM, and DIM_INFO_TO_SLICE_DIM can be used to extract these values from the dim_info byte. The macro FPS_INTO_DIM_INFO can be used to put these 3 values into the dim_info byte. -----------------------------------------------------------------------------*/ #undef DIM_INFO_TO_FREQ_DIM #undef DIM_INFO_TO_PHASE_DIM #undef DIM_INFO_TO_SLICE_DIM #define DIM_INFO_TO_FREQ_DIM(di) ( ((di) ) & 0x03 ) #define DIM_INFO_TO_PHASE_DIM(di) ( ((di) >> 2) & 0x03 ) #define DIM_INFO_TO_SLICE_DIM(di) ( ((di) >> 4) & 0x03 ) #undef FPS_INTO_DIM_INFO #define FPS_INTO_DIM_INFO(fd,pd,sd) ( ( ( ((char)(fd)) & 0x03) ) | \ ( ( ((char)(pd)) & 0x03) << 2 ) | \ ( ( ((char)(sd)) & 0x03) << 4 ) ) /*! \defgroup NIFTI1_SLICE_ORDER \brief nifti1 slice order codes, describing the acquisition order of the slices @{ */ #define NIFTI_SLICE_UNKNOWN 0 #define NIFTI_SLICE_SEQ_INC 1 #define NIFTI_SLICE_SEQ_DEC 2 #define NIFTI_SLICE_ALT_INC 3 #define NIFTI_SLICE_ALT_DEC 4 #define NIFTI_SLICE_ALT_INC2 5 /* 05 May 2005: RWCox */ #define NIFTI_SLICE_ALT_DEC2 6 /* 05 May 2005: RWCox */ /* @} */ /*---------------------------------------------------------------------------*/ /* UNUSED FIELDS: ------------- Some of the ANALYZE 7.5 fields marked as ++UNUSED++ may need to be set to particular values for compatibility with other programs. The issue of interoperability of ANALYZE 7.5 files is a murky one -- not all programs require exactly the same set of fields. (Unobscuring this murkiness is a principal motivation behind NIFTI-1.) Some of the fields that may need to be set for other (non-NIFTI aware) software to be happy are: extents dbh.h says this should be 16384 regular dbh.h says this should be the character 'r' glmin, } dbh.h says these values should be the min and max voxel glmax } values for the entire dataset It is best to initialize ALL fields in the NIFTI-1 header to 0 (e.g., with calloc()), then fill in what is needed. -----------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* MISCELLANEOUS C MACROS -----------------------------------------------------------------------------*/ /*.................*/ /*! Given a nifti_1_header struct, check if it has a good magic number. Returns NIFTI version number (1..9) if magic is good, 0 if it is not. */ #define NIFTI_VERSION(h) \ ( ( (h).magic[0]=='n' && (h).magic[3]=='\0' && \ ( (h).magic[1]=='i' || (h).magic[1]=='+' ) && \ ( (h).magic[2]>='1' && (h).magic[2]<='9' ) ) \ ? (h).magic[2]-'0' : 0 ) /*.................*/ /*! Check if a nifti_1_header struct says if the data is stored in the same file or in a separate file. Returns 1 if the data is in the same file as the header, 0 if it is not. */ #define NIFTI_ONEFILE(h) ( (h).magic[1] == '+' ) /*.................*/ /*! Check if a nifti_1_header struct needs to be byte swapped. Returns 1 if it needs to be swapped, 0 if it does not. */ #define NIFTI_NEEDS_SWAP(h) ( (h).dim[0] < 0 || (h).dim[0] > 7 ) /*.................*/ /*! Check if a nifti_1_header struct contains a 5th (vector) dimension. Returns size of 5th dimension if > 1, returns 0 otherwise. */ #define NIFTI_5TH_DIM(h) ( ((h).dim[0]>4 && (h).dim[5]>1) ? (h).dim[5] : 0 ) /*****************************************************************************/ /*=================*/ #ifdef __cplusplus } #endif /*=================*/ #endif /* _NIFTI_HEADER_ */ xmedcon-0.14.1/libs/nifti/nifti1_io.c0000644000175000017510000101775312157431176014270 00000000000000#define _NIFTI1_IO_C_ #include "nifti1_io.h" /* typedefs, prototypes, macros, etc. */ /*****===================================================================*****/ /***** Sample functions to deal with NIFTI-1 and ANALYZE files *****/ /*****...................................................................*****/ /***** This code is released to the public domain. *****/ /*****...................................................................*****/ /***** Author: Robert W Cox, SSCC/DIRP/NIMH/NIH/DHHS/USA/EARTH *****/ /***** Date: August 2003 *****/ /*****...................................................................*****/ /***** Neither the National Institutes of Health (NIH), nor any of its *****/ /***** employees imply any warranty of usefulness of this software for *****/ /***** any purpose, and do not assume any liability for damages, *****/ /***** incidental or otherwise, caused by any use of this document. *****/ /*****===================================================================*****/ /** \file nifti1_io.c \brief main collection of nifti1 i/o routines - written by Bob Cox, SSCC NIMH - revised by Mark Jenkinson, FMRIB - revised by Rick Reynolds, SSCC, NIMH - revised by Kate Fissell, University of Pittsburgh The library history can be viewed via "nifti_tool -nifti_hist".
The library version can be viewed via "nifti_tool -nifti_ver". */ /*! global history and version strings, for printing */ static char * gni_history[] = { "----------------------------------------------------------------------\n" "history (of nifti library changes):\n" "\n", "0.0 August, 2003 [rwcox]\n" " (Robert W Cox of the National Institutes of Health, SSCC/DIRP/NIMH)\n" " - initial version\n" "\n", "0.1 July/August, 2004 [Mark Jenkinson]\n" " (FMRIB Centre, University of Oxford, UK)\n" " - Mainly adding low-level IO and changing things to allow gzipped\n" " files to be read and written\n" " - Full backwards compatability should have been maintained\n" "\n", "0.2 16 Nov 2004 [rickr]\n" " (Rick Reynolds of the National Institutes of Health, SSCC/DIRP/NIMH)\n" " - included Mark's changes in the AFNI distribution (including znzlib/)\n" " (HAVE_ZLIB is commented out for the standard distribution)\n" " - modified nifti_validfilename() and nifti_makebasename()\n" " - added nifti_find_file_extension()\n" "\n", "0.3 3 Dec 2004 [rickr]\n" " - note: header extensions are not yet checked for\n" " - added formatted history as global string, for printing\n" " - added nifti_disp_lib_hist(), to display the nifti library history\n" " - added nifti_disp_lib_version(), to display the nifti library history\n", " - re-wrote nifti_findhdrname()\n" " o used nifti_find_file_extension()\n" " o changed order of file tests (default is .nii, depends on input)\n" " o free hdrname on failure\n" " - made similar changes to nifti_findimgname()\n" " - check for NULL return from nifti_findhdrname() calls\n", " - removed most of ERREX() macros\n" " - modified nifti_image_read()\n" " o added debug info and error checking (on gni_debug > 0, only)\n" " o fail if workingname is NULL\n" " o check for failure to open header file\n" " o free workingname on failure\n" " o check for failure of nifti_image_load()\n" " o check for failure of nifti_convert_nhdr2nim()\n", " - changed nifti_image_load() to int, and check nifti_read_buffer return\n" " - changed nifti_read_buffer() to fail on short read, and to count float\n" " fixes (to print on debug)\n" " - changed nifti_image_infodump to print to stderr\n" " - updated function header comments, or moved comments above header\n" " - removed const keyword\n" " - added LNI_FERR() macro for error reporting on input files\n" "\n", "0.4 10 Dec 2004 [rickr] - added header extensions\n" " - in nifti1_io.h:\n" " o added num_ext and ext_list to the definition of nifti_image\n" " o made many functions static (more to follow)\n" " o added LNI_MAX_NIA_EXT_LEN, for max nifti_type 3 extension length\n", " - added __DATE__ to version output in nifti_disp_lib_version()\n" " - added nifti_disp_matrix_orient() to print orientation information\n" " - added '.nia' as a valid file extension in nifti_find_file_extension()\n" " - added much more debug output\n" " - in nifti_image_read(), in the case of an ASCII header, check for\n" " extensions after the end of the header\n", " - added nifti_read_extensions() function\n" " - added nifti_read_next_extension() function\n" " - added nifti_add_exten_to_list() function\n" " - added nifti_check_extension() function\n" " - added nifti_write_extensions() function\n" " - added nifti_extension_size() function\n" " - in nifti_set_iname_offest():\n" " o adjust offset by the extension size and the extender size\n", " o fixed the 'ceiling modulo 16' computation\n" " - in nifti_image_write_hdr_img2(): \n" " o added extension writing\n" " o check for NULL return from nifti_findimgname()\n" " - include number of extensions in nifti_image_to_ascii() output\n" " - in nifti_image_from_ascii():\n" " o return bytes_read as a parameter, computed from the final spos\n" " o extract num_ext from ASCII header\n" "\n", "0.5 14 Dec 2004 [rickr] - added sub-brick reading functions\n" " - added nifti_brick_list type to nifti1_io.h, along with new prototypes\n" " - added main nifti_image_read_bricks() function, with description\n" " - added nifti_image_load_bricks() - library function (requires nim)\n" " - added valid_nifti_brick_list() - library function\n" " - added free_NBL() - library function\n", " - added update_nifti_image_for_brick_list() for dimension update\n" " - added nifti_load_NBL_bricks(), nifti_alloc_NBL_mem(),\n" " nifti_copynsort() and force_positive() (static functions)\n" " - in nifti_image_read(), check for failed load only if read_data is set\n" " - broke most of nifti_image_load() into nifti_image_load_prep()\n" "\n", "0.6 15 Dec 2004 [rickr] - added sub-brick writing functionality\n" " - in nifti1_io.h, removed znzlib directory from include - all nifti\n" " library files are now under the nifti directory\n" " - nifti_read_extensions(): print no offset warning for nifti_type 3\n" " - nifti_write_all_data():\n" " o pass nifti_brick_list * NBL, for optional writing\n" " o if NBL, write each sub-brick, sequentially\n", " - nifti_set_iname_offset(): case 1 must have sizeof() cast to int\n" " - pass NBL to nifti_image_write_hdr_img2(), and allow NBL or data\n" " - added nifti_image_write_bricks() wrapper for ...write_hdr_img2()\n" " - included compression abilities\n" "\n", "0.7 16 Dec 2004 [rickr] - minor changes to extension reading\n" "\n", "0.8 21 Dec 2004 [rickr] - restrict extension reading, and minor changes\n" " - in nifti_image_read(), compute bytes for extensions (see remaining)\n" " - in nifti_read_extensions(), pass 'remain' as space for extensions,\n" " pass it to nifti_read_next_ext(), and update for each one read \n" " - in nifti_check_extension(), require (size <= remain)\n", " - in update_nifti_image_brick_list(), update nvox\n" " - in nifti_image_load_bricks(), make explicit check for nbricks <= 0\n" " - in int_force_positive(), check for (!list)\n" " - in swap_nifti_header(), swap sizeof_hdr, and reorder to struct order\n" " - change get_filesize functions to signed ( < 0 is no file or error )\n", " - in nifti_validfilename(), lose redundant (len < 0) check\n" " - make print_hex_vals() static\n" " - in disp_nifti_1_header, restrict string field widths\n" "\n", "0.9 23 Dec 2004 [rickr] - minor changes\n" " - broke ASCII header reading out of nifti_image_read(), into new\n" " functions has_ascii_header() and read_ascii_image()\n", " - check image_read failure and znzseek failure\n" " - altered some debug output\n" " - nifti_write_all_data() now returns an int\n" "\n", "0.10 29 Dec 2004 [rickr]\n" " - renamed nifti_valid_extension() to nifti_check_extension()\n" " - added functions nifti_makehdrname() and nifti_makeimgname()\n" " - added function valid_nifti_extensions()\n" " - in nifti_write_extensions(), check for validity before writing\n", " - rewrote nifti_image_write_hdr_img2():\n" " o set write_data and leave_open flags from write_opts\n" " o add debug print statements\n" " o use nifti_write_ascii_image() for the ascii case\n" " o rewrote the logic of all cases to be easier to follow\n", " - broke out code as nifti_write_ascii_image() function\n" " - added debug to top-level write functions, and free the znzFile\n" " - removed unused internal function nifti_image_open()\n" "\n", "0.11 30 Dec 2004 [rickr] - small mods\n" " - moved static function prototypes from header to C file\n" " - free extensions in nifti_image_free()\n" "\n", "1.0 07 Jan 2005 [rickr] - INITIAL RELEASE VERSION\n" " - added function nifti_set_filenames()\n" " - added function nifti_read_header()\n" " - added static function nhdr_looks_good()\n" " - added static function need_nhdr_swap()\n" " - exported nifti_add_exten_to_list symbol\n", " - fixed #bytes written in nifti_write_extensions()\n" " - only modify offset if it is too small (nifti_set_iname_offset)\n" " - added nifti_type 3 to nifti_makehdrname and nifti_makeimgname\n" " - added function nifti_set_filenames()\n" "\n", "1.1 07 Jan 2005 [rickr]\n" " - in nifti_read_header(), swap if needed\n" "\n", "1.2 07 Feb 2005 [kate fissell c/o rickr] \n" " - nifti1.h: added doxygen comments for main struct and #define groups\n" " - nifti1_io.h: added doxygen comments for file and nifti_image struct\n" " - nifti1_io.h: added doxygen comments for file and some functions\n" " - nifti1_io.c: changed nifti_copy_nim_info to use memcpy\n" "\n", "1.3 09 Feb 2005 [rickr]\n" " - nifti1.h: added doxygen comments for extension structs\n" " - nifti1_io.h: put most #defines in #ifdef _NIFTI1_IO_C_ block\n" " - added a doxygen-style description to every exported function\n" " - added doxygen-style comments within some functions\n" " - re-exported many znzFile functions that I had made static\n" " - re-added nifti_image_open (sorry, Mark)\n" " - every exported function now has 'nifti' in the name (19 functions)\n", " - made sure every alloc() has a failure test\n" " - added nifti_copy_extensions function, for use in nifti_copy_nim_info\n" " - nifti_is_gzfile: added initial strlen test\n" " - nifti_set_filenames: added set_byte_order parameter option\n" " (it seems appropriate to set the BO when new files are associated)\n" " - disp_nifti_1_header: prints to stdout (a.o.t. stderr), with fflush\n" "\n", "1.4 23 Feb 2005 [rickr] - sourceforge merge\n" " - merged into the nifti_io CVS directory structure at sourceforge.net\n" " - merged in 4 changes by Mark, and re-added his const keywords\n" " - cast some pointers to (void *) for -pedantic compile option\n" " - added nifti_free_extensions()\n" "\n", "1.5 02 Mar 2005 [rickr] - started nifti global options\n" " - gni_debug is now g_opts.debug\n" " - added validity check parameter to nifti_read_header\n" " - need_nhdr_swap no longer does test swaps on the stack\n" "\n", "1.6 05 April 2005 [rickr] - validation and collapsed_image_read\n" " - added nifti_read_collapsed_image(), an interface for reading partial\n" " datasets, specifying a subset of array indices\n" " - for read_collapsed_image, added static functions: rci_read_data(),\n" " rci_alloc_mem(), and make_pivot_list()\n", " - added nifti_nim_is_valid() to check for consistency (more to do)\n" " - added nifti_nim_has_valid_dims() to do many dimensions tests\n" "\n", "1.7 08 April 2005 [rickr]\n" " - added nifti_update_dims_from_array() - to update dimensions\n" " - modified nifti_makehdrname() and nifti_makeimgname():\n" " if prefix has a valid extension, use it (else make one up)\n" " - added nifti_get_intlist - for making an array of ints\n" " - fixed init of NBL->bsize in nifti_alloc_NBL_mem() {thanks, Bob}\n" "\n", "1.8 14 April 2005 [rickr]\n" " - added nifti_set_type_from_names(), for nifti_set_filenames()\n" " (only updates type if number of files does not match it)\n" " - added is_valid_nifti_type(), just to be sure\n" " - updated description of nifti_read_collapsed_image() for *data change\n" " (if *data is already set, assume memory exists for results)\n" " - modified rci_alloc_mem() to allocate only if *data is NULL\n" "\n", "1.9 19 April 2005 [rickr]\n" " - added extension codes NIFTI_ECODE_COMMENT and NIFTI_ECODE_XCEDE\n" " - added nifti_type codes NIFTI_MAX_ECODE and NIFTI_MAX_FTYPE\n" " - added nifti_add_extension() {exported}\n" " - added nifti_fill_extension() as a static function\n" " - added nifti_is_valid_ecode() {exported}\n", " - nifti_type values are now NIFTI_FTYPE_* file codes\n" " - in nifti_read_extensions(), decrement 'remain' by extender size, 4\n" " - in nifti_set_iname_offset(), case 1, update if offset differs\n" " - only output '-d writing nifti file' if debug > 1\n" "\n", "1.10 10 May 2005 [rickr]\n" " - files are read using ZLIB only if they end in '.gz'\n" "\n", "1.11 12 August 2005 [kate fissell]\n" " - Kate's 0.2 release packaging, for sourceforge\n" "\n", "1.12 17 August 2005 [rickr] - comment (doxygen) updates\n" " - updated comments for most functions (2 updates from Cinly Ooi)\n" " - added nifti_type_and_names_match()\n" "\n", "1.12a 24 August 2005 [rickr] - remove all tabs from Clibs/*/*.[ch]\n", "1.12b 25 August 2005 [rickr] - changes by Hans Johnson\n", "1.13 25 August 2005 [rickr]\n", " - finished changes by Hans for Insight\n" " - added const in all appropraite parameter locations (30-40)\n" " (any pointer referencing data that will not change)\n" " - shortened all string constants below 509 character limit\n" "1.14 28 October 2005 [HJohnson]\n", " - use nifti_set_filenames() in nifti_convert_nhdr2nim()\n" "1.15 02 November 2005 [rickr]\n", " - added skip_blank_ext to nifti_global_options\n" " - added nifti_set_skip_blank_ext(), to set option\n" " - if skip_blank_ext and no extensions, do not read/write extender\n" "1.16 18 November 2005 [rickr]\n", " - removed any test or access of dim[i], i>dim[0]\n" " - do not set pixdim for collapsed dims to 1.0, leave them as they are\n" " - added magic and dim[i] tests in nifti_hdr_looks_good()\n" " - added 2 size_t casts\n" "1.17 22 November 2005 [rickr]\n", " - in hdr->nim, for i > dim[0], pass 0 or 1, else set to 1\n" "1.18 02 March 2006 [rickr]\n", " - in nifti_alloc_NBL_mem(), fixed nt=0 case from 1.17 change\n" "1.19 23 May 2006 [HJohnson,rickr]\n", " - nifti_write_ascii_image(): free(hstr)\n" " - nifti_copy_extensions(): clear num_ext and ext_list\n" "1.20 27 Jun 2006 [rickr]\n", " - nifti_findhdrname(): fixed assign of efirst to match stated logic\n" " (problem found by Atle Bjørnerud)\n" "1.21 05 Sep 2006 [rickr] update for nifticlib-0.4 release\n", " - was reminded to actually add nifti_set_skip_blank_ext()\n" " - init g_opts.skip_blank_ext to 0\n" "1.22 01 Jun 2007 nifticlib-0.5 release\n", "1.23 05 Jun 2007 nifti_add_exten_to_list: revert on failure, free old list\n" "1.24 07 Jun 2007 nifti_copy_extensions: use esize-8 for data size\n" "1.25 12 Jun 2007 [rickr] EMPTY_IMAGE creation\n", " - added nifti_make_new_header() - to create from dims/dtype\n" " - added nifti_make_new_nim() - to create from dims/dtype/fill\n" " - added nifti_is_valid_datatype(), and more debug info\n", "1.26 27 Jul 2007 [rickr] handle single volumes > 2^31 bytes (but < 2^32)\n", "1.27 28 Jul 2007 [rickr] nim->nvox, NBL-bsize are now type size_t\n" "1.28 30 Jul 2007 [rickr] size_t updates\n", "1.29 08 Aug 2007 [rickr] for list, valid_nifti_brick_list requires 3 dims\n" "1.30 08 Nov 2007 [Yaroslav/rickr]\n" " - fix ARM struct alignment problem in byte-swapping routines\n", "1.31 29 Nov 2007 [rickr] for nifticlib-1.0.0\n" " - added nifti_datatype_to/from_string routines\n" " - added DT_RGBA32/NIFTI_TYPE_RGBA32 datatype macros (2304)\n" " - added NIFTI_ECODE_FREESURFER (14)\n", "1.32 08 Dec 2007 [rickr]\n" " - nifti_hdr_looks_good() allows ANALYZE headers (req. by V. Luccio)\n" " - added nifti_datatype_is_valid()\n", "1.33 05 Feb 2008 [hansj,rickr] - block nia.gz use\n" "1.34 13 Jun 2008 [rickr] - added nifti_compiled_with_zlib()\n" "1.35 03 Aug 2008 [rickr]\n", " - deal with swapping, so that CPU type does not affect output\n" " (motivated by C Burns)\n" " - added nifti_analyze75 structure and nifti_swap_as_analyze()\n" " - previous swap_nifti_header is saved as old_swap_nifti_header\n" " - also swap UNUSED fields in nifti_1_header struct\n", "1.36 07 Oct 2008 [rickr]\n", " - added nifti_NBL_matches_nim() check for write_bricks()\n" "1.37 10 Mar 2009 [rickr]\n", " - H Johnson cast updates (06 Feb)\n" " - added NIFTI_ECODE_PYPICKLE for PyNIfTI (06 Feb)\n" " - added NIFTI_ECODEs 18-28 for the LONI MiND group\n" "1.38 28 Apr 2009 [rickr]\n", " - uppercase extensions are now valid (requested by M. Coursolle)\n" " - nifti_set_allow_upper_fext controls this option (req by C. Ooi)\n" "1.39 23 Jun 2009 [rickr]: added 4 checks of alloc() returns\n", "1.40 16 Mar 2010 [rickr]: added NIFTI_ECODE_VOXBO for D. Kimberg\n", "1.41 28 Apr 2010 [rickr]: added NIFTI_ECODE_CARET for J. Harwell\n", "1.42 06 Jul 2010 [rickr]: trouble with large (gz) files\n", " - noted/investigated by M Hanke and Y Halchenko\n" " - fixed znzread/write, noting example by M Adler\n" " - changed nifti_swap_* routines/calls to take size_t (6)\n" "1.43 07 Jul 2010 [rickr]: fixed znzR/W to again return nmembers\n", "----------------------------------------------------------------------\n" }; static char gni_version[] = "nifti library version 1.43 (7 July, 2010)"; /*! global nifti options structure - init with defaults */ static nifti_global_options g_opts = { 1, /* debug level */ 0, /* skip_blank_ext - skip extender if no extensions */ 1 /* allow_upper_fext - allow uppercase file extensions */ }; /*! global nifti types structure list (per type, ordered oldest to newest) */ static nifti_type_ele nifti_type_list[] = { /* type nbyper swapsize name */ { 0, 0, 0, "DT_UNKNOWN" }, { 0, 0, 0, "DT_NONE" }, { 1, 0, 0, "DT_BINARY" }, /* not usable */ { 2, 1, 0, "DT_UNSIGNED_CHAR" }, { 2, 1, 0, "DT_UINT8" }, { 2, 1, 0, "NIFTI_TYPE_UINT8" }, { 4, 2, 2, "DT_SIGNED_SHORT" }, { 4, 2, 2, "DT_INT16" }, { 4, 2, 2, "NIFTI_TYPE_INT16" }, { 8, 4, 4, "DT_SIGNED_INT" }, { 8, 4, 4, "DT_INT32" }, { 8, 4, 4, "NIFTI_TYPE_INT32" }, { 16, 4, 4, "DT_FLOAT" }, { 16, 4, 4, "DT_FLOAT32" }, { 16, 4, 4, "NIFTI_TYPE_FLOAT32" }, { 32, 8, 4, "DT_COMPLEX" }, { 32, 8, 4, "DT_COMPLEX64" }, { 32, 8, 4, "NIFTI_TYPE_COMPLEX64" }, { 64, 8, 8, "DT_DOUBLE" }, { 64, 8, 8, "DT_FLOAT64" }, { 64, 8, 8, "NIFTI_TYPE_FLOAT64" }, { 128, 3, 0, "DT_RGB" }, { 128, 3, 0, "DT_RGB24" }, { 128, 3, 0, "NIFTI_TYPE_RGB24" }, { 255, 0, 0, "DT_ALL" }, { 256, 1, 0, "DT_INT8" }, { 256, 1, 0, "NIFTI_TYPE_INT8" }, { 512, 2, 2, "DT_UINT16" }, { 512, 2, 2, "NIFTI_TYPE_UINT16" }, { 768, 4, 4, "DT_UINT32" }, { 768, 4, 4, "NIFTI_TYPE_UINT32" }, { 1024, 8, 8, "DT_INT64" }, { 1024, 8, 8, "NIFTI_TYPE_INT64" }, { 1280, 8, 8, "DT_UINT64" }, { 1280, 8, 8, "NIFTI_TYPE_UINT64" }, { 1536, 16, 16, "DT_FLOAT128" }, { 1536, 16, 16, "NIFTI_TYPE_FLOAT128" }, { 1792, 16, 8, "DT_COMPLEX128" }, { 1792, 16, 8, "NIFTI_TYPE_COMPLEX128" }, { 2048, 32, 16, "DT_COMPLEX256" }, { 2048, 32, 16, "NIFTI_TYPE_COMPLEX256" }, { 2304, 4, 0, "DT_RGBA32" }, { 2304, 4, 0, "NIFTI_TYPE_RGBA32" }, }; /*---------------------------------------------------------------------------*/ /* prototypes for internal functions - not part of exported library */ /* extension routines */ static int nifti_read_extensions( nifti_image *nim, znzFile fp, int remain ); static int nifti_read_next_extension( nifti1_extension * nex, nifti_image *nim, int remain, znzFile fp ); static int nifti_check_extension(nifti_image *nim, int size,int code, int rem); static void update_nifti_image_for_brick_list(nifti_image * nim , int nbricks); static int nifti_add_exten_to_list(nifti1_extension * new_ext, nifti1_extension ** list, int new_length); static int nifti_fill_extension(nifti1_extension * ext, const char * data, int len, int ecode); /* NBL routines */ static int nifti_load_NBL_bricks(nifti_image * nim , int * slist, int * sindex, nifti_brick_list * NBL, znzFile fp ); static int nifti_alloc_NBL_mem( nifti_image * nim, int nbricks, nifti_brick_list * nbl); static int nifti_copynsort(int nbricks, const int *blist, int **slist, int **sindex); static int nifti_NBL_matches_nim(const nifti_image *nim, const nifti_brick_list *NBL); /* for nifti_read_collapsed_image: */ static int rci_read_data(nifti_image *nim, int *pivots, int *prods, int nprods, const int dims[], char *data, znzFile fp, size_t base_offset); static int rci_alloc_mem(void ** data, int prods[8], int nprods, int nbyper ); static int make_pivot_list(nifti_image * nim, const int dims[], int pivots[], int prods[], int * nprods ); /* misc */ static int compare_strlist (const char * str, char ** strlist, int len); static int fileext_compare (const char * test_ext, const char * known_ext); static int fileext_n_compare (const char * test_ext, const char * known_ext, int maxlen); static int is_mixedcase (const char * str); static int is_uppercase (const char * str); static int make_lowercase (char * str); static int make_uppercase (char * str); static int need_nhdr_swap (short dim0, int hdrsize); static int print_hex_vals (const char * data, int nbytes, FILE * fp); static int unescape_string (char *str); /* string utility functions */ static char *escapize_string (const char *str); /* internal I/O routines */ static znzFile nifti_image_load_prep( nifti_image *nim ); static int has_ascii_header(znzFile fp); /*---------------------------------------------------------------------------*/ /* for calling from some main program */ /*----------------------------------------------------------------------*/ /*! display the nifti library module history (via stdout) *//*--------------------------------------------------------------------*/ void nifti_disp_lib_hist( void ) { int c, len = sizeof(gni_history)/sizeof(char *); for( c = 0; c < len; c++ ) fputs(gni_history[c], stdout); } /*----------------------------------------------------------------------*/ /*! display the nifti library version (via stdout) *//*--------------------------------------------------------------------*/ void nifti_disp_lib_version( void ) { printf("%s, compiled %s\n", gni_version, __DATE__); } /*----------------------------------------------------------------------*/ /*! nifti_image_read_bricks - read nifti data as array of bricks * * 13 Dec 2004 [rickr] * * \param hname - filename of dataset to read (must be valid) * \param nbricks - number of sub-bricks to read * (if blist is valid, nbricks must be > 0) * \param blist - list of sub-bricks to read * (can be NULL; if NULL, read complete dataset) * \param NBL - pointer to empty nifti_brick_list struct * (must be a valid pointer) * * \return *
nim - same as nifti_image_read, but * nim->nt = NBL->nbricks (or nt*nu*nv*nw) * nim->nu,nv,nw = 1 * nim->data = NULL *
NBL - filled with data volumes * * By default, this function will read the nifti dataset and break the data * into a list of nt*nu*nv*nw sub-bricks, each having size nx*ny*nz elements. * That is to say, instead of reading the entire dataset as a single array, * break it up into sub-bricks (volumes), each of size nx*ny*nz elements. * * Note: in the returned nifti_image, nu, nv and nw will always be 1. The * intention of this function is to collapse the dataset into a single * array of volumes (of length nbricks or nt*nu*nv*nw). * * If 'blist' is valid, it is taken to be a list of sub-bricks, of length * 'nbricks'. The data will still be separated into sub-bricks of size * nx*ny*nz elements, but now 'nbricks' sub-bricks will be returned, of the * caller's choosing via 'blist'. * * E.g. consider a dataset with 12 sub-bricks (numbered 0..11), and the * following code: * *
 * { nifti_brick_list   NB_orig, NB_select;
 *   nifti_image      * nim_orig, * nim_select;
 *   int                blist[5] = { 7, 0, 5, 5, 9 };
 *
 *   nim_orig   = nifti_image_read_bricks("myfile.nii", 0, NULL,  &NB_orig);
 *   nim_select = nifti_image_read_bricks("myfile.nii", 5, blist, &NB_select);
 * }
 * 
* * Here, nim_orig gets the entire dataset, where NB_orig.nbricks = 12. But * nim_select has NB_select.nbricks = 5. * * Note that the first case is not quite the same as just calling the * nifti_image_read function, as here the data is separated into sub-bricks. * * Note that valid blist elements are in [0..nt*nu*nv*nw-1], * or written [ 0 .. (dim[4]*dim[5]*dim[6]*dim[7] - 1) ]. * * Note that, as is the case with all of the reading functions, the * data will be allocated, read in, and properly byte-swapped, if * necessary. * * \sa nifti_image_load_bricks, nifti_free_NBL, valid_nifti_brick_list, nifti_image_read *//*----------------------------------------------------------------------*/ nifti_image *nifti_image_read_bricks(const char * hname, int nbricks, const int * blist, nifti_brick_list * NBL) { nifti_image * nim; if( !hname || !NBL ){ fprintf(stderr,"** nifti_image_read_bricks: bad params (%p,%p)\n", hname, (void *)NBL); return NULL; } if( blist && nbricks <= 0 ){ fprintf(stderr,"** nifti_image_read_bricks: bad nbricks, %d\n", nbricks); return NULL; } nim = nifti_image_read(hname, 0); /* read header, but not data */ if( !nim ) return NULL; /* errors were already printed */ /* if we fail, free image and return */ if( nifti_image_load_bricks(nim, nbricks, blist, NBL) <= 0 ){ nifti_image_free(nim); return NULL; } if( blist ) update_nifti_image_for_brick_list(nim, nbricks); return nim; } /*---------------------------------------------------------------------- * update_nifti_image_for_brick_list - update nifti_image * * When loading a specific brick list, the distinction between * nt, nu, nv and nw is lost. So put everything in t, and set * dim[0] = 4. *----------------------------------------------------------------------*/ static void update_nifti_image_for_brick_list( nifti_image * nim , int nbricks ) { int ndim; if( g_opts.debug > 2 ){ fprintf(stderr,"+d updating image dimensions for %d bricks in list\n", nbricks); fprintf(stderr," ndim = %d\n",nim->ndim); fprintf(stderr," nx,ny,nz,nt,nu,nv,nw: (%d,%d,%d,%d,%d,%d,%d)\n", nim->nx, nim->ny, nim->nz, nim->nt, nim->nu, nim->nv, nim->nw); } nim->nt = nbricks; nim->nu = nim->nv = nim->nw = 1; nim->dim[4] = nbricks; nim->dim[5] = nim->dim[6] = nim->dim[7] = 1; /* compute nvox */ /* do not rely on dimensions above dim[0] 16 Nov 2005 [rickr] */ for( nim->nvox = 1, ndim = 1; ndim <= nim->dim[0]; ndim++ ) nim->nvox *= nim->dim[ndim]; /* update the dimensions to 4 or lower */ for( ndim = 4; (ndim > 1) && (nim->dim[ndim] <= 1); ndim-- ) ; if( g_opts.debug > 2 ){ fprintf(stderr,"+d ndim = %d -> %d\n",nim->ndim, ndim); fprintf(stderr," --> (%d,%d,%d,%d,%d,%d,%d)\n", nim->nx, nim->ny, nim->nz, nim->nt, nim->nu, nim->nv, nim->nw); } nim->dim[0] = nim->ndim = ndim; } /*----------------------------------------------------------------------*/ /*! nifti_update_dims_from_array - update nx, ny, ... from nim->dim[] Fix all the dimension information, based on a new nim->dim[]. Note: we assume that dim[0] will not increase. Check for updates to pixdim[], dx,..., nx,..., nvox, ndim, dim[0]. *//*--------------------------------------------------------------------*/ int nifti_update_dims_from_array( nifti_image * nim ) { int c, ndim; if( !nim ){ fprintf(stderr,"** update_dims: missing nim\n"); return 1; } if( g_opts.debug > 2 ){ fprintf(stderr,"+d updating image dimensions given nim->dim:"); for( c = 0; c < 8; c++ ) fprintf(stderr," %d", nim->dim[c]); fputc('\n',stderr); } /* verify dim[0] first */ if(nim->dim[0] < 1 || nim->dim[0] > 7){ fprintf(stderr,"** invalid dim[0], dim[] = "); for( c = 0; c < 8; c++ ) fprintf(stderr," %d", nim->dim[c]); fputc('\n',stderr); return 1; } /* set nx, ny ..., dx, dy, ..., one by one */ /* less than 1, set to 1, else copy */ if(nim->dim[1] < 1) nim->nx = nim->dim[1] = 1; else nim->nx = nim->dim[1]; nim->dx = nim->pixdim[1]; /* if undefined, or less than 1, set to 1 */ if(nim->dim[0] < 2 || (nim->dim[0] >= 2 && nim->dim[2] < 1)) nim->ny = nim->dim[2] = 1; else nim->ny = nim->dim[2]; /* copy delta values, in any case */ nim->dy = nim->pixdim[2]; if(nim->dim[0] < 3 || (nim->dim[0] >= 3 && nim->dim[3] < 1)) nim->nz = nim->dim[3] = 1; else /* just copy vals from arrays */ nim->nz = nim->dim[3]; nim->dz = nim->pixdim[3]; if(nim->dim[0] < 4 || (nim->dim[0] >= 4 && nim->dim[4] < 1)) nim->nt = nim->dim[4] = 1; else /* just copy vals from arrays */ nim->nt = nim->dim[4]; nim->dt = nim->pixdim[4]; if(nim->dim[0] < 5 || (nim->dim[0] >= 5 && nim->dim[5] < 1)) nim->nu = nim->dim[5] = 1; else /* just copy vals from arrays */ nim->nu = nim->dim[5]; nim->du = nim->pixdim[5]; if(nim->dim[0] < 6 || (nim->dim[0] >= 6 && nim->dim[6] < 1)) nim->nv = nim->dim[6] = 1; else /* just copy vals from arrays */ nim->nv = nim->dim[6]; nim->dv = nim->pixdim[6]; if(nim->dim[0] < 7 || (nim->dim[0] >= 7 && nim->dim[7] < 1)) nim->nw = nim->dim[7] = 1; else /* just copy vals from arrays */ nim->nw = nim->dim[7]; nim->dw = nim->pixdim[7]; for( c = 1, nim->nvox = 1; c <= nim->dim[0]; c++ ) nim->nvox *= nim->dim[c]; /* compute ndim, assuming it can be no larger than the old one */ for( ndim = nim->dim[0]; (ndim > 1) && (nim->dim[ndim] <= 1); ndim-- ) ; if( g_opts.debug > 2 ){ fprintf(stderr,"+d ndim = %d -> %d\n",nim->ndim, ndim); fprintf(stderr," --> (%d,%d,%d,%d,%d,%d,%d)\n", nim->nx, nim->ny, nim->nz, nim->nt, nim->nu, nim->nv, nim->nw); } nim->dim[0] = nim->ndim = ndim; return 0; } /*----------------------------------------------------------------------*/ /*! Load the image data from disk into an already-prepared image struct. * * \param nim - initialized nifti_image, without data * \param nbricks - the length of blist (must be 0 if blist is NULL) * \param blist - an array of xyz volume indices to read (can be NULL) * \param NBL - pointer to struct where resulting data will be stored * * If blist is NULL, read all sub-bricks. * * \return the number of loaded bricks (NBL->nbricks), * 0 on failure, < 0 on error * * NOTE: it is likely that another function will copy the data pointers * out of NBL, in which case the only pointer the calling function * will want to free is NBL->bricks (not each NBL->bricks[i]). *//*--------------------------------------------------------------------*/ int nifti_image_load_bricks( nifti_image * nim , int nbricks, const int * blist, nifti_brick_list * NBL ) { int * slist = NULL, * sindex = NULL, rv; znzFile fp; /* we can have blist == NULL */ if( !nim || !NBL ){ fprintf(stderr,"** nifti_image_load_bricks, bad params (%p,%p)\n", (void *)nim, (void *)NBL); return -1; } if( blist && nbricks <= 0 ){ if( g_opts.debug > 1 ) fprintf(stderr,"-d load_bricks: received blist with nbricks = %d," "ignoring blist\n", nbricks); blist = NULL; /* pretend nothing was passed */ } if( blist && ! valid_nifti_brick_list(nim, nbricks, blist, g_opts.debug>0) ) return -1; /* for efficiency, let's read the file in order */ if( blist && nifti_copynsort( nbricks, blist, &slist, &sindex ) != 0 ) return -1; /* open the file and position the FILE pointer */ fp = nifti_image_load_prep( nim ); if( !fp ){ if( g_opts.debug > 0 ) fprintf(stderr,"** nifti_image_load_bricks, failed load_prep\n"); if( blist ){ free(slist); free(sindex); } return -1; } /* this will flag to allocate defaults */ if( !blist ) nbricks = 0; if( nifti_alloc_NBL_mem( nim, nbricks, NBL ) != 0 ){ if( blist ){ free(slist); free(sindex); } znzclose(fp); return -1; } rv = nifti_load_NBL_bricks(nim, slist, sindex, NBL, fp); if( rv != 0 ){ nifti_free_NBL( NBL ); /* failure! */ NBL->nbricks = 0; /* repetative, but clear */ } if( slist ){ free(slist); free(sindex); } znzclose(fp); return NBL->nbricks; } /*----------------------------------------------------------------------*/ /*! nifti_free_NBL - free all pointers and clear structure * * note: this does not presume to free the structure pointer *//*--------------------------------------------------------------------*/ void nifti_free_NBL( nifti_brick_list * NBL ) { int c; if( NBL->bricks ){ for( c = 0; c < NBL->nbricks; c++ ) if( NBL->bricks[c] ) free(NBL->bricks[c]); free(NBL->bricks); NBL->bricks = NULL; } NBL->bsize = NBL->nbricks = 0; } /*---------------------------------------------------------------------- * nifti_load_NBL_bricks - read the file data into the NBL struct * * return 0 on success, -1 on failure *----------------------------------------------------------------------*/ static int nifti_load_NBL_bricks( nifti_image * nim , int * slist, int * sindex, nifti_brick_list * NBL, znzFile fp ) { size_t oposn, fposn; /* orig and current file positions */ size_t rv; long test; int c; int prev, isrc, idest; /* previous and current sub-brick, and new index */ test = znztell(fp); /* store current file position */ if( test < 0 ){ fprintf(stderr,"** load bricks: ztell failed??\n"); return -1; } fposn = oposn = test; /* first, handle the default case, no passed blist */ if( !slist ){ for( c = 0; c < NBL->nbricks; c++ ) { rv = nifti_read_buffer(fp, NBL->bricks[c], NBL->bsize, nim); if( rv != NBL->bsize ){ fprintf(stderr,"** load bricks: cannot read brick %d from '%s'\n", c, nim->iname ? nim->iname : nim->fname); return -1; } } if( g_opts.debug > 1 ) fprintf(stderr,"+d read %d default %u-byte bricks from file %s\n", NBL->nbricks, (unsigned int)NBL->bsize, nim->iname ? nim->iname:nim->fname ); return 0; } if( !sindex ){ fprintf(stderr,"** load_NBL_bricks: missing index list\n"); return -1; } prev = -1; /* use prev for previous sub-brick */ for( c = 0; c < NBL->nbricks; c++ ){ isrc = slist[c]; /* this is original brick index (c is new one) */ idest = sindex[c]; /* this is the destination index for this data */ /* if this sub-brick is not the previous, we must read from disk */ if( isrc != prev ){ /* if we are not looking at the correct sub-brick, scan forward */ if( fposn != (oposn + isrc*NBL->bsize) ){ fposn = oposn + isrc*NBL->bsize; if( znzseek(fp, (long)fposn, SEEK_SET) < 0 ){ fprintf(stderr,"** failed to locate brick %d in file '%s'\n", isrc, nim->iname ? nim->iname : nim->fname); return -1; } } /* only 10,000 lines later and we're actually reading something! */ rv = nifti_read_buffer(fp, NBL->bricks[idest], NBL->bsize, nim); if( rv != NBL->bsize ){ fprintf(stderr,"** failed to read brick %d from file '%s'\n", isrc, nim->iname ? nim->iname : nim->fname); if( g_opts.debug > 1 ) fprintf(stderr," (read %u of %u bytes)\n", (unsigned int)rv, (unsigned int)NBL->bsize); return -1; } fposn += NBL->bsize; } else { /* we have already read this sub-brick, just copy the previous one */ /* note that this works because they are sorted */ memcpy(NBL->bricks[idest], NBL->bricks[sindex[c-1]], NBL->bsize); } prev = isrc; /* in any case, note the now previous sub-brick */ } return 0; } /*---------------------------------------------------------------------- * nifti_alloc_NBL_mem - allocate memory for bricks * * return 0 on success, -1 on failure *----------------------------------------------------------------------*/ static int nifti_alloc_NBL_mem(nifti_image * nim, int nbricks, nifti_brick_list * nbl) { int c; /* if nbricks is not specified, use the default */ if( nbricks > 0 ) nbl->nbricks = nbricks; else { /* I missed this one with the 1.17 change 02 Mar 2006 [rickr] */ nbl->nbricks = 1; for( c = 4; c <= nim->ndim; c++ ) nbl->nbricks *= nim->dim[c]; } nbl->bsize = (size_t)nim->nx * nim->ny * nim->nz * nim->nbyper;/* bytes */ nbl->bricks = (void **)malloc(nbl->nbricks * sizeof(void *)); if( ! nbl->bricks ){ fprintf(stderr,"** NANM: failed to alloc %d void ptrs\n",nbricks); return -1; } for( c = 0; c < nbl->nbricks; c++ ){ nbl->bricks[c] = (void *)malloc(nbl->bsize); if( ! nbl->bricks[c] ){ fprintf(stderr,"** NANM: failed to alloc %u bytes for brick %d\n", (unsigned int)nbl->bsize, c); /* so free and clear everything before returning */ while( c > 0 ){ c--; free(nbl->bricks[c]); } free(nbl->bricks); nbl->bricks = NULL; nbl->bsize = nbl->nbricks = 0; return -1; } } if( g_opts.debug > 2 ) fprintf(stderr,"+d NANM: alloc'd %d bricks of %u bytes for NBL\n", nbl->nbricks, (unsigned int)nbl->bsize); return 0; } /*---------------------------------------------------------------------- * nifti_copynsort - copy int list, and sort with indices * * 1. duplicate the incoming list * 2. create an sindex list, and init with 0..nbricks-1 * 3. do a slow insertion sort on the small slist, along with sindex list * 4. check results, just to be positive * * So slist is sorted, and sindex hold original positions. * * return 0 on success, -1 on failure *----------------------------------------------------------------------*/ static int nifti_copynsort(int nbricks, const int * blist, int ** slist, int ** sindex) { int * stmp, * itmp; /* for ease of typing/reading */ int c1, c2, spos, tmp; *slist = (int *)malloc(nbricks * sizeof(int)); *sindex = (int *)malloc(nbricks * sizeof(int)); if( !*slist || !*sindex ){ fprintf(stderr,"** NCS: failed to alloc %d ints for sorting\n",nbricks); if(*slist) free(*slist); /* maybe one succeeded */ if(*sindex) free(*sindex); return -1; } /* init the lists */ memcpy(*slist, blist, nbricks*sizeof(int)); for( c1 = 0; c1 < nbricks; c1++ ) (*sindex)[c1] = c1; /* now actually sort slist */ stmp = *slist; itmp = *sindex; for( c1 = 0; c1 < nbricks-1; c1++ ) { /* find smallest value, init to current */ spos = c1; for( c2 = c1+1; c2 < nbricks; c2++ ) if( stmp[c2] < stmp[spos] ) spos = c2; if( spos != c1 ) /* swap: fine, don't maintain sub-order, see if I care */ { tmp = stmp[c1]; /* first swap the sorting values */ stmp[c1] = stmp[spos]; stmp[spos] = tmp; tmp = itmp[c1]; /* then swap the index values */ itmp[c1] = itmp[spos]; itmp[spos] = tmp; } } if( g_opts.debug > 2 ){ fprintf(stderr, "+d sorted indexing list:\n"); fprintf(stderr, " orig : "); for( c1 = 0; c1 < nbricks; c1++ ) fprintf(stderr," %d",blist[c1]); fprintf(stderr,"\n new : "); for( c1 = 0; c1 < nbricks; c1++ ) fprintf(stderr," %d",stmp[c1]); fprintf(stderr,"\n indices: "); for( c1 = 0; c1 < nbricks; c1++ ) fprintf(stderr," %d",itmp[c1]); fputc('\n', stderr); } /* check the sort (why not? I've got time...) */ for( c1 = 0; c1 < nbricks-1; c1++ ){ if( (stmp[c1] > stmp[c1+1]) || (blist[itmp[c1]] != stmp[c1]) ){ fprintf(stderr,"** sorting screw-up, way to go, rick!\n"); free(stmp); free(itmp); *slist = NULL; *sindex = NULL; return -1; } } if( g_opts.debug > 2 ) fprintf(stderr,"-d sorting is okay\n"); return 0; } /*----------------------------------------------------------------------*/ /*! valid_nifti_brick_list - check sub-brick list for image * * This function verifies that nbricks and blist are appropriate * for use with this nim, based on the dimensions. * * \param nim nifti_image to check against * \param nbricks number of brick indices in blist * \param blist list of brick indices to check in nim * \param disp_error if this flag is set, report errors to user * * \return 1 if valid, 0 if not *//*--------------------------------------------------------------------*/ int valid_nifti_brick_list(nifti_image * nim , int nbricks, const int * blist, int disp_error) { int c, nsubs; if( !nim ){ if( disp_error || g_opts.debug > 0 ) fprintf(stderr,"** valid_nifti_brick_list: missing nifti image\n"); return 0; } if( nbricks <= 0 || !blist ){ if( disp_error || g_opts.debug > 1 ) fprintf(stderr,"** valid_nifti_brick_list: no brick list to check\n"); return 0; } if( nim->dim[0] < 3 ){ if( disp_error || g_opts.debug > 1 ) fprintf(stderr,"** cannot read explict brick list from %d-D dataset\n", nim->dim[0]); return 0; } /* nsubs sub-brick is nt*nu*nv*nw */ for( c = 4, nsubs = 1; c <= nim->dim[0]; c++ ) nsubs *= nim->dim[c]; if( nsubs <= 0 ){ fprintf(stderr,"** VNBL warning: bad dim list (%d,%d,%d,%d)\n", nim->dim[4], nim->dim[5], nim->dim[6], nim->dim[7]); return 0; } for( c = 0; c < nbricks; c++ ) if( (blist[c] < 0) || (blist[c] >= nsubs) ){ if( disp_error || g_opts.debug > 1 ) fprintf(stderr, "** volume index %d (#%d) is out of range [0,%d]\n", blist[c], c, nsubs-1); return 0; } return 1; /* all is well */ } /*----------------------------------------------------------------------*/ /* verify that NBL struct is a valid data source for the image * * return 1 if so, 0 otherwise *//*--------------------------------------------------------------------*/ static int nifti_NBL_matches_nim(const nifti_image *nim, const nifti_brick_list *NBL) { size_t volbytes = 0; /* bytes per volume */ int ind, errs = 0, nvols = 0; if( !nim || !NBL ) { if( g_opts.debug > 0 ) fprintf(stderr,"** nifti_NBL_matches_nim: NULL pointer(s)\n"); return 0; } /* for nim, compute volbytes and nvols */ if( nim->ndim > 0 ) { /* first 3 indices are over a single volume */ volbytes = (size_t)nim->nbyper; for( ind = 1; ind <= nim->ndim && ind < 4; ind++ ) volbytes *= (size_t)nim->dim[ind]; for( ind = 4, nvols = 1; ind <= nim->ndim; ind++ ) nvols *= nim->dim[ind]; } if( volbytes != NBL->bsize ) { if( g_opts.debug > 1 ) fprintf(stderr,"** NBL/nim mismatch, volbytes = %u, %u\n", (unsigned)NBL->bsize, (unsigned)volbytes); errs++; } if( nvols != NBL->nbricks ) { if( g_opts.debug > 1 ) fprintf(stderr,"** NBL/nim mismatch, nvols = %d, %d\n", NBL->nbricks, nvols); errs++; } if( errs ) return 0; else if ( g_opts.debug > 2 ) fprintf(stderr,"-- nim/NBL agree: nvols = %d, nbytes = %u\n", nvols, (unsigned)volbytes); return 1; } /* end of new nifti_image_read_bricks() functionality */ /*----------------------------------------------------------------------*/ /*! display the orientation from the quaternian fields * * \param mesg if non-NULL, display this message first * \param mat the matrix to convert to "nearest" orientation * * \return -1 if results cannot be determined, 0 if okay *//*--------------------------------------------------------------------*/ int nifti_disp_matrix_orient( const char * mesg, mat44 mat ) { int i, j, k; if ( mesg ) fputs( mesg, stderr ); /* use stdout? */ nifti_mat44_to_orientation( mat, &i,&j,&k ); if ( i <= 0 || j <= 0 || k <= 0 ) return -1; /* so we have good codes */ fprintf(stderr, " i orientation = '%s'\n" " j orientation = '%s'\n" " k orientation = '%s'\n", nifti_orientation_string(i), nifti_orientation_string(j), nifti_orientation_string(k) ); return 0; } /*----------------------------------------------------------------------*/ /*! duplicate the given string (alloc length+1) * * \return allocated pointer (or NULL on failure) *//*--------------------------------------------------------------------*/ char *nifti_strdup(const char *str) { char *dup; if( !str ) return NULL; /* allow calls passing NULL */ dup = (char *)malloc(strlen(str) + 1); /* check for failure */ if( dup ) strcpy(dup, str); else fprintf(stderr,"** nifti_strdup: failed to alloc %u bytes\n", (unsigned int)strlen(str)+1); return dup; } /*---------------------------------------------------------------------------*/ /*! Return a pointer to a string holding the name of a NIFTI datatype. \param dt NIfTI-1 datatype \return pointer to static string holding the datatype name \warning Do not free() or modify this string! It points to static storage. \sa NIFTI1_DATATYPES group in nifti1.h *//*-------------------------------------------------------------------------*/ char *nifti_datatype_string( int dt ) { switch( dt ){ case DT_UNKNOWN: return "UNKNOWN" ; case DT_BINARY: return "BINARY" ; case DT_INT8: return "INT8" ; case DT_UINT8: return "UINT8" ; case DT_INT16: return "INT16" ; case DT_UINT16: return "UINT16" ; case DT_INT32: return "INT32" ; case DT_UINT32: return "UINT32" ; case DT_INT64: return "INT64" ; case DT_UINT64: return "UINT64" ; case DT_FLOAT32: return "FLOAT32" ; case DT_FLOAT64: return "FLOAT64" ; case DT_FLOAT128: return "FLOAT128" ; case DT_COMPLEX64: return "COMPLEX64" ; case DT_COMPLEX128: return "COMPLEX128" ; case DT_COMPLEX256: return "COMPLEX256" ; case DT_RGB24: return "RGB24" ; case DT_RGBA32: return "RGBA32" ; } return "**ILLEGAL**" ; } /*----------------------------------------------------------------------*/ /*! Determine if the datatype code dt is an integer type (1=YES, 0=NO). \return whether the given NIfTI-1 datatype code is valid \sa NIFTI1_DATATYPES group in nifti1.h *//*--------------------------------------------------------------------*/ int nifti_is_inttype( int dt ) { switch( dt ){ case DT_UNKNOWN: return 0 ; case DT_BINARY: return 0 ; case DT_INT8: return 1 ; case DT_UINT8: return 1 ; case DT_INT16: return 1 ; case DT_UINT16: return 1 ; case DT_INT32: return 1 ; case DT_UINT32: return 1 ; case DT_INT64: return 1 ; case DT_UINT64: return 1 ; case DT_FLOAT32: return 0 ; case DT_FLOAT64: return 0 ; case DT_FLOAT128: return 0 ; case DT_COMPLEX64: return 0 ; case DT_COMPLEX128: return 0 ; case DT_COMPLEX256: return 0 ; case DT_RGB24: return 1 ; case DT_RGBA32: return 1 ; } return 0 ; } /*---------------------------------------------------------------------------*/ /*! Return a pointer to a string holding the name of a NIFTI units type. \param uu NIfTI-1 unit code \return pointer to static string for the given unit type \warning Do not free() or modify this string! It points to static storage. \sa NIFTI1_UNITS group in nifti1.h *//*-------------------------------------------------------------------------*/ char *nifti_units_string( int uu ) { switch( uu ){ case NIFTI_UNITS_METER: return "m" ; case NIFTI_UNITS_MM: return "mm" ; case NIFTI_UNITS_MICRON: return "um" ; case NIFTI_UNITS_SEC: return "s" ; case NIFTI_UNITS_MSEC: return "ms" ; case NIFTI_UNITS_USEC: return "us" ; case NIFTI_UNITS_HZ: return "Hz" ; case NIFTI_UNITS_PPM: return "ppm" ; case NIFTI_UNITS_RADS: return "rad/s" ; } return "Unknown" ; } /*---------------------------------------------------------------------------*/ /*! Return a pointer to a string holding the name of a NIFTI transform type. \param xx NIfTI-1 xform code \return pointer to static string describing xform code \warning Do not free() or modify this string! It points to static storage. \sa NIFTI1_XFORM_CODES group in nifti1.h *//*-------------------------------------------------------------------------*/ char *nifti_xform_string( int xx ) { switch( xx ){ case NIFTI_XFORM_SCANNER_ANAT: return "Scanner Anat" ; case NIFTI_XFORM_ALIGNED_ANAT: return "Aligned Anat" ; case NIFTI_XFORM_TALAIRACH: return "Talairach" ; case NIFTI_XFORM_MNI_152: return "MNI_152" ; } return "Unknown" ; } /*---------------------------------------------------------------------------*/ /*! Return a pointer to a string holding the name of a NIFTI intent type. \param ii NIfTI-1 intent code \return pointer to static string describing code \warning Do not free() or modify this string! It points to static storage. \sa NIFTI1_INTENT_CODES group in nifti1.h *//*-------------------------------------------------------------------------*/ char *nifti_intent_string( int ii ) { switch( ii ){ case NIFTI_INTENT_CORREL: return "Correlation statistic" ; case NIFTI_INTENT_TTEST: return "T-statistic" ; case NIFTI_INTENT_FTEST: return "F-statistic" ; case NIFTI_INTENT_ZSCORE: return "Z-score" ; case NIFTI_INTENT_CHISQ: return "Chi-squared distribution" ; case NIFTI_INTENT_BETA: return "Beta distribution" ; case NIFTI_INTENT_BINOM: return "Binomial distribution" ; case NIFTI_INTENT_GAMMA: return "Gamma distribution" ; case NIFTI_INTENT_POISSON: return "Poisson distribution" ; case NIFTI_INTENT_NORMAL: return "Normal distribution" ; case NIFTI_INTENT_FTEST_NONC: return "F-statistic noncentral" ; case NIFTI_INTENT_CHISQ_NONC: return "Chi-squared noncentral" ; case NIFTI_INTENT_LOGISTIC: return "Logistic distribution" ; case NIFTI_INTENT_LAPLACE: return "Laplace distribution" ; case NIFTI_INTENT_UNIFORM: return "Uniform distribition" ; case NIFTI_INTENT_TTEST_NONC: return "T-statistic noncentral" ; case NIFTI_INTENT_WEIBULL: return "Weibull distribution" ; case NIFTI_INTENT_CHI: return "Chi distribution" ; case NIFTI_INTENT_INVGAUSS: return "Inverse Gaussian distribution" ; case NIFTI_INTENT_EXTVAL: return "Extreme Value distribution" ; case NIFTI_INTENT_PVAL: return "P-value" ; case NIFTI_INTENT_LOGPVAL: return "Log P-value" ; case NIFTI_INTENT_LOG10PVAL: return "Log10 P-value" ; case NIFTI_INTENT_ESTIMATE: return "Estimate" ; case NIFTI_INTENT_LABEL: return "Label index" ; case NIFTI_INTENT_NEURONAME: return "NeuroNames index" ; case NIFTI_INTENT_GENMATRIX: return "General matrix" ; case NIFTI_INTENT_SYMMATRIX: return "Symmetric matrix" ; case NIFTI_INTENT_DISPVECT: return "Displacement vector" ; case NIFTI_INTENT_VECTOR: return "Vector" ; case NIFTI_INTENT_POINTSET: return "Pointset" ; case NIFTI_INTENT_TRIANGLE: return "Triangle" ; case NIFTI_INTENT_QUATERNION: return "Quaternion" ; case NIFTI_INTENT_DIMLESS: return "Dimensionless number" ; } return "Unknown" ; } /*---------------------------------------------------------------------------*/ /*! Return a pointer to a string holding the name of a NIFTI slice_code. \param ss NIfTI-1 slice order code \return pointer to static string describing code \warning Do not free() or modify this string! It points to static storage. \sa NIFTI1_SLICE_ORDER group in nifti1.h *//*-------------------------------------------------------------------------*/ char *nifti_slice_string( int ss ) { switch( ss ){ case NIFTI_SLICE_SEQ_INC: return "sequential_increasing" ; case NIFTI_SLICE_SEQ_DEC: return "sequential_decreasing" ; case NIFTI_SLICE_ALT_INC: return "alternating_increasing" ; case NIFTI_SLICE_ALT_DEC: return "alternating_decreasing" ; case NIFTI_SLICE_ALT_INC2: return "alternating_increasing_2" ; case NIFTI_SLICE_ALT_DEC2: return "alternating_decreasing_2" ; } return "Unknown" ; } /*---------------------------------------------------------------------------*/ /*! Return a pointer to a string holding the name of a NIFTI orientation. \param ii orientation code \return pointer to static string holding the orientation information \warning Do not free() or modify the return string! It points to static storage. \sa NIFTI_L2R in nifti1_io.h *//*-------------------------------------------------------------------------*/ char *nifti_orientation_string( int ii ) { switch( ii ){ case NIFTI_L2R: return "Left-to-Right" ; case NIFTI_R2L: return "Right-to-Left" ; case NIFTI_P2A: return "Posterior-to-Anterior" ; case NIFTI_A2P: return "Anterior-to-Posterior" ; case NIFTI_I2S: return "Inferior-to-Superior" ; case NIFTI_S2I: return "Superior-to-Inferior" ; } return "Unknown" ; } /*--------------------------------------------------------------------------*/ /*! Given a datatype code, set number of bytes per voxel and the swapsize. \param datatype nifti1 datatype code \param nbyper pointer to return value: number of bytes per voxel \param swapsize pointer to return value: size of swap blocks \return appropriate values at nbyper and swapsize The swapsize is set to 0 if this datatype doesn't ever need swapping. \sa NIFTI1_DATATYPES in nifti1.h *//*------------------------------------------------------------------------*/ void nifti_datatype_sizes( int datatype , int *nbyper, int *swapsize ) { int nb=0, ss=0 ; switch( datatype ){ case DT_INT8: case DT_UINT8: nb = 1 ; ss = 0 ; break ; case DT_INT16: case DT_UINT16: nb = 2 ; ss = 2 ; break ; case DT_RGB24: nb = 3 ; ss = 0 ; break ; case DT_RGBA32: nb = 4 ; ss = 0 ; break ; case DT_INT32: case DT_UINT32: case DT_FLOAT32: nb = 4 ; ss = 4 ; break ; case DT_COMPLEX64: nb = 8 ; ss = 4 ; break ; case DT_FLOAT64: case DT_INT64: case DT_UINT64: nb = 8 ; ss = 8 ; break ; case DT_FLOAT128: nb = 16 ; ss = 16 ; break ; case DT_COMPLEX128: nb = 16 ; ss = 8 ; break ; case DT_COMPLEX256: nb = 32 ; ss = 16 ; break ; } ASSIF(nbyper,nb) ; ASSIF(swapsize,ss) ; return ; } /*---------------------------------------------------------------------------*/ /*! Given the quaternion parameters (etc.), compute a transformation matrix. See comments in nifti1.h for details. - qb,qc,qd = quaternion parameters - qx,qy,qz = offset parameters - dx,dy,dz = grid stepsizes (non-negative inputs are set to 1.0) - qfac = sign of dz step (< 0 is negative; >= 0 is positive)
   If qx=qy=qz=0, dx=dy=dz=1, then the output is a rotation matrix.
   For qfac >= 0, the rotation is proper.
   For qfac <  0, the rotation is improper.
   
\see "QUATERNION REPRESENTATION OF ROTATION MATRIX" in nifti1.h \see nifti_mat44_to_quatern, nifti_make_orthog_mat44, nifti_mat44_to_orientation *//*-------------------------------------------------------------------------*/ mat44 nifti_quatern_to_mat44( float qb, float qc, float qd, float qx, float qy, float qz, float dx, float dy, float dz, float qfac ) { mat44 R ; double a,b=qb,c=qc,d=qd , xd,yd,zd ; /* last row is always [ 0 0 0 1 ] */ R.m[3][0]=R.m[3][1]=R.m[3][2] = 0.0 ; R.m[3][3]= 1.0 ; /* compute a parameter from b,c,d */ a = 1.0l - (b*b + c*c + d*d) ; if( a < 1.e-7l ){ /* special case */ a = 1.0l / sqrt(b*b+c*c+d*d) ; b *= a ; c *= a ; d *= a ; /* normalize (b,c,d) vector */ a = 0.0l ; /* a = 0 ==> 180 degree rotation */ } else{ a = sqrt(a) ; /* angle = 2*arccos(a) */ } /* load rotation matrix, including scaling factors for voxel sizes */ xd = (dx > 0.0) ? dx : 1.0l ; /* make sure are positive */ yd = (dy > 0.0) ? dy : 1.0l ; zd = (dz > 0.0) ? dz : 1.0l ; if( qfac < 0.0 ) zd = -zd ; /* left handedness? */ R.m[0][0] = (a*a+b*b-c*c-d*d) * xd ; R.m[0][1] = 2.0l * (b*c-a*d ) * yd ; R.m[0][2] = 2.0l * (b*d+a*c ) * zd ; R.m[1][0] = 2.0l * (b*c+a*d ) * xd ; R.m[1][1] = (a*a+c*c-b*b-d*d) * yd ; R.m[1][2] = 2.0l * (c*d-a*b ) * zd ; R.m[2][0] = 2.0l * (b*d-a*c ) * xd ; R.m[2][1] = 2.0l * (c*d+a*b ) * yd ; R.m[2][2] = (a*a+d*d-c*c-b*b) * zd ; /* load offsets */ R.m[0][3] = qx ; R.m[1][3] = qy ; R.m[2][3] = qz ; return R ; } /*---------------------------------------------------------------------------*/ /*! Given the 3x4 upper corner of the matrix R, compute the quaternion parameters that fit it. - Any NULL pointer on input won't get assigned (e.g., if you don't want dx,dy,dz, just pass NULL in for those pointers). - If the 3 input matrix columns are NOT orthogonal, they will be orthogonalized prior to calculating the parameters, using the polar decomposition to find the orthogonal matrix closest to the column-normalized input matrix. - However, if the 3 input matrix columns are NOT orthogonal, then the matrix produced by nifti_quatern_to_mat44 WILL have orthogonal columns, so it won't be the same as the matrix input here. This "feature" is because the NIFTI 'qform' transform is deliberately not fully general -- it is intended to model a volume with perpendicular axes. - If the 3 input matrix columns are not even linearly independent, you'll just have to take your luck, won't you? \see "QUATERNION REPRESENTATION OF ROTATION MATRIX" in nifti1.h \see nifti_quatern_to_mat44, nifti_make_orthog_mat44, nifti_mat44_to_orientation *//*-------------------------------------------------------------------------*/ void nifti_mat44_to_quatern( mat44 R , float *qb, float *qc, float *qd, float *qx, float *qy, float *qz, float *dx, float *dy, float *dz, float *qfac ) { double r11,r12,r13 , r21,r22,r23 , r31,r32,r33 ; double xd,yd,zd , a,b,c,d ; mat33 P,Q ; /* offset outputs are read write out of input matrix */ ASSIF(qx,R.m[0][3]) ; ASSIF(qy,R.m[1][3]) ; ASSIF(qz,R.m[2][3]) ; /* load 3x3 matrix into local variables */ r11 = R.m[0][0] ; r12 = R.m[0][1] ; r13 = R.m[0][2] ; r21 = R.m[1][0] ; r22 = R.m[1][1] ; r23 = R.m[1][2] ; r31 = R.m[2][0] ; r32 = R.m[2][1] ; r33 = R.m[2][2] ; /* compute lengths of each column; these determine grid spacings */ xd = sqrt( r11*r11 + r21*r21 + r31*r31 ) ; yd = sqrt( r12*r12 + r22*r22 + r32*r32 ) ; zd = sqrt( r13*r13 + r23*r23 + r33*r33 ) ; /* if a column length is zero, patch the trouble */ if( xd == 0.0l ){ r11 = 1.0l ; r21 = r31 = 0.0l ; xd = 1.0l ; } if( yd == 0.0l ){ r22 = 1.0l ; r12 = r32 = 0.0l ; yd = 1.0l ; } if( zd == 0.0l ){ r33 = 1.0l ; r13 = r23 = 0.0l ; zd = 1.0l ; } /* assign the output lengths */ ASSIF(dx,xd) ; ASSIF(dy,yd) ; ASSIF(dz,zd) ; /* normalize the columns */ r11 /= xd ; r21 /= xd ; r31 /= xd ; r12 /= yd ; r22 /= yd ; r32 /= yd ; r13 /= zd ; r23 /= zd ; r33 /= zd ; /* At this point, the matrix has normal columns, but we have to allow for the fact that the hideous user may not have given us a matrix with orthogonal columns. So, now find the orthogonal matrix closest to the current matrix. One reason for using the polar decomposition to get this orthogonal matrix, rather than just directly orthogonalizing the columns, is so that inputting the inverse matrix to R will result in the inverse orthogonal matrix at this point. If we just orthogonalized the columns, this wouldn't necessarily hold. */ Q.m[0][0] = r11 ; Q.m[0][1] = r12 ; Q.m[0][2] = r13 ; /* load Q */ Q.m[1][0] = r21 ; Q.m[1][1] = r22 ; Q.m[1][2] = r23 ; Q.m[2][0] = r31 ; Q.m[2][1] = r32 ; Q.m[2][2] = r33 ; P = nifti_mat33_polar(Q) ; /* P is orthog matrix closest to Q */ r11 = P.m[0][0] ; r12 = P.m[0][1] ; r13 = P.m[0][2] ; /* unload */ r21 = P.m[1][0] ; r22 = P.m[1][1] ; r23 = P.m[1][2] ; r31 = P.m[2][0] ; r32 = P.m[2][1] ; r33 = P.m[2][2] ; /* [ r11 r12 r13 ] */ /* at this point, the matrix [ r21 r22 r23 ] is orthogonal */ /* [ r31 r32 r33 ] */ /* compute the determinant to determine if it is proper */ zd = r11*r22*r33-r11*r32*r23-r21*r12*r33 +r21*r32*r13+r31*r12*r23-r31*r22*r13 ; /* should be -1 or 1 */ if( zd > 0 ){ /* proper */ ASSIF(qfac,1.0) ; } else { /* improper ==> flip 3rd column */ ASSIF(qfac,-1.0) ; r13 = -r13 ; r23 = -r23 ; r33 = -r33 ; } /* now, compute quaternion parameters */ a = r11 + r22 + r33 + 1.0l ; if( a > 0.5l ){ /* simplest case */ a = 0.5l * sqrt(a) ; b = 0.25l * (r32-r23) / a ; c = 0.25l * (r13-r31) / a ; d = 0.25l * (r21-r12) / a ; } else { /* trickier case */ xd = 1.0 + r11 - (r22+r33) ; /* 4*b*b */ yd = 1.0 + r22 - (r11+r33) ; /* 4*c*c */ zd = 1.0 + r33 - (r11+r22) ; /* 4*d*d */ if( xd > 1.0 ){ b = 0.5l * sqrt(xd) ; c = 0.25l* (r12+r21) / b ; d = 0.25l* (r13+r31) / b ; a = 0.25l* (r32-r23) / b ; } else if( yd > 1.0 ){ c = 0.5l * sqrt(yd) ; b = 0.25l* (r12+r21) / c ; d = 0.25l* (r23+r32) / c ; a = 0.25l* (r13-r31) / c ; } else { d = 0.5l * sqrt(zd) ; b = 0.25l* (r13+r31) / d ; c = 0.25l* (r23+r32) / d ; a = 0.25l* (r21-r12) / d ; } if( a < 0.0l ){ b=-b ; c=-c ; d=-d; a=-a; } } ASSIF(qb,b) ; ASSIF(qc,c) ; ASSIF(qd,d) ; return ; } /*---------------------------------------------------------------------------*/ /*! Compute the inverse of a bordered 4x4 matrix.
   - Some numerical code fragments were generated by Maple 8.
   - If a singular matrix is input, the output matrix will be all zero.
   - You can check for this by examining the [3][3] element, which will
     be 1.0 for the normal case and 0.0 for the bad case.

     The input matrix should have the form:
        [ r11 r12 r13 v1 ]
        [ r21 r22 r23 v2 ]
        [ r31 r32 r33 v3 ]
        [  0   0   0   1 ]
     
*//*-------------------------------------------------------------------------*/ mat44 nifti_mat44_inverse( mat44 R ) { double r11,r12,r13,r21,r22,r23,r31,r32,r33,v1,v2,v3 , deti ; mat44 Q ; /* INPUT MATRIX IS: */ r11 = R.m[0][0]; r12 = R.m[0][1]; r13 = R.m[0][2]; /* [ r11 r12 r13 v1 ] */ r21 = R.m[1][0]; r22 = R.m[1][1]; r23 = R.m[1][2]; /* [ r21 r22 r23 v2 ] */ r31 = R.m[2][0]; r32 = R.m[2][1]; r33 = R.m[2][2]; /* [ r31 r32 r33 v3 ] */ v1 = R.m[0][3]; v2 = R.m[1][3]; v3 = R.m[2][3]; /* [ 0 0 0 1 ] */ deti = r11*r22*r33-r11*r32*r23-r21*r12*r33 +r21*r32*r13+r31*r12*r23-r31*r22*r13 ; if( deti != 0.0l ) deti = 1.0l / deti ; Q.m[0][0] = deti*( r22*r33-r32*r23) ; Q.m[0][1] = deti*(-r12*r33+r32*r13) ; Q.m[0][2] = deti*( r12*r23-r22*r13) ; Q.m[0][3] = deti*(-r12*r23*v3+r12*v2*r33+r22*r13*v3 -r22*v1*r33-r32*r13*v2+r32*v1*r23) ; Q.m[1][0] = deti*(-r21*r33+r31*r23) ; Q.m[1][1] = deti*( r11*r33-r31*r13) ; Q.m[1][2] = deti*(-r11*r23+r21*r13) ; Q.m[1][3] = deti*( r11*r23*v3-r11*v2*r33-r21*r13*v3 +r21*v1*r33+r31*r13*v2-r31*v1*r23) ; Q.m[2][0] = deti*( r21*r32-r31*r22) ; Q.m[2][1] = deti*(-r11*r32+r31*r12) ; Q.m[2][2] = deti*( r11*r22-r21*r12) ; Q.m[2][3] = deti*(-r11*r22*v3+r11*r32*v2+r21*r12*v3 -r21*r32*v1-r31*r12*v2+r31*r22*v1) ; Q.m[3][0] = Q.m[3][1] = Q.m[3][2] = 0.0l ; Q.m[3][3] = (deti == 0.0l) ? 0.0l : 1.0l ; /* failure flag if deti == 0 */ return Q ; } /*---------------------------------------------------------------------------*/ /*! Input 9 floats and make an orthgonal mat44 out of them. Each row is normalized, then nifti_mat33_polar() is used to orthogonalize them. If row #3 (r31,r32,r33) is input as zero, then it will be taken to be the cross product of rows #1 and #2. This function can be used to create a rotation matrix for transforming an oblique volume to anatomical coordinates. For this application: - row #1 (r11,r12,r13) is the direction vector along the image i-axis - row #2 (r21,r22,r23) is the direction vector along the image j-axis - row #3 (r31,r32,r33) is the direction vector along the slice direction (if available; otherwise enter it as 0's) The first 2 rows can be taken from the DICOM attribute (0020,0037) "Image Orientation (Patient)". After forming the rotation matrix, the complete affine transformation from (i,j,k) grid indexes to (x,y,z) spatial coordinates can be computed by multiplying each column by the appropriate grid spacing: - column #1 (R.m[0][0],R.m[1][0],R.m[2][0]) by delta-x - column #2 (R.m[0][1],R.m[1][1],R.m[2][1]) by delta-y - column #3 (R.m[0][2],R.m[1][2],R.m[2][2]) by delta-z and by then placing the center (x,y,z) coordinates of voxel (0,0,0) into the column #4 (R.m[0][3],R.m[1][3],R.m[2][3]). \sa nifti_quatern_to_mat44, nifti_mat44_to_quatern, nifti_mat44_to_orientation *//*-------------------------------------------------------------------------*/ mat44 nifti_make_orthog_mat44( float r11, float r12, float r13 , float r21, float r22, float r23 , float r31, float r32, float r33 ) { mat44 R ; mat33 Q , P ; double val ; R.m[3][0] = R.m[3][1] = R.m[3][2] = 0.0l ; R.m[3][3] = 1.0l ; Q.m[0][0] = r11 ; Q.m[0][1] = r12 ; Q.m[0][2] = r13 ; /* load Q */ Q.m[1][0] = r21 ; Q.m[1][1] = r22 ; Q.m[1][2] = r23 ; Q.m[2][0] = r31 ; Q.m[2][1] = r32 ; Q.m[2][2] = r33 ; /* normalize row 1 */ val = Q.m[0][0]*Q.m[0][0] + Q.m[0][1]*Q.m[0][1] + Q.m[0][2]*Q.m[0][2] ; if( val > 0.0l ){ val = 1.0l / sqrt(val) ; Q.m[0][0] *= val ; Q.m[0][1] *= val ; Q.m[0][2] *= val ; } else { Q.m[0][0] = 1.0l ; Q.m[0][1] = 0.0l ; Q.m[0][2] = 0.0l ; } /* normalize row 2 */ val = Q.m[1][0]*Q.m[1][0] + Q.m[1][1]*Q.m[1][1] + Q.m[1][2]*Q.m[1][2] ; if( val > 0.0l ){ val = 1.0l / sqrt(val) ; Q.m[1][0] *= val ; Q.m[1][1] *= val ; Q.m[1][2] *= val ; } else { Q.m[1][0] = 0.0l ; Q.m[1][1] = 1.0l ; Q.m[1][2] = 0.0l ; } /* normalize row 3 */ val = Q.m[2][0]*Q.m[2][0] + Q.m[2][1]*Q.m[2][1] + Q.m[2][2]*Q.m[2][2] ; if( val > 0.0l ){ val = 1.0l / sqrt(val) ; Q.m[2][0] *= val ; Q.m[2][1] *= val ; Q.m[2][2] *= val ; } else { Q.m[2][0] = Q.m[0][1]*Q.m[1][2] - Q.m[0][2]*Q.m[1][1] ; /* cross */ Q.m[2][1] = Q.m[0][2]*Q.m[1][0] - Q.m[0][0]*Q.m[1][2] ; /* product */ Q.m[2][2] = Q.m[0][0]*Q.m[1][1] - Q.m[0][1]*Q.m[1][0] ; } P = nifti_mat33_polar(Q) ; /* P is orthog matrix closest to Q */ R.m[0][0] = P.m[0][0] ; R.m[0][1] = P.m[0][1] ; R.m[0][2] = P.m[0][2] ; R.m[1][0] = P.m[1][0] ; R.m[1][1] = P.m[1][1] ; R.m[1][2] = P.m[1][2] ; R.m[2][0] = P.m[2][0] ; R.m[2][1] = P.m[2][1] ; R.m[2][2] = P.m[2][2] ; R.m[0][3] = R.m[1][3] = R.m[2][3] = 0.0 ; return R ; } /*----------------------------------------------------------------------*/ /*! compute the inverse of a 3x3 matrix *//*--------------------------------------------------------------------*/ mat33 nifti_mat33_inverse( mat33 R ) /* inverse of 3x3 matrix */ { double r11,r12,r13,r21,r22,r23,r31,r32,r33 , deti ; mat33 Q ; /* INPUT MATRIX: */ r11 = R.m[0][0]; r12 = R.m[0][1]; r13 = R.m[0][2]; /* [ r11 r12 r13 ] */ r21 = R.m[1][0]; r22 = R.m[1][1]; r23 = R.m[1][2]; /* [ r21 r22 r23 ] */ r31 = R.m[2][0]; r32 = R.m[2][1]; r33 = R.m[2][2]; /* [ r31 r32 r33 ] */ deti = r11*r22*r33-r11*r32*r23-r21*r12*r33 +r21*r32*r13+r31*r12*r23-r31*r22*r13 ; if( deti != 0.0l ) deti = 1.0l / deti ; Q.m[0][0] = deti*( r22*r33-r32*r23) ; Q.m[0][1] = deti*(-r12*r33+r32*r13) ; Q.m[0][2] = deti*( r12*r23-r22*r13) ; Q.m[1][0] = deti*(-r21*r33+r31*r23) ; Q.m[1][1] = deti*( r11*r33-r31*r13) ; Q.m[1][2] = deti*(-r11*r23+r21*r13) ; Q.m[2][0] = deti*( r21*r32-r31*r22) ; Q.m[2][1] = deti*(-r11*r32+r31*r12) ; Q.m[2][2] = deti*( r11*r22-r21*r12) ; return Q ; } /*----------------------------------------------------------------------*/ /*! compute the determinant of a 3x3 matrix *//*--------------------------------------------------------------------*/ float nifti_mat33_determ( mat33 R ) /* determinant of 3x3 matrix */ { double r11,r12,r13,r21,r22,r23,r31,r32,r33 ; /* INPUT MATRIX: */ r11 = R.m[0][0]; r12 = R.m[0][1]; r13 = R.m[0][2]; /* [ r11 r12 r13 ] */ r21 = R.m[1][0]; r22 = R.m[1][1]; r23 = R.m[1][2]; /* [ r21 r22 r23 ] */ r31 = R.m[2][0]; r32 = R.m[2][1]; r33 = R.m[2][2]; /* [ r31 r32 r33 ] */ return r11*r22*r33-r11*r32*r23-r21*r12*r33 +r21*r32*r13+r31*r12*r23-r31*r22*r13 ; } /*----------------------------------------------------------------------*/ /*! compute the max row norm of a 3x3 matrix *//*--------------------------------------------------------------------*/ float nifti_mat33_rownorm( mat33 A ) /* max row norm of 3x3 matrix */ { float r1,r2,r3 ; r1 = fabs(A.m[0][0])+fabs(A.m[0][1])+fabs(A.m[0][2]) ; r2 = fabs(A.m[1][0])+fabs(A.m[1][1])+fabs(A.m[1][2]) ; r3 = fabs(A.m[2][0])+fabs(A.m[2][1])+fabs(A.m[2][2]) ; if( r1 < r2 ) r1 = r2 ; if( r1 < r3 ) r1 = r3 ; return r1 ; } /*----------------------------------------------------------------------*/ /*! compute the max column norm of a 3x3 matrix *//*--------------------------------------------------------------------*/ float nifti_mat33_colnorm( mat33 A ) /* max column norm of 3x3 matrix */ { float r1,r2,r3 ; r1 = fabs(A.m[0][0])+fabs(A.m[1][0])+fabs(A.m[2][0]) ; r2 = fabs(A.m[0][1])+fabs(A.m[1][1])+fabs(A.m[2][1]) ; r3 = fabs(A.m[0][2])+fabs(A.m[1][2])+fabs(A.m[2][2]) ; if( r1 < r2 ) r1 = r2 ; if( r1 < r3 ) r1 = r3 ; return r1 ; } /*----------------------------------------------------------------------*/ /*! multiply 2 3x3 matrices *//*--------------------------------------------------------------------*/ mat33 nifti_mat33_mul( mat33 A , mat33 B ) /* multiply 2 3x3 matrices */ { mat33 C ; int i,j ; for( i=0 ; i < 3 ; i++ ) for( j=0 ; j < 3 ; j++ ) C.m[i][j] = A.m[i][0] * B.m[0][j] + A.m[i][1] * B.m[1][j] + A.m[i][2] * B.m[2][j] ; return C ; } /*---------------------------------------------------------------------------*/ /*! polar decomposition of a 3x3 matrix This finds the closest orthogonal matrix to input A (in both the Frobenius and L2 norms). Algorithm is that from NJ Higham, SIAM J Sci Stat Comput, 7:1160-1174. *//*-------------------------------------------------------------------------*/ mat33 nifti_mat33_polar( mat33 A ) { mat33 X , Y , Z ; float alp,bet,gam,gmi , dif=1.0 ; int k=0 ; X = A ; /* force matrix to be nonsingular */ gam = nifti_mat33_determ(X) ; while( gam == 0.0 ){ /* perturb matrix */ gam = 0.00001 * ( 0.001 + nifti_mat33_rownorm(X) ) ; X.m[0][0] += gam ; X.m[1][1] += gam ; X.m[2][2] += gam ; gam = nifti_mat33_determ(X) ; } while(1){ Y = nifti_mat33_inverse(X) ; if( dif > 0.3 ){ /* far from convergence */ alp = sqrt( nifti_mat33_rownorm(X) * nifti_mat33_colnorm(X) ) ; bet = sqrt( nifti_mat33_rownorm(Y) * nifti_mat33_colnorm(Y) ) ; gam = sqrt( bet / alp ) ; gmi = 1.0 / gam ; } else { gam = gmi = 1.0 ; /* close to convergence */ } Z.m[0][0] = 0.5 * ( gam*X.m[0][0] + gmi*Y.m[0][0] ) ; Z.m[0][1] = 0.5 * ( gam*X.m[0][1] + gmi*Y.m[1][0] ) ; Z.m[0][2] = 0.5 * ( gam*X.m[0][2] + gmi*Y.m[2][0] ) ; Z.m[1][0] = 0.5 * ( gam*X.m[1][0] + gmi*Y.m[0][1] ) ; Z.m[1][1] = 0.5 * ( gam*X.m[1][1] + gmi*Y.m[1][1] ) ; Z.m[1][2] = 0.5 * ( gam*X.m[1][2] + gmi*Y.m[2][1] ) ; Z.m[2][0] = 0.5 * ( gam*X.m[2][0] + gmi*Y.m[0][2] ) ; Z.m[2][1] = 0.5 * ( gam*X.m[2][1] + gmi*Y.m[1][2] ) ; Z.m[2][2] = 0.5 * ( gam*X.m[2][2] + gmi*Y.m[2][2] ) ; dif = fabs(Z.m[0][0]-X.m[0][0])+fabs(Z.m[0][1]-X.m[0][1]) +fabs(Z.m[0][2]-X.m[0][2])+fabs(Z.m[1][0]-X.m[1][0]) +fabs(Z.m[1][1]-X.m[1][1])+fabs(Z.m[1][2]-X.m[1][2]) +fabs(Z.m[2][0]-X.m[2][0])+fabs(Z.m[2][1]-X.m[2][1]) +fabs(Z.m[2][2]-X.m[2][2]) ; k = k+1 ; if( k > 100 || dif < 3.e-6 ) break ; /* convergence or exhaustion */ X = Z ; } return Z ; } /*---------------------------------------------------------------------------*/ /*! compute the (closest) orientation from a 4x4 ijk->xyz tranformation matrix
   Input:  4x4 matrix that transforms (i,j,k) indexes to (x,y,z) coordinates,
           where +x=Right, +y=Anterior, +z=Superior.
           (Only the upper-left 3x3 corner of R is used herein.)
   Output: 3 orientation codes that correspond to the closest "standard"
           anatomical orientation of the (i,j,k) axes.
   Method: Find which permutation of (x,y,z) has the smallest angle to the
           (i,j,k) axes directions, which are the columns of the R matrix.
   Errors: The codes returned will be zero.

   For example, an axial volume might get return values of
     *icod = NIFTI_R2L   (i axis is mostly Right to Left)
     *jcod = NIFTI_P2A   (j axis is mostly Posterior to Anterior)
     *kcod = NIFTI_I2S   (k axis is mostly Inferior to Superior)
   
\see "QUATERNION REPRESENTATION OF ROTATION MATRIX" in nifti1.h \see nifti_quatern_to_mat44, nifti_mat44_to_quatern, nifti_make_orthog_mat44 *//*-------------------------------------------------------------------------*/ void nifti_mat44_to_orientation( mat44 R , int *icod, int *jcod, int *kcod ) { float xi,xj,xk , yi,yj,yk , zi,zj,zk , val,detQ,detP ; mat33 P , Q , M ; int i,j,k=0,p,q,r , ibest,jbest,kbest,pbest,qbest,rbest ; float vbest ; if( icod == NULL || jcod == NULL || kcod == NULL ) return ; /* bad */ *icod = *jcod = *kcod = 0 ; /* error returns, if sh*t happens */ /* load column vectors for each (i,j,k) direction from matrix */ /*-- i axis --*/ /*-- j axis --*/ /*-- k axis --*/ xi = R.m[0][0] ; xj = R.m[0][1] ; xk = R.m[0][2] ; yi = R.m[1][0] ; yj = R.m[1][1] ; yk = R.m[1][2] ; zi = R.m[2][0] ; zj = R.m[2][1] ; zk = R.m[2][2] ; /* normalize column vectors to get unit vectors along each ijk-axis */ /* normalize i axis */ val = sqrt( xi*xi + yi*yi + zi*zi ) ; if( val == 0.0 ) return ; /* stupid input */ xi /= val ; yi /= val ; zi /= val ; /* normalize j axis */ val = sqrt( xj*xj + yj*yj + zj*zj ) ; if( val == 0.0 ) return ; /* stupid input */ xj /= val ; yj /= val ; zj /= val ; /* orthogonalize j axis to i axis, if needed */ val = xi*xj + yi*yj + zi*zj ; /* dot product between i and j */ if( fabs(val) > 1.e-4 ){ xj -= val*xi ; yj -= val*yi ; zj -= val*zi ; val = sqrt( xj*xj + yj*yj + zj*zj ) ; /* must renormalize */ if( val == 0.0 ) return ; /* j was parallel to i? */ xj /= val ; yj /= val ; zj /= val ; } /* normalize k axis; if it is zero, make it the cross product i x j */ val = sqrt( xk*xk + yk*yk + zk*zk ) ; if( val == 0.0 ){ xk = yi*zj-zi*yj; yk = zi*xj-zj*xi ; zk=xi*yj-yi*xj ; } else { xk /= val ; yk /= val ; zk /= val ; } /* orthogonalize k to i */ val = xi*xk + yi*yk + zi*zk ; /* dot product between i and k */ if( fabs(val) > 1.e-4 ){ xk -= val*xi ; yk -= val*yi ; zk -= val*zi ; val = sqrt( xk*xk + yk*yk + zk*zk ) ; if( val == 0.0 ) return ; /* bad */ xk /= val ; yk /= val ; zk /= val ; } /* orthogonalize k to j */ val = xj*xk + yj*yk + zj*zk ; /* dot product between j and k */ if( fabs(val) > 1.e-4 ){ xk -= val*xj ; yk -= val*yj ; zk -= val*zj ; val = sqrt( xk*xk + yk*yk + zk*zk ) ; if( val == 0.0 ) return ; /* bad */ xk /= val ; yk /= val ; zk /= val ; } Q.m[0][0] = xi ; Q.m[0][1] = xj ; Q.m[0][2] = xk ; Q.m[1][0] = yi ; Q.m[1][1] = yj ; Q.m[1][2] = yk ; Q.m[2][0] = zi ; Q.m[2][1] = zj ; Q.m[2][2] = zk ; /* at this point, Q is the rotation matrix from the (i,j,k) to (x,y,z) axes */ detQ = nifti_mat33_determ( Q ) ; if( detQ == 0.0 ) return ; /* shouldn't happen unless user is a DUFIS */ /* Build and test all possible +1/-1 coordinate permutation matrices P; then find the P such that the rotation matrix M=PQ is closest to the identity, in the sense of M having the smallest total rotation angle. */ /* Despite the formidable looking 6 nested loops, there are only 3*3*3*2*2*2 = 216 passes, which will run very quickly. */ vbest = -666.0 ; ibest=pbest=qbest=rbest=1 ; jbest=2 ; kbest=3 ; for( i=1 ; i <= 3 ; i++ ){ /* i = column number to use for row #1 */ for( j=1 ; j <= 3 ; j++ ){ /* j = column number to use for row #2 */ if( i == j ) continue ; for( k=1 ; k <= 3 ; k++ ){ /* k = column number to use for row #3 */ if( i == k || j == k ) continue ; P.m[0][0] = P.m[0][1] = P.m[0][2] = P.m[1][0] = P.m[1][1] = P.m[1][2] = P.m[2][0] = P.m[2][1] = P.m[2][2] = 0.0 ; for( p=-1 ; p <= 1 ; p+=2 ){ /* p,q,r are -1 or +1 */ for( q=-1 ; q <= 1 ; q+=2 ){ /* and go into rows #1,2,3 */ for( r=-1 ; r <= 1 ; r+=2 ){ P.m[0][i-1] = p ; P.m[1][j-1] = q ; P.m[2][k-1] = r ; detP = nifti_mat33_determ(P) ; /* sign of permutation */ if( detP * detQ <= 0.0 ) continue ; /* doesn't match sign of Q */ M = nifti_mat33_mul(P,Q) ; /* angle of M rotation = 2.0*acos(0.5*sqrt(1.0+trace(M))) */ /* we want largest trace(M) == smallest angle == M nearest to I */ val = M.m[0][0] + M.m[1][1] + M.m[2][2] ; /* trace */ if( val > vbest ){ vbest = val ; ibest = i ; jbest = j ; kbest = k ; pbest = p ; qbest = q ; rbest = r ; } }}}}}} /* At this point ibest is 1 or 2 or 3; pbest is -1 or +1; etc. The matrix P that corresponds is the best permutation approximation to Q-inverse; that is, P (approximately) takes (x,y,z) coordinates to the (i,j,k) axes. For example, the first row of P (which contains pbest in column ibest) determines the way the i axis points relative to the anatomical (x,y,z) axes. If ibest is 2, then the i axis is along the y axis, which is direction P2A (if pbest > 0) or A2P (if pbest < 0). So, using ibest and pbest, we can assign the output code for the i axis. Mutatis mutandis for the j and k axes, of course. */ switch( ibest*pbest ){ case 1: i = NIFTI_L2R ; break ; case -1: i = NIFTI_R2L ; break ; case 2: i = NIFTI_P2A ; break ; case -2: i = NIFTI_A2P ; break ; case 3: i = NIFTI_I2S ; break ; case -3: i = NIFTI_S2I ; break ; } switch( jbest*qbest ){ case 1: j = NIFTI_L2R ; break ; case -1: j = NIFTI_R2L ; break ; case 2: j = NIFTI_P2A ; break ; case -2: j = NIFTI_A2P ; break ; case 3: j = NIFTI_I2S ; break ; case -3: j = NIFTI_S2I ; break ; } switch( kbest*rbest ){ case 1: k = NIFTI_L2R ; break ; case -1: k = NIFTI_R2L ; break ; case 2: k = NIFTI_P2A ; break ; case -2: k = NIFTI_A2P ; break ; case 3: k = NIFTI_I2S ; break ; case -3: k = NIFTI_S2I ; break ; } *icod = i ; *jcod = j ; *kcod = k ; return ; } /*---------------------------------------------------------------------------*/ /* Routines to swap byte arrays in various ways: - 2 at a time: ab -> ba [short] - 4 at a time: abcd -> dcba [int, float] - 8 at a time: abcdDCBA -> ABCDdcba [long long, double] - 16 at a time: abcdefghHGFEDCBA -> ABCDEFGHhgfedcba [long double] -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/ /*! swap each byte pair from the given list of n pairs * * Due to alignment of structures at some architectures (e.g. on ARM), * stick to char varaibles. * Fixes http://bugs.debian.org/446893 Yaroslav * *//*--------------------------------------------------------------------*/ void nifti_swap_2bytes( size_t n , void *ar ) /* 2 bytes at a time */ { register size_t ii ; unsigned char * cp1 = (unsigned char *)ar, * cp2 ; unsigned char tval; for( ii=0 ; ii < n ; ii++ ){ cp2 = cp1 + 1; tval = *cp1; *cp1 = *cp2; *cp2 = tval; cp1 += 2; } return ; } /*----------------------------------------------------------------------*/ /*! swap 4 bytes at a time from the given list of n sets of 4 bytes *//*--------------------------------------------------------------------*/ void nifti_swap_4bytes( size_t n , void *ar ) /* 4 bytes at a time */ { register size_t ii ; unsigned char * cp0 = (unsigned char *)ar, * cp1, * cp2 ; register unsigned char tval ; for( ii=0 ; ii < n ; ii++ ){ cp1 = cp0; cp2 = cp0+3; tval = *cp1; *cp1 = *cp2; *cp2 = tval; cp1++; cp2--; tval = *cp1; *cp1 = *cp2; *cp2 = tval; cp0 += 4; } return ; } /*----------------------------------------------------------------------*/ /*! swap 8 bytes at a time from the given list of n sets of 8 bytes * * perhaps use this style for the general Nbytes, as Yaroslav suggests *//*--------------------------------------------------------------------*/ void nifti_swap_8bytes( size_t n , void *ar ) /* 8 bytes at a time */ { register size_t ii ; unsigned char * cp0 = (unsigned char *)ar, * cp1, * cp2 ; register unsigned char tval ; for( ii=0 ; ii < n ; ii++ ){ cp1 = cp0; cp2 = cp0+7; while ( cp2 > cp1 ) /* unroll? */ { tval = *cp1 ; *cp1 = *cp2 ; *cp2 = tval ; cp1++; cp2--; } cp0 += 8; } return ; } /*----------------------------------------------------------------------*/ /*! swap 16 bytes at a time from the given list of n sets of 16 bytes *//*--------------------------------------------------------------------*/ void nifti_swap_16bytes( size_t n , void *ar ) /* 16 bytes at a time */ { register size_t ii ; unsigned char * cp0 = (unsigned char *)ar, * cp1, * cp2 ; register unsigned char tval ; for( ii=0 ; ii < n ; ii++ ){ cp1 = cp0; cp2 = cp0+15; while ( cp2 > cp1 ) { tval = *cp1 ; *cp1 = *cp2 ; *cp2 = tval ; cp1++; cp2--; } cp0 += 16; } return ; } #if 0 /* not important: save for version update 6 Jul 2010 [rickr] */ /*----------------------------------------------------------------------*/ /*! generic: swap siz bytes at a time from the given list of n sets *//*--------------------------------------------------------------------*/ void nifti_swap_bytes( size_t n , int siz , void *ar ) { register size_t ii ; unsigned char * cp0 = (unsigned char *)ar, * cp1, * cp2 ; register unsigned char tval ; for( ii=0 ; ii < n ; ii++ ){ cp1 = cp0; cp2 = cp0+(siz-1); while ( cp2 > cp1 ) { tval = *cp1 ; *cp1 = *cp2 ; *cp2 = tval ; cp1++; cp2--; } cp0 += siz; } return ; } #endif /*---------------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/ /*! based on siz, call the appropriate nifti_swap_Nbytes() function *//*--------------------------------------------------------------------*/ void nifti_swap_Nbytes( size_t n , int siz , void *ar ) /* subsuming case */ { switch( siz ){ case 2: nifti_swap_2bytes ( n , ar ) ; break ; case 4: nifti_swap_4bytes ( n , ar ) ; break ; case 8: nifti_swap_8bytes ( n , ar ) ; break ; case 16: nifti_swap_16bytes( n , ar ) ; break ; default: /* nifti_swap_bytes ( n , siz, ar ) ; */ fprintf(stderr,"** NIfTI: cannot swap in %d byte blocks\n", siz); break ; } return ; } /*-------------------------------------------------------------------------*/ /*! Byte swap NIFTI-1 file header in various places and ways. If is_nifti, swap all (even UNUSED) fields of NIfTI header. Else, swap as a nifti_analyze75 struct. *//*---------------------------------------------------------------------- */ void swap_nifti_header( struct nifti_1_header *h , int is_nifti ) { /* if ANALYZE, swap as such and return */ if( ! is_nifti ) { nifti_swap_as_analyze((nifti_analyze75 *)h); return; } /* otherwise, swap all NIFTI fields */ nifti_swap_4bytes(1, &h->sizeof_hdr); nifti_swap_4bytes(1, &h->extents); nifti_swap_2bytes(1, &h->session_error); nifti_swap_2bytes(8, h->dim); nifti_swap_4bytes(1, &h->intent_p1); nifti_swap_4bytes(1, &h->intent_p2); nifti_swap_4bytes(1, &h->intent_p3); nifti_swap_2bytes(1, &h->intent_code); nifti_swap_2bytes(1, &h->datatype); nifti_swap_2bytes(1, &h->bitpix); nifti_swap_2bytes(1, &h->slice_start); nifti_swap_4bytes(8, h->pixdim); nifti_swap_4bytes(1, &h->vox_offset); nifti_swap_4bytes(1, &h->scl_slope); nifti_swap_4bytes(1, &h->scl_inter); nifti_swap_2bytes(1, &h->slice_end); nifti_swap_4bytes(1, &h->cal_max); nifti_swap_4bytes(1, &h->cal_min); nifti_swap_4bytes(1, &h->slice_duration); nifti_swap_4bytes(1, &h->toffset); nifti_swap_4bytes(1, &h->glmax); nifti_swap_4bytes(1, &h->glmin); nifti_swap_2bytes(1, &h->qform_code); nifti_swap_2bytes(1, &h->sform_code); nifti_swap_4bytes(1, &h->quatern_b); nifti_swap_4bytes(1, &h->quatern_c); nifti_swap_4bytes(1, &h->quatern_d); nifti_swap_4bytes(1, &h->qoffset_x); nifti_swap_4bytes(1, &h->qoffset_y); nifti_swap_4bytes(1, &h->qoffset_z); nifti_swap_4bytes(4, h->srow_x); nifti_swap_4bytes(4, h->srow_y); nifti_swap_4bytes(4, h->srow_z); return ; } /*-------------------------------------------------------------------------*/ /*! Byte swap as an ANALYZE 7.5 header * * return non-zero on failure *//*---------------------------------------------------------------------- */ int nifti_swap_as_analyze( nifti_analyze75 * h ) { if( !h ) return 1; nifti_swap_4bytes(1, &h->sizeof_hdr); nifti_swap_4bytes(1, &h->extents); nifti_swap_2bytes(1, &h->session_error); nifti_swap_2bytes(8, h->dim); nifti_swap_2bytes(1, &h->unused8); nifti_swap_2bytes(1, &h->unused9); nifti_swap_2bytes(1, &h->unused10); nifti_swap_2bytes(1, &h->unused11); nifti_swap_2bytes(1, &h->unused12); nifti_swap_2bytes(1, &h->unused13); nifti_swap_2bytes(1, &h->unused14); nifti_swap_2bytes(1, &h->datatype); nifti_swap_2bytes(1, &h->bitpix); nifti_swap_2bytes(1, &h->dim_un0); nifti_swap_4bytes(8, h->pixdim); nifti_swap_4bytes(1, &h->vox_offset); nifti_swap_4bytes(1, &h->funused1); nifti_swap_4bytes(1, &h->funused2); nifti_swap_4bytes(1, &h->funused3); nifti_swap_4bytes(1, &h->cal_max); nifti_swap_4bytes(1, &h->cal_min); nifti_swap_4bytes(1, &h->compressed); nifti_swap_4bytes(1, &h->verified); nifti_swap_4bytes(1, &h->glmax); nifti_swap_4bytes(1, &h->glmin); nifti_swap_4bytes(1, &h->views); nifti_swap_4bytes(1, &h->vols_added); nifti_swap_4bytes(1, &h->start_field); nifti_swap_4bytes(1, &h->field_skip); nifti_swap_4bytes(1, &h->omax); nifti_swap_4bytes(1, &h->omin); nifti_swap_4bytes(1, &h->smax); nifti_swap_4bytes(1, &h->smin); return 0; } /*-------------------------------------------------------------------------*/ /*! OLD VERSION of swap_nifti_header (left for undo/compare operations) Byte swap NIFTI-1 file header in various places and ways. If is_nifti is nonzero, will also swap the NIFTI-specific components of the header; otherwise, only the components common to NIFTI and ANALYZE will be swapped. *//*---------------------------------------------------------------------- */ void old_swap_nifti_header( struct nifti_1_header *h , int is_nifti ) { /* this stuff is always present, for ANALYZE and NIFTI */ swap_4(h->sizeof_hdr) ; nifti_swap_2bytes( 8 , h->dim ) ; nifti_swap_4bytes( 8 , h->pixdim ) ; swap_2(h->datatype) ; swap_2(h->bitpix) ; swap_4(h->vox_offset); swap_4(h->cal_max); swap_4(h->cal_min); /* this stuff is NIFTI specific */ if( is_nifti ){ swap_4(h->intent_p1); swap_4(h->intent_p2); swap_4(h->intent_p3); swap_2(h->intent_code); swap_2(h->slice_start); swap_2(h->slice_end); swap_4(h->scl_slope); swap_4(h->scl_inter); swap_4(h->slice_duration); swap_4(h->toffset); swap_2(h->qform_code); swap_2(h->sform_code); swap_4(h->quatern_b); swap_4(h->quatern_c); swap_4(h->quatern_d); swap_4(h->qoffset_x); swap_4(h->qoffset_y); swap_4(h->qoffset_z); nifti_swap_4bytes(4,h->srow_x); nifti_swap_4bytes(4,h->srow_y); nifti_swap_4bytes(4,h->srow_z); } return ; } #define USE_STAT #ifdef USE_STAT /*---------------------------------------------------------------------------*/ /* Return the file length (0 if file not found or has no contents). This is a Unix-specific function, since it uses stat(). -----------------------------------------------------------------------------*/ #include #include /*---------------------------------------------------------------------------*/ /*! return the size of a file, in bytes \return size of file on success, -1 on error or no file changed to return int, -1 means no file or error 20 Dec 2004 [rickr] *//*-------------------------------------------------------------------------*/ int nifti_get_filesize( const char *pathname ) { struct stat buf ; int ii ; if( pathname == NULL || *pathname == '\0' ) return -1 ; ii = stat( pathname , &buf ); if( ii != 0 ) return -1 ; return (unsigned int)buf.st_size ; } #else /*---------- non-Unix version of the above, less efficient -----------*/ int nifti_get_filesize( const char *pathname ) { znzFile fp ; int len ; if( pathname == NULL || *pathname == '\0' ) return -1 ; fp = znzopen(pathname,"rb",0); if( znz_isnull(fp) ) return -1 ; znzseek(fp,0L,SEEK_END) ; len = znztell(fp) ; znzclose(fp) ; return len ; } #endif /* USE_STAT */ /*----------------------------------------------------------------------*/ /*! return the total volume size, in bytes This is computed as nvox * nbyper. *//*--------------------------------------------------------------------*/ size_t nifti_get_volsize(const nifti_image *nim) { return nim->nbyper * nim->nvox ; /* total bytes */ } /*--------------------------------------------------------------------------*/ /* Support functions for filenames in read and write - allows for gzipped files */ /*----------------------------------------------------------------------*/ /*! simple check for file existence \return 1 on existence, 0 otherwise *//*--------------------------------------------------------------------*/ int nifti_fileexists(const char* fname) { znzFile fp; fp = znzopen( fname , "rb" , 1 ) ; if( !znz_isnull(fp) ) { znzclose(fp); return 1; } return 0; /* fp is NULL */ } /*----------------------------------------------------------------------*/ /*! return whether the filename is valid Note: uppercase extensions are now valid. 27 Apr 2009 [rickr] The name is considered valid if the file basename has length greater than zero, AND one of the valid nifti extensions is provided. fname input | return | =============================== "myimage" | 0 | "myimage.tif" | 0 | "myimage.tif.gz" | 0 | "myimage.nii" | 1 | ".nii" | 0 | ".myhiddenimage" | 0 | ".myhiddenimage.nii" | 1 | *//*--------------------------------------------------------------------*/ int nifti_is_complete_filename(const char* fname) { char * ext; /* check input file(s) for sanity */ if( fname == NULL || *fname == '\0' ){ if ( g_opts.debug > 1 ) fprintf(stderr,"-- empty filename in nifti_validfilename()\n"); return 0; } ext = nifti_find_file_extension(fname); if ( ext == NULL ) { /*Invalid extension given */ if ( g_opts.debug > 0 ) fprintf(stderr,"-- no nifti valid extension for filename '%s'\n", fname); return 0; } if ( ext && ext == fname ) { /* then no filename prefix */ if ( g_opts.debug > 0 ) fprintf(stderr,"-- no prefix for filename '%s'\n", fname); return 0; } return 1; } /*----------------------------------------------------------------------*/ /*! return whether the filename is valid Allow uppercase extensions as valid. 27 Apr 2009 [rickr] Any .gz extension case must match the base extension case. The name is considered valid if its length is positive, excluding any nifti filename extension. fname input | return | result of nifti_makebasename ==================================================================== "myimage" | 1 | "myimage" "myimage.tif" | 1 | "myimage.tif" "myimage.tif.gz" | 1 | "myimage.tif" "myimage.nii" | 1 | "myimage" ".nii" | 0 | ".myhiddenimage" | 1 | ".myhiddenimage" ".myhiddenimage.nii | 1 | ".myhiddenimage" *//*--------------------------------------------------------------------*/ int nifti_validfilename(const char* fname) { char * ext; /* check input file(s) for sanity */ if( fname == NULL || *fname == '\0' ){ if ( g_opts.debug > 1 ) fprintf(stderr,"-- empty filename in nifti_validfilename()\n"); return 0; } ext = nifti_find_file_extension(fname); if ( ext && ext == fname ) { /* then no filename prefix */ if ( g_opts.debug > 0 ) fprintf(stderr,"-- no prefix for filename '%s'\n", fname); return 0; } return 1; } /*----------------------------------------------------------------------*/ /*! check the end of the filename for a valid nifti extension Valid extensions are currently .nii, .hdr, .img, .nia, or any of them followed by .gz. Note that '.' is part of the extension. Uppercase extensions are also valid, but not mixed case. \return a pointer to the extension (within the filename), or NULL *//*--------------------------------------------------------------------*/ char * nifti_find_file_extension( const char * name ) { char * ext, extcopy[8]; int len; char extnii[8] = ".nii"; /* modifiable, for possible uppercase */ char exthdr[8] = ".hdr"; /* (leave space for .gz) */ char extimg[8] = ".img"; char extnia[8] = ".nia"; char extgz[4] = ".gz"; char * elist[4] = { NULL, NULL, NULL, NULL}; /* stupid compiler... */ elist[0] = extnii; elist[1] = exthdr; elist[2] = extimg; elist[3] = extnia; if ( ! name ) return NULL; len = (int)strlen(name); if ( len < 4 ) return NULL; ext = (char *)name + len - 4; /* make manipulation copy, and possibly convert to lowercase */ strcpy(extcopy, ext); if( g_opts.allow_upper_fext ) make_lowercase(extcopy); /* if it look like a basic extension, fail or return it */ if( compare_strlist(extcopy, elist, 4) >= 0 ) { if( is_mixedcase(ext) ) { fprintf(stderr,"** mixed case extension '%s' is not valid\n", ext); return NULL; } else return ext; } #ifdef HAVE_ZLIB if ( len < 7 ) return NULL; ext = (char *)name + len - 7; /* make manipulation copy, and possibly convert to lowercase */ strcpy(extcopy, ext); if( g_opts.allow_upper_fext ) make_lowercase(extcopy); /* go after .gz extensions using the modifiable strings */ strcat(elist[0], extgz); strcat(elist[1], extgz); strcat(elist[2], extgz); if( compare_strlist(extcopy, elist, 3) >= 0 ) { if( is_mixedcase(ext) ) { fprintf(stderr,"** mixed case extension '%s' is not valid\n", ext); return NULL; } else return ext; } #endif if( g_opts.debug > 1 ) fprintf(stderr,"** find_file_ext: failed for name '%s'\n", name); return NULL; } /*----------------------------------------------------------------------*/ /*! return whether the filename ends in ".gz" *//*--------------------------------------------------------------------*/ int nifti_is_gzfile(const char* fname) { /* return true if the filename ends with .gz */ if (fname == NULL) { return 0; } #ifdef HAVE_ZLIB { /* just so len doesn't generate compile warning */ int len; len = (int)strlen(fname); if (len < 3) return 0; /* so we don't search before the name */ if (fileext_compare(fname + strlen(fname) - 3,".gz")==0) { return 1; } } #endif return 0; } /*----------------------------------------------------------------------*/ /*! return whether the given library was compiled with HAVE_ZLIB set *//*--------------------------------------------------------------------*/ int nifti_compiled_with_zlib(void) { #ifdef HAVE_ZLIB return 1; #else return 0; #endif } /*----------------------------------------------------------------------*/ /*! duplicate the filename, while clearing any extension This allocates memory for basename which should eventually be freed. *//*--------------------------------------------------------------------*/ char * nifti_makebasename(const char* fname) { char *basename, *ext; basename=nifti_strdup(fname); ext = nifti_find_file_extension(basename); if ( ext ) *ext = '\0'; /* clear out extension */ return basename; /* in either case */ } /*----------------------------------------------------------------------*/ /*! set nifti's global debug level, for status reporting - 0 : quiet, nothing is printed to the terminal, but errors - 1 : normal execution (the default) - 2, 3 : more details *//*--------------------------------------------------------------------*/ void nifti_set_debug_level( int level ) { g_opts.debug = level; } /*----------------------------------------------------------------------*/ /*! set nifti's global skip_blank_ext flag 5 Sep 2006 [rickr] explicitly set to 0 or 1 *//*--------------------------------------------------------------------*/ void nifti_set_skip_blank_ext( int skip ) { g_opts.skip_blank_ext = skip ? 1 : 0; } /*----------------------------------------------------------------------*/ /*! set nifti's global allow_upper_fext flag 28 Apr 2009 [rickr] explicitly set to 0 or 1 *//*--------------------------------------------------------------------*/ void nifti_set_allow_upper_fext( int allow ) { g_opts.allow_upper_fext = allow ? 1 : 0; } /*----------------------------------------------------------------------*/ /*! check current directory for existing header file \return filename of header on success and NULL if no appropriate file could be found If fname has an uppercase extension, check for uppercase files. NB: it allocates memory for hdrname which should be freed when no longer required *//*-------------------------------------------------------------------*/ char * nifti_findhdrname(const char* fname) { char *basename, *hdrname, *ext; char elist[2][5] = { ".hdr", ".nii" }; char extzip[4] = ".gz"; int efirst = 1; /* init to .nii extension */ int eisupper = 0; /* init to lowercase extensions */ /**- check input file(s) for sanity */ if( !nifti_validfilename(fname) ) return NULL; basename = nifti_makebasename(fname); if( !basename ) return NULL; /* only on string alloc failure */ /**- return filename if it has a valid extension and exists (except if it is an .img file (and maybe .gz)) */ ext = nifti_find_file_extension(fname); if( ext ) eisupper = is_uppercase(ext); /* do we look for uppercase? */ /* if the file exists and is a valid header name (not .img), return it */ if ( ext && nifti_fileexists(fname) ) { /* allow for uppercase extension */ if ( fileext_n_compare(ext,".img",4) != 0 ){ hdrname = nifti_strdup(fname); free(basename); return hdrname; } else efirst = 0; /* note for below */ } /* So the requested name is a basename, contains .img, or does not exist. */ /* In any case, use basename. */ /**- if .img, look for .hdr, .hdr.gz, .nii, .nii.gz, in that order */ /**- else, look for .nii, .nii.gz, .hdr, .hdr.gz, in that order */ /* if we get more extension choices, this could be a loop */ /* note: efirst is 0 in the case of ".img" */ /* if the user passed an uppercase entension (.IMG), search for uppercase */ if( eisupper ) { make_uppercase(elist[0]); make_uppercase(elist[1]); make_uppercase(extzip); } hdrname = (char *)calloc(sizeof(char),strlen(basename)+8); if( !hdrname ){ fprintf(stderr,"** nifti_findhdrname: failed to alloc hdrname\n"); free(basename); return NULL; } strcpy(hdrname,basename); strcat(hdrname,elist[efirst]); if (nifti_fileexists(hdrname)) { free(basename); return hdrname; } #ifdef HAVE_ZLIB strcat(hdrname,extzip); if (nifti_fileexists(hdrname)) { free(basename); return hdrname; } #endif /* okay, try the other possibility */ efirst = 1 - efirst; strcpy(hdrname,basename); strcat(hdrname,elist[efirst]); if (nifti_fileexists(hdrname)) { free(basename); return hdrname; } #ifdef HAVE_ZLIB strcat(hdrname,extzip); if (nifti_fileexists(hdrname)) { free(basename); return hdrname; } #endif /**- if nothing has been found, return NULL */ free(basename); free(hdrname); return NULL; } /*------------------------------------------------------------------------*/ /*! check current directory for existing image file \param fname filename to check for \nifti_type nifti_type for dataset - this determines whether to first check for ".nii" or ".img" (since both may exist) \return filename of data/img file on success and NULL if no appropriate file could be found If fname has a valid, uppercase extension, apply all extensions as uppercase. NB: it allocates memory for the image filename, which should be freed when no longer required *//*---------------------------------------------------------------------*/ char * nifti_findimgname(const char* fname , int nifti_type) { /* store all extensions as strings, in case we need to go uppercase */ char *basename, *imgname, elist[2][5] = { ".nii", ".img" }; char extzip[4] = ".gz"; char extnia[5] = ".nia"; char *ext; int first; /* first extension to use */ /* check input file(s) for sanity */ if( !nifti_validfilename(fname) ) return NULL; basename = nifti_makebasename(fname); imgname = (char *)calloc(sizeof(char),strlen(basename)+8); if( !imgname ){ fprintf(stderr,"** nifti_findimgname: failed to alloc imgname\n"); free(basename); return NULL; } /* if we are looking for uppercase, apply the fact now */ ext = nifti_find_file_extension(fname); if( ext && is_uppercase(ext) ) { make_uppercase(elist[0]); make_uppercase(elist[1]); make_uppercase(extzip); make_uppercase(extnia); } /* only valid extension for ASCII type is .nia, handle first */ if( nifti_type == NIFTI_FTYPE_ASCII ){ strcpy(imgname,basename); strcat(imgname,extnia); if (nifti_fileexists(imgname)) { free(basename); return imgname; } } else { /**- test for .nii and .img (don't assume input type from image type) */ /**- if nifti_type = 1, check for .nii first, else .img first */ /* if we get 3 or more extensions, can make a loop here... */ if (nifti_type == NIFTI_FTYPE_NIFTI1_1) first = 0; /* should match .nii */ else first = 1; /* should match .img */ strcpy(imgname,basename); strcat(imgname,elist[first]); if (nifti_fileexists(imgname)) { free(basename); return imgname; } #ifdef HAVE_ZLIB /* then also check for .gz */ strcat(imgname,extzip); if (nifti_fileexists(imgname)) { free(basename); return imgname; } #endif /* failed to find image file with expected extension, try the other */ strcpy(imgname,basename); strcat(imgname,elist[1-first]); /* can do this with only 2 choices */ if (nifti_fileexists(imgname)) { free(basename); return imgname; } #ifdef HAVE_ZLIB /* then also check for .gz */ strcat(imgname,extzip); if (nifti_fileexists(imgname)) { free(basename); return imgname; } #endif } /**- if nothing has been found, return NULL */ free(basename); free(imgname); return NULL; } /*----------------------------------------------------------------------*/ /*! creates a filename for storing the header, based on nifti_type \param prefix - this will be copied before the suffix is added \param nifti_type - determines the extension, unless one is in prefix \param check - check for existence (fail condition) \param comp - add .gz for compressed name Note that if prefix provides a file suffix, nifti_type is not used. NB: this allocates memory which should be freed \sa nifti_set_filenames *//*-------------------------------------------------------------------*/ char * nifti_makehdrname(const char * prefix, int nifti_type, int check, int comp) { char * iname, * ext; char extnii[5] = ".nii"; /* modifiable, for possible uppercase */ char exthdr[5] = ".hdr"; char extimg[5] = ".img"; char extnia[5] = ".nia"; char extgz[5] = ".gz"; if( !nifti_validfilename(prefix) ) return NULL; /* add space for extension, optional ".gz", and null char */ iname = (char *)calloc(sizeof(char),strlen(prefix)+8); if( !iname ){ fprintf(stderr,"** small malloc failure!\n"); return NULL; } strcpy(iname, prefix); /* use any valid extension */ if( (ext = nifti_find_file_extension(iname)) != NULL ){ /* if uppercase, convert all extensions */ if( is_uppercase(ext) ) { make_uppercase(extnii); make_uppercase(exthdr); make_uppercase(extimg); make_uppercase(extnia); make_uppercase(extgz); } if( strncmp(ext,extimg,4) == 0 ) memcpy(ext,exthdr,4); /* then convert img name to hdr */ } /* otherwise, make one up */ else if( nifti_type == NIFTI_FTYPE_NIFTI1_1 ) strcat(iname, extnii); else if( nifti_type == NIFTI_FTYPE_ASCII ) strcat(iname, extnia); else strcat(iname, exthdr); #ifdef HAVE_ZLIB /* if compression is requested, make sure of suffix */ if( comp && (!ext || !strstr(iname,extgz)) ) strcat(iname,extgz); #endif /* check for existence failure */ if( check && nifti_fileexists(iname) ){ fprintf(stderr,"** failure: header file '%s' already exists\n",iname); free(iname); return NULL; } if(g_opts.debug > 2) fprintf(stderr,"+d made header filename '%s'\n", iname); return iname; } /*----------------------------------------------------------------------*/ /*! creates a filename for storing the image, based on nifti_type \param prefix - this will be copied before the suffix is added \param nifti_type - determines the extension, unless provided by prefix \param check - check for existence (fail condition) \param comp - add .gz for compressed name Note that if prefix provides a file suffix, nifti_type is not used. NB: it allocates memory which should be freed \sa nifti_set_filenames *//*-------------------------------------------------------------------*/ char * nifti_makeimgname(const char * prefix, int nifti_type, int check, int comp) { char * iname, * ext; char extnii[5] = ".nii"; /* modifiable, for possible uppercase */ char exthdr[5] = ".hdr"; char extimg[5] = ".img"; char extnia[5] = ".nia"; char extgz[5] = ".gz"; if( !nifti_validfilename(prefix) ) return NULL; /* add space for extension, optional ".gz", and null char */ iname = (char *)calloc(sizeof(char),strlen(prefix)+8); if( !iname ){ fprintf(stderr,"** small malloc failure!\n"); return NULL; } strcpy(iname, prefix); /* use any valid extension */ if( (ext = nifti_find_file_extension(iname)) != NULL ){ /* if uppercase, convert all extensions */ if( is_uppercase(ext) ) { make_uppercase(extnii); make_uppercase(exthdr); make_uppercase(extimg); make_uppercase(extnia); make_uppercase(extgz); } if( strncmp(ext,exthdr,4) == 0 ) memcpy(ext,extimg,4); /* then convert hdr name to img */ } /* otherwise, make one up */ else if( nifti_type == NIFTI_FTYPE_NIFTI1_1 ) strcat(iname, extnii); else if( nifti_type == NIFTI_FTYPE_ASCII ) strcat(iname, extnia); else strcat(iname, extimg); #ifdef HAVE_ZLIB /* if compression is requested, make sure of suffix */ if( comp && (!ext || !strstr(iname,extgz)) ) strcat(iname,extgz); #endif /* check for existence failure */ if( check && nifti_fileexists(iname) ){ fprintf(stderr,"** failure: image file '%s' already exists\n",iname); free(iname); return NULL; } if( g_opts.debug > 2 ) fprintf(stderr,"+d made image filename '%s'\n",iname); return iname; } /*----------------------------------------------------------------------*/ /*! create and set new filenames, based on prefix and image type \param nim pointer to nifti_image in which to set filenames \param prefix (required) prefix for output filenames \param check check for previous existence of filename (existence is an error condition) \param set_byte_order flag to set nim->byteorder here (this is probably a logical place to do so) \return 0 on successful update \warning this will free() any existing names and create new ones \sa nifti_makeimgname, nifti_makehdrname, nifti_type_and_names_match *//*--------------------------------------------------------------------*/ int nifti_set_filenames( nifti_image * nim, const char * prefix, int check, int set_byte_order ) { int comp = nifti_is_gzfile(prefix); if( !nim || !prefix ){ fprintf(stderr,"** nifti_set_filenames, bad params %p, %p\n", (void *)nim,prefix); return -1; } if( g_opts.debug > 1 ) fprintf(stderr,"+d modifying output filenames using prefix %s\n", prefix); if( nim->fname ) free(nim->fname); if( nim->iname ) free(nim->iname); nim->fname = nifti_makehdrname(prefix, nim->nifti_type, check, comp); nim->iname = nifti_makeimgname(prefix, nim->nifti_type, check, comp); if( !nim->fname || !nim->iname ){ LNI_FERR("nifti_set_filename","failed to set prefix for",prefix); return -1; } if( set_byte_order ) nim->byteorder = nifti_short_order() ; if( nifti_set_type_from_names(nim) < 0 ) return -1; if( g_opts.debug > 2 ) fprintf(stderr,"+d have new filenames %s and %s\n",nim->fname,nim->iname); return 0; } /*--------------------------------------------------------------------------*/ /*! check whether nifti_type matches fname and iname for the nifti_image - if type 0 or 2, expect .hdr/.img pair - if type 1, expect .nii (and names must match) \param nim given nifti_image \param show_warn if set, print a warning message for any mis-match \return - 1 if the values seem to match - 0 if there is a mis-match - -1 if there is not sufficient information to create file(s) \sa NIFTI_FTYPE_* codes in nifti1_io.h \sa nifti_set_type_from_names, is_valid_nifti_type *//*------------------------------------------------------------------------*/ int nifti_type_and_names_match( nifti_image * nim, int show_warn ) { char func[] = "nifti_type_and_names_match"; char * ext_h, * ext_i; /* header and image filename extensions */ int errs = 0; /* error counter */ /* sanity checks */ if( !nim ){ if( show_warn ) fprintf(stderr,"** %s: missing nifti_image\n", func); return -1; } if( !nim->fname ){ if( show_warn ) fprintf(stderr,"** %s: missing header filename\n", func); errs++; } if( !nim->iname ){ if( show_warn ) fprintf(stderr,"** %s: missing image filename\n", func); errs++; } if( !is_valid_nifti_type(nim->nifti_type) ){ if( show_warn ) fprintf(stderr,"** %s: bad nifti_type %d\n", func, nim->nifti_type); errs++; } if( errs ) return -1; /* then do not proceed */ /* get pointers to extensions */ ext_h = nifti_find_file_extension( nim->fname ); ext_i = nifti_find_file_extension( nim->iname ); /* check for filename extensions */ if( !ext_h ){ if( show_warn ) fprintf(stderr,"-d missing NIFTI extension in header filename, %s\n", nim->fname); errs++; } if( !ext_i ){ if( show_warn ) fprintf(stderr,"-d missing NIFTI extension in image filename, %s\n", nim->iname); errs++; } if( errs ) return 0; /* do not proceed, but this is just a mis-match */ /* general tests */ if( nim->nifti_type == NIFTI_FTYPE_NIFTI1_1 ){ /* .nii */ if( fileext_n_compare(ext_h,".nii",4) ) { if( show_warn ) fprintf(stderr, "-d NIFTI_FTYPE 1, but no .nii extension in header filename, %s\n", nim->fname); errs++; } if( fileext_n_compare(ext_i,".nii",4) ) { if( show_warn ) fprintf(stderr, "-d NIFTI_FTYPE 1, but no .nii extension in image filename, %s\n", nim->iname); errs++; } if( strcmp(nim->fname, nim->iname) != 0 ){ if( show_warn ) fprintf(stderr, "-d NIFTI_FTYPE 1, but header and image filenames differ: %s, %s\n", nim->fname, nim->iname); errs++; } } else if( (nim->nifti_type == NIFTI_FTYPE_NIFTI1_2) || /* .hdr/.img */ (nim->nifti_type == NIFTI_FTYPE_ANALYZE) ) { if( fileext_n_compare(ext_h,".hdr",4) != 0 ){ if( show_warn ) fprintf(stderr,"-d no '.hdr' extension, but NIFTI type is %d, %s\n", nim->nifti_type, nim->fname); errs++; } if( fileext_n_compare(ext_i,".img",4) != 0 ){ if( show_warn ) fprintf(stderr,"-d no '.img' extension, but NIFTI type is %d, %s\n", nim->nifti_type, nim->iname); errs++; } } /* ignore any other nifti_type */ return 1; } /* like strcmp, but also check against capitalization of known_ext * (test as local string, with max length 7) */ static int fileext_compare(const char * test_ext, const char * known_ext) { char caps[8] = ""; int c, cmp, len; /* if equal, don't need to check case (store to avoid multiple calls) */ cmp = strcmp(test_ext, known_ext); if( cmp == 0 ) return cmp; /* if anything odd, use default */ if( !test_ext || !known_ext ) return cmp; len = strlen(known_ext); if( len > 7 ) return cmp; /* if here, strings are different but need to check upper-case */ for(c = 0; c < len; c++ ) caps[c] = toupper(known_ext[c]); caps[c] = '\0'; return strcmp(test_ext, caps); } /* like strncmp, but also check against capitalization of known_ext * (test as local string, with max length 7) */ static int fileext_n_compare(const char * test_ext, const char * known_ext, int maxlen) { char caps[8] = ""; int c, cmp, len; /* if equal, don't need to check case (store to avoid multiple calls) */ cmp = strncmp(test_ext, known_ext, maxlen); if( cmp == 0 ) return cmp; /* if anything odd, use default */ if( !test_ext || !known_ext ) return cmp; len = strlen(known_ext); if( len > maxlen ) len = maxlen; /* ignore anything past maxlen */ if( len > 7 ) return cmp; /* if here, strings are different but need to check upper-case */ for(c = 0; c < len; c++ ) caps[c] = toupper(known_ext[c]); caps[c] = '\0'; return strncmp(test_ext, caps, maxlen); } /* return 1 if there are uppercase but no lowercase */ static int is_uppercase(const char * str) { int c, hasupper = 0; if( !str || !*str ) return 0; for(c = 0; c < strlen(str); c++ ) { if( islower(str[c]) ) return 0; if( !hasupper && isupper(str[c]) ) hasupper = 1; } return hasupper; } /* return 1 if there are both uppercase and lowercase characters */ static int is_mixedcase(const char * str) { int c, hasupper = 0, haslower = 0; if( !str || !*str ) return 0; for(c = 0; c < strlen(str); c++ ) { if( !haslower && islower(str[c]) ) haslower = 1; if( !hasupper && isupper(str[c]) ) hasupper = 1; if( haslower && hasupper ) return 1; } return 0; } /* convert any lowercase chars to uppercase */ static int make_uppercase(char * str) { int c; if( !str || !*str ) return 0; for(c = 0; c < strlen(str); c++ ) if( islower(str[c]) ) str[c] = toupper(str[c]); return 0; } /* convert any uppercase chars to lowercase */ static int make_lowercase(char * str) { int c; if( !str || !*str ) return 0; for(c = 0; c < strlen(str); c++ ) if( isupper(str[c]) ) str[c] = tolower(str[c]); return 0; } /* run strcmp against of list of strings * return index of equality, if found * else return -1 */ static int compare_strlist(const char * str, char ** strlist, int len) { int c; if( len <= 0 || !str || !strlist ) return -1; for( c = 0; c < len; c++ ) if( strlist[c] && !strcmp(str, strlist[c]) ) return c; return -1; } /*--------------------------------------------------------------------------*/ /*! check whether the given type is on the "approved" list The code is valid if it is non-negative, and does not exceed NIFTI_MAX_FTYPE. \return 1 if nifti_type is valid, 0 otherwise \sa NIFTI_FTYPE_* codes in nifti1_io.h *//*------------------------------------------------------------------------*/ int is_valid_nifti_type( int nifti_type ) { if( nifti_type >= NIFTI_FTYPE_ANALYZE && /* smallest type, 0 */ nifti_type <= NIFTI_MAX_FTYPE ) return 1; return 0; } /*--------------------------------------------------------------------------*/ /*! check whether the given type is on the "approved" list The type is explicitly checked against the NIFTI_TYPE_* list in nifti1.h. \return 1 if dtype is valid, 0 otherwise \sa NIFTI_TYPE_* codes in nifti1.h *//*------------------------------------------------------------------------*/ int nifti_is_valid_datatype( int dtype ) { if( dtype == NIFTI_TYPE_UINT8 || dtype == NIFTI_TYPE_INT16 || dtype == NIFTI_TYPE_INT32 || dtype == NIFTI_TYPE_FLOAT32 || dtype == NIFTI_TYPE_COMPLEX64 || dtype == NIFTI_TYPE_FLOAT64 || dtype == NIFTI_TYPE_RGB24 || dtype == NIFTI_TYPE_RGBA32 || dtype == NIFTI_TYPE_INT8 || dtype == NIFTI_TYPE_UINT16 || dtype == NIFTI_TYPE_UINT32 || dtype == NIFTI_TYPE_INT64 || dtype == NIFTI_TYPE_UINT64 || dtype == NIFTI_TYPE_FLOAT128 || dtype == NIFTI_TYPE_COMPLEX128 || dtype == NIFTI_TYPE_COMPLEX256 ) return 1; return 0; } /*--------------------------------------------------------------------------*/ /*! set the nifti_type field based on fname and iname Note that nifti_type is changed only when it does not match the filenames. \return 0 on success, -1 on error \sa is_valid_nifti_type, nifti_type_and_names_match *//*------------------------------------------------------------------------*/ int nifti_set_type_from_names( nifti_image * nim ) { /* error checking first */ if( !nim ){ fprintf(stderr,"** NSTFN: no nifti_image\n"); return -1; } if( !nim->fname || !nim->iname ){ fprintf(stderr,"** NSTFN: missing filename(s) fname @ %p, iname @ %p\n", nim->fname, nim->iname); return -1; } if( ! nifti_validfilename ( nim->fname ) || ! nifti_validfilename ( nim->iname ) || ! nifti_find_file_extension( nim->fname ) || ! nifti_find_file_extension( nim->iname ) ) { fprintf(stderr,"** NSTFN: invalid filename(s) fname='%s', iname='%s'\n", nim->fname, nim->iname); return -1; } if( g_opts.debug > 2 ) fprintf(stderr,"-d verify nifti_type from filenames: %d",nim->nifti_type); /* type should be NIFTI_FTYPE_ASCII if extension is .nia */ if( (fileext_compare(nifti_find_file_extension(nim->fname),".nia")==0)){ nim->nifti_type = NIFTI_FTYPE_ASCII; } else { /* not too picky here, do what must be done, and then verify */ if( strcmp(nim->fname, nim->iname) == 0 ) /* one file, type 1 */ nim->nifti_type = NIFTI_FTYPE_NIFTI1_1; else if( nim->nifti_type == NIFTI_FTYPE_NIFTI1_1 ) /* cannot be type 1 */ nim->nifti_type = NIFTI_FTYPE_NIFTI1_2; } if( g_opts.debug > 2 ) fprintf(stderr," -> %d\n",nim->nifti_type); if( g_opts.debug > 1 ) /* warn user about anything strange */ nifti_type_and_names_match(nim, 1); if( is_valid_nifti_type(nim->nifti_type) ) return 0; /* success! */ fprintf(stderr,"** NSTFN: bad nifti_type %d, for '%s' and '%s'\n", nim->nifti_type, nim->fname, nim->iname); return -1; } /*--------------------------------------------------------------------------*/ /*! Determine if this is a NIFTI-formatted file.
   \return  0 if file looks like ANALYZE 7.5 [checks sizeof_hdr field == 348]
            1 if file marked as NIFTI (header+data in 1 file)
            2 if file marked as NIFTI (header+data in 2 files)
           -1 if it can't tell, file doesn't exist, etc.
   
*//*------------------------------------------------------------------------*/ int is_nifti_file( const char *hname ) { struct nifti_1_header nhdr ; znzFile fp ; int ii ; char *tmpname; /* bad input name? */ if( !nifti_validfilename(hname) ) return -1 ; /* open file */ tmpname = nifti_findhdrname(hname); if( tmpname == NULL ){ if( g_opts.debug > 0 ) fprintf(stderr,"** no header file found for '%s'\n",hname); return -1; } fp = znzopen( tmpname , "rb" , nifti_is_gzfile(tmpname) ) ; free(tmpname); if (znz_isnull(fp)) return -1 ; /* bad open? */ /* read header, close file */ ii = (int)znzread( &nhdr , 1 , sizeof(nhdr) , fp ) ; znzclose( fp ) ; if( ii < (int) sizeof(nhdr) ) return -1 ; /* bad read? */ /* check for NIFTI-ness */ if( NIFTI_VERSION(nhdr) != 0 ){ return ( NIFTI_ONEFILE(nhdr) ) ? 1 : 2 ; } /* check for ANALYZE-ness (sizeof_hdr field == 348) */ ii = nhdr.sizeof_hdr ; if( ii == (int)sizeof(nhdr) ) return 0 ; /* matches */ /* try byte-swapping header */ swap_4(ii) ; if( ii == (int)sizeof(nhdr) ) return 0 ; /* matches */ return -1 ; /* not good */ } static int print_hex_vals( const char * data, int nbytes, FILE * fp ) { int c; if ( !data || nbytes < 1 || !fp ) return -1; fputs("0x", fp); for ( c = 0; c < nbytes; c++ ) fprintf(fp, " %x", data[c]); return 0; } /*----------------------------------------------------------------------*/ /*! display the contents of the nifti_1_header (send to stdout) \param info if non-NULL, print this character string \param hp pointer to nifti_1_header *//*--------------------------------------------------------------------*/ int disp_nifti_1_header( const char * info, const nifti_1_header * hp ) { int c; fputs( "-------------------------------------------------------\n", stdout ); if ( info ) fputs( info, stdout ); if ( !hp ){ fputs(" ** no nifti_1_header to display!\n",stdout); return 1; } fprintf(stdout," nifti_1_header :\n" " sizeof_hdr = %d\n" " data_type[10] = ", hp->sizeof_hdr); print_hex_vals(hp->data_type, 10, stdout); fprintf(stdout, "\n" " db_name[18] = "); print_hex_vals(hp->db_name, 18, stdout); fprintf(stdout, "\n" " extents = %d\n" " session_error = %d\n" " regular = 0x%x\n" " dim_info = 0x%x\n", hp->extents, hp->session_error, hp->regular, hp->dim_info ); fprintf(stdout, " dim[8] ="); for ( c = 0; c < 8; c++ ) fprintf(stdout," %d", hp->dim[c]); fprintf(stdout, "\n" " intent_p1 = %f\n" " intent_p2 = %f\n" " intent_p3 = %f\n" " intent_code = %d\n" " datatype = %d\n" " bitpix = %d\n" " slice_start = %d\n" " pixdim[8] =", hp->intent_p1, hp->intent_p2, hp->intent_p3, hp->intent_code, hp->datatype, hp->bitpix, hp->slice_start); /* break pixdim over 2 lines */ for ( c = 0; c < 4; c++ ) fprintf(stdout," %f", hp->pixdim[c]); fprintf(stdout, "\n "); for ( c = 4; c < 8; c++ ) fprintf(stdout," %f", hp->pixdim[c]); fprintf(stdout, "\n" " vox_offset = %f\n" " scl_slope = %f\n" " scl_inter = %f\n" " slice_end = %d\n" " slice_code = %d\n" " xyzt_units = 0x%x\n" " cal_max = %f\n" " cal_min = %f\n" " slice_duration = %f\n" " toffset = %f\n" " glmax = %d\n" " glmin = %d\n", hp->vox_offset, hp->scl_slope, hp->scl_inter, hp->slice_end, hp->slice_code, hp->xyzt_units, hp->cal_max, hp->cal_min, hp->slice_duration, hp->toffset, hp->glmax, hp->glmin); fprintf(stdout, " descrip = '%.80s'\n" " aux_file = '%.24s'\n" " qform_code = %d\n" " sform_code = %d\n" " quatern_b = %f\n" " quatern_c = %f\n" " quatern_d = %f\n" " qoffset_x = %f\n" " qoffset_y = %f\n" " qoffset_z = %f\n" " srow_x[4] = %f, %f, %f, %f\n" " srow_y[4] = %f, %f, %f, %f\n" " srow_z[4] = %f, %f, %f, %f\n" " intent_name = '%-.16s'\n" " magic = '%-.4s'\n", hp->descrip, hp->aux_file, hp->qform_code, hp->sform_code, hp->quatern_b, hp->quatern_c, hp->quatern_d, hp->qoffset_x, hp->qoffset_y, hp->qoffset_z, hp->srow_x[0], hp->srow_x[1], hp->srow_x[2], hp->srow_x[3], hp->srow_y[0], hp->srow_y[1], hp->srow_y[2], hp->srow_y[3], hp->srow_z[0], hp->srow_z[1], hp->srow_z[2], hp->srow_z[3], hp->intent_name, hp->magic); fputs( "-------------------------------------------------------\n", stdout ); fflush(stdout); return 0; } #undef ERREX #define ERREX(msg) \ do{ fprintf(stderr,"** ERROR: nifti_convert_nhdr2nim: %s\n", (msg) ) ; \ return NULL ; } while(0) /*----------------------------------------------------------------------*/ /*! convert a nifti_1_header into a nift1_image \return an allocated nifti_image, or NULL on failure *//*--------------------------------------------------------------------*/ nifti_image* nifti_convert_nhdr2nim(struct nifti_1_header nhdr, const char * fname) { int ii , doswap , ioff ; int is_nifti , is_onefile ; nifti_image *nim; nim = (nifti_image *)calloc( 1 , sizeof(nifti_image) ) ; if( !nim ) ERREX("failed to allocate nifti image"); /* be explicit with pointers */ nim->fname = NULL; nim->iname = NULL; nim->data = NULL; /**- check if we must swap bytes */ doswap = need_nhdr_swap(nhdr.dim[0], nhdr.sizeof_hdr); /* swap data flag */ if( doswap < 0 ){ if( doswap == -1 ) ERREX("bad dim[0]") ; ERREX("bad sizeof_hdr") ; /* else */ } /**- determine if this is a NIFTI-1 compliant header */ is_nifti = NIFTI_VERSION(nhdr) ; /* * before swapping header, record the Analyze75 orient code */ if(!is_nifti) { /**- in analyze75, the orient code is at the same address as * qform_code, but it's just one byte * the qform_code will be zero, at which point you can check * analyze75_orient if you care to. */ unsigned char c = *((char *)(&nhdr.qform_code)); nim->analyze75_orient = (analyze_75_orient_code)c; } if( doswap ) { if ( g_opts.debug > 3 ) disp_nifti_1_header("-d ni1 pre-swap: ", &nhdr); swap_nifti_header( &nhdr , is_nifti ) ; } if ( g_opts.debug > 2 ) disp_nifti_1_header("-d nhdr2nim : ", &nhdr); if( nhdr.datatype == DT_BINARY || nhdr.datatype == DT_UNKNOWN ) ERREX("bad datatype") ; if( nhdr.dim[1] <= 0 ) ERREX("bad dim[1]") ; /* fix bad dim[] values in the defined dimension range */ for( ii=2 ; ii <= nhdr.dim[0] ; ii++ ) if( nhdr.dim[ii] <= 0 ) nhdr.dim[ii] = 1 ; /* fix any remaining bad dim[] values, so garbage does not propagate */ /* (only values 0 or 1 seem rational, otherwise set to arbirary 1) */ for( ii=nhdr.dim[0]+1 ; ii <= 7 ; ii++ ) if( nhdr.dim[ii] != 1 && nhdr.dim[ii] != 0) nhdr.dim[ii] = 1 ; #if 0 /* rely on dim[0], do not attempt to modify it 16 Nov 2005 [rickr] */ /**- get number of dimensions (ignoring dim[0] now) */ for( ii=7 ; ii >= 2 ; ii-- ) /* loop backwards until we */ if( nhdr.dim[ii] > 1 ) break ; /* find a dim bigger than 1 */ ndim = ii ; #endif /**- set bad grid spacings to 1.0 */ for( ii=1 ; ii <= nhdr.dim[0] ; ii++ ){ if( nhdr.pixdim[ii] == 0.0 || !IS_GOOD_FLOAT(nhdr.pixdim[ii]) ) nhdr.pixdim[ii] = 1.0 ; } is_onefile = is_nifti && NIFTI_ONEFILE(nhdr) ; if( is_nifti ) nim->nifti_type = (is_onefile) ? NIFTI_FTYPE_NIFTI1_1 : NIFTI_FTYPE_NIFTI1_2 ; else nim->nifti_type = NIFTI_FTYPE_ANALYZE ; ii = nifti_short_order() ; if( doswap ) nim->byteorder = REVERSE_ORDER(ii) ; else nim->byteorder = ii ; /**- set dimensions of data array */ nim->ndim = nim->dim[0] = nhdr.dim[0]; nim->nx = nim->dim[1] = nhdr.dim[1]; nim->ny = nim->dim[2] = nhdr.dim[2]; nim->nz = nim->dim[3] = nhdr.dim[3]; nim->nt = nim->dim[4] = nhdr.dim[4]; nim->nu = nim->dim[5] = nhdr.dim[5]; nim->nv = nim->dim[6] = nhdr.dim[6]; nim->nw = nim->dim[7] = nhdr.dim[7]; for( ii=1, nim->nvox=1; ii <= nhdr.dim[0]; ii++ ) nim->nvox *= nhdr.dim[ii]; /**- set the type of data in voxels and how many bytes per voxel */ nim->datatype = nhdr.datatype ; nifti_datatype_sizes( nim->datatype , &(nim->nbyper) , &(nim->swapsize) ) ; if( nim->nbyper == 0 ){ free(nim); ERREX("bad datatype"); } /**- set the grid spacings */ nim->dx = nim->pixdim[1] = nhdr.pixdim[1] ; nim->dy = nim->pixdim[2] = nhdr.pixdim[2] ; nim->dz = nim->pixdim[3] = nhdr.pixdim[3] ; nim->dt = nim->pixdim[4] = nhdr.pixdim[4] ; nim->du = nim->pixdim[5] = nhdr.pixdim[5] ; nim->dv = nim->pixdim[6] = nhdr.pixdim[6] ; nim->dw = nim->pixdim[7] = nhdr.pixdim[7] ; /**- compute qto_xyz transformation from pixel indexes (i,j,k) to (x,y,z) */ if( !is_nifti || nhdr.qform_code <= 0 ){ /**- if not nifti or qform_code <= 0, use grid spacing for qto_xyz */ nim->qto_xyz.m[0][0] = nim->dx ; /* grid spacings */ nim->qto_xyz.m[1][1] = nim->dy ; /* along diagonal */ nim->qto_xyz.m[2][2] = nim->dz ; /* off diagonal is zero */ nim->qto_xyz.m[0][1]=nim->qto_xyz.m[0][2]=nim->qto_xyz.m[0][3] = 0.0; nim->qto_xyz.m[1][0]=nim->qto_xyz.m[1][2]=nim->qto_xyz.m[1][3] = 0.0; nim->qto_xyz.m[2][0]=nim->qto_xyz.m[2][1]=nim->qto_xyz.m[2][3] = 0.0; /* last row is always [ 0 0 0 1 ] */ nim->qto_xyz.m[3][0]=nim->qto_xyz.m[3][1]=nim->qto_xyz.m[3][2] = 0.0; nim->qto_xyz.m[3][3]= 1.0 ; nim->qform_code = NIFTI_XFORM_UNKNOWN ; if( g_opts.debug > 1 ) fprintf(stderr,"-d no qform provided\n"); } else { /**- else NIFTI: use the quaternion-specified transformation */ nim->quatern_b = FIXED_FLOAT( nhdr.quatern_b ) ; nim->quatern_c = FIXED_FLOAT( nhdr.quatern_c ) ; nim->quatern_d = FIXED_FLOAT( nhdr.quatern_d ) ; nim->qoffset_x = FIXED_FLOAT(nhdr.qoffset_x) ; nim->qoffset_y = FIXED_FLOAT(nhdr.qoffset_y) ; nim->qoffset_z = FIXED_FLOAT(nhdr.qoffset_z) ; nim->qfac = (nhdr.pixdim[0] < 0.0) ? -1.0 : 1.0 ; /* left-handedness? */ nim->qto_xyz = nifti_quatern_to_mat44( nim->quatern_b, nim->quatern_c, nim->quatern_d, nim->qoffset_x, nim->qoffset_y, nim->qoffset_z, nim->dx , nim->dy , nim->dz , nim->qfac ) ; nim->qform_code = nhdr.qform_code ; if( g_opts.debug > 1 ) nifti_disp_matrix_orient("-d qform orientations:\n", nim->qto_xyz); } /**- load inverse transformation (x,y,z) -> (i,j,k) */ nim->qto_ijk = nifti_mat44_inverse( nim->qto_xyz ) ; /**- load sto_xyz affine transformation, if present */ if( !is_nifti || nhdr.sform_code <= 0 ){ /**- if not nifti or sform_code <= 0, then no sto transformation */ nim->sform_code = NIFTI_XFORM_UNKNOWN ; if( g_opts.debug > 1 ) fprintf(stderr,"-d no sform provided\n"); } else { /**- else set the sto transformation from srow_*[] */ nim->sto_xyz.m[0][0] = nhdr.srow_x[0] ; nim->sto_xyz.m[0][1] = nhdr.srow_x[1] ; nim->sto_xyz.m[0][2] = nhdr.srow_x[2] ; nim->sto_xyz.m[0][3] = nhdr.srow_x[3] ; nim->sto_xyz.m[1][0] = nhdr.srow_y[0] ; nim->sto_xyz.m[1][1] = nhdr.srow_y[1] ; nim->sto_xyz.m[1][2] = nhdr.srow_y[2] ; nim->sto_xyz.m[1][3] = nhdr.srow_y[3] ; nim->sto_xyz.m[2][0] = nhdr.srow_z[0] ; nim->sto_xyz.m[2][1] = nhdr.srow_z[1] ; nim->sto_xyz.m[2][2] = nhdr.srow_z[2] ; nim->sto_xyz.m[2][3] = nhdr.srow_z[3] ; /* last row is always [ 0 0 0 1 ] */ nim->sto_xyz.m[3][0]=nim->sto_xyz.m[3][1]=nim->sto_xyz.m[3][2] = 0.0; nim->sto_xyz.m[3][3]= 1.0 ; nim->sto_ijk = nifti_mat44_inverse( nim->sto_xyz ) ; nim->sform_code = nhdr.sform_code ; if( g_opts.debug > 1 ) nifti_disp_matrix_orient("-d sform orientations:\n", nim->sto_xyz); } /**- set miscellaneous NIFTI stuff */ if( is_nifti ){ nim->scl_slope = FIXED_FLOAT( nhdr.scl_slope ) ; nim->scl_inter = FIXED_FLOAT( nhdr.scl_inter ) ; nim->intent_code = nhdr.intent_code ; nim->intent_p1 = FIXED_FLOAT( nhdr.intent_p1 ) ; nim->intent_p2 = FIXED_FLOAT( nhdr.intent_p2 ) ; nim->intent_p3 = FIXED_FLOAT( nhdr.intent_p3 ) ; nim->toffset = FIXED_FLOAT( nhdr.toffset ) ; memcpy(nim->intent_name,nhdr.intent_name,15); nim->intent_name[15] = '\0'; nim->xyz_units = XYZT_TO_SPACE(nhdr.xyzt_units) ; nim->time_units = XYZT_TO_TIME (nhdr.xyzt_units) ; nim->freq_dim = DIM_INFO_TO_FREQ_DIM ( nhdr.dim_info ) ; nim->phase_dim = DIM_INFO_TO_PHASE_DIM( nhdr.dim_info ) ; nim->slice_dim = DIM_INFO_TO_SLICE_DIM( nhdr.dim_info ) ; nim->slice_code = nhdr.slice_code ; nim->slice_start = nhdr.slice_start ; nim->slice_end = nhdr.slice_end ; nim->slice_duration = FIXED_FLOAT(nhdr.slice_duration) ; } /**- set Miscellaneous ANALYZE stuff */ nim->cal_min = FIXED_FLOAT(nhdr.cal_min) ; nim->cal_max = FIXED_FLOAT(nhdr.cal_max) ; memcpy(nim->descrip ,nhdr.descrip ,79) ; nim->descrip [79] = '\0' ; memcpy(nim->aux_file,nhdr.aux_file,23) ; nim->aux_file[23] = '\0' ; /**- set ioff from vox_offset (but at least sizeof(header)) */ is_onefile = is_nifti && NIFTI_ONEFILE(nhdr) ; if( is_onefile ){ ioff = (int)nhdr.vox_offset ; if( ioff < (int) sizeof(nhdr) ) ioff = (int) sizeof(nhdr) ; } else { ioff = (int)nhdr.vox_offset ; } nim->iname_offset = ioff ; /**- deal with file names if set */ if (fname!=NULL) { nifti_set_filenames(nim,fname,0,0); if (nim->iname==NULL) { ERREX("bad filename"); } } else { nim->fname = NULL; nim->iname = NULL; } /* clear extension fields */ nim->num_ext = 0; nim->ext_list = NULL; return nim; } #undef ERREX #define ERREX(msg) \ do{ fprintf(stderr,"** ERROR: nifti_image_open(%s): %s\n", \ (hname != NULL) ? hname : "(null)" , (msg) ) ; \ return fptr ; } while(0) /*************************************************************** * nifti_image_open ***************************************************************/ /*! znzFile nifti_image_open( char *hname, char *opts , nifti_image **nim) \brief Read in NIFTI-1 or ANALYZE-7.5 file (pair) header information into a nifti_image struct. - The image data is not read from disk (it may be read later using nifti_image_load(), for example). - The image data will be stored in whatever data format the input data is; no scaling will be applied. - DT_BINARY data is not supported. - nifti_image_free() can be used to delete the returned struct, when you are done with it. \param hname filename of dataset .hdr or .nii file \param opts options string for opening the header file \param nim pointer to pointer to nifti_image struct (this routine allocates the nifti_image struct) \return file pointer (gzippable) to the file with the image data, ready for reading.
NULL if something fails badly. \sa nifti_image_load, nifti_image_free */ znzFile nifti_image_open(const char * hname, char * opts, nifti_image ** nim) { znzFile fptr=NULL; /* open the hdr and reading it in, but do not load the data */ *nim = nifti_image_read(hname,0); /* open the image file, ready for reading (compressed works for all reads) */ if( ((*nim) == NULL) || ((*nim)->iname == NULL) || ((*nim)->nbyper <= 0) || ((*nim)->nvox <= 0) ) ERREX("bad header info") ; /* open image data file */ fptr = znzopen( (*nim)->iname, opts, nifti_is_gzfile((*nim)->iname) ); if( znz_isnull(fptr) ) ERREX("Can't open data file") ; return fptr; } /*----------------------------------------------------------------------*/ /*! return an allocated and filled nifti_1_header struct Read the binary header from disk, and swap bytes if necessary. \return an allocated nifti_1_header struct, or NULL on failure \param hname name of file containing header \param swapped if not NULL, return whether header bytes were swapped \param check flag to check for invalid nifti_1_header \warning ASCII header type is not supported \sa nifti_image_read, nifti_image_free, nifti_image_read_bricks *//*--------------------------------------------------------------------*/ nifti_1_header * nifti_read_header(const char * hname, int * swapped, int check) { nifti_1_header nhdr, * hptr; znzFile fp; int bytes, lswap; char * hfile; char fname[] = { "nifti_read_header" }; /* determine file name to use for header */ hfile = nifti_findhdrname(hname); if( hfile == NULL ){ if( g_opts.debug > 0 ) LNI_FERR(fname,"failed to find header file for", hname); return NULL; } else if( g_opts.debug > 1 ) fprintf(stderr,"-d %s: found header filename '%s'\n",fname,hfile); fp = znzopen( hfile, "rb", nifti_is_gzfile(hfile) ); if( znz_isnull(fp) ){ if( g_opts.debug > 0 ) LNI_FERR(fname,"failed to open header file",hfile); free(hfile); return NULL; } free(hfile); /* done with filename */ if( has_ascii_header(fp) == 1 ){ znzclose( fp ); if( g_opts.debug > 0 ) LNI_FERR(fname,"ASCII header type not supported",hname); return NULL; } /* read the binary header */ bytes = (int)znzread( &nhdr, 1, sizeof(nhdr), fp ); znzclose( fp ); /* we are done with the file now */ if( bytes < (int)sizeof(nhdr) ){ if( g_opts.debug > 0 ){ LNI_FERR(fname,"bad binary header read for file", hname); fprintf(stderr," - read %d of %d bytes\n",bytes, (int)sizeof(nhdr)); } return NULL; } /* now just decide on byte swapping */ lswap = need_nhdr_swap(nhdr.dim[0], nhdr.sizeof_hdr); /* swap data flag */ if( check && lswap < 0 ){ LNI_FERR(fname,"bad nifti_1_header for file", hname); return NULL; } else if ( lswap < 0 ) { lswap = 0; /* if swapping does not help, don't do it */ if(g_opts.debug > 1) fprintf(stderr,"-- swap failure, none applied\n"); } if( lswap ) { if ( g_opts.debug > 3 ) disp_nifti_1_header("-d nhdr pre-swap: ", &nhdr); swap_nifti_header( &nhdr , NIFTI_VERSION(nhdr) ) ; } if ( g_opts.debug > 2 ) disp_nifti_1_header("-d nhdr post-swap: ", &nhdr); if ( check && ! nifti_hdr_looks_good(&nhdr) ){ LNI_FERR(fname,"nifti_1_header looks bad for file", hname); return NULL; } /* all looks good, so allocate memory for and return the header */ hptr = (nifti_1_header *)malloc(sizeof(nifti_1_header)); if( ! hptr ){ fprintf(stderr,"** nifti_read_hdr: failed to alloc nifti_1_header\n"); return NULL; } if( swapped ) *swapped = lswap; /* only if they care */ memcpy(hptr, &nhdr, sizeof(nifti_1_header)); return hptr; } /*----------------------------------------------------------------------*/ /*! decide if this nifti_1_header structure looks reasonable Check dim[0], dim[1], sizeof_hdr, and datatype. Check magic string for "n+1". Maybe more tests will follow. \return 1 if the header seems valid, 0 otherwise \sa nifti_nim_is_valid, valid_nifti_extensions *//*--------------------------------------------------------------------*/ int nifti_hdr_looks_good(const nifti_1_header * hdr) { int is_nifti, c, errs = 0; /* check dim[0] and sizeof_hdr */ if( need_nhdr_swap(hdr->dim[0], hdr->sizeof_hdr) < 0 ){ if( g_opts.debug > 0 ) fprintf(stderr,"** bad nhdr fields: dim0, sizeof_hdr = %d, %d\n", hdr->dim[0], hdr->sizeof_hdr); errs++; } /* check the valid dimension sizes (maybe dim[0] is bad) */ for( c = 1; c <= hdr->dim[0] && c <= 7; c++ ) if( hdr->dim[c] <= 0 ){ if( g_opts.debug > 0 ) fprintf(stderr,"** bad nhdr field: dim[%d] = %d\n",c,hdr->dim[c]); errs++; } is_nifti = NIFTI_VERSION(*hdr); /* determine header type */ if( is_nifti ){ /* NIFTI */ if( ! nifti_datatype_is_valid(hdr->datatype, 1) ){ if( g_opts.debug > 0 ) fprintf(stderr,"** bad NIFTI datatype in hdr, %d\n",hdr->datatype); errs++; } } else { /* ANALYZE 7.5 */ if( g_opts.debug > 1 ) /* maybe tell user it's an ANALYZE hdr */ fprintf(stderr, "-- nhdr magic field implies ANALYZE: magic = '%.4s'\n",hdr->magic); if( ! nifti_datatype_is_valid(hdr->datatype, 0) ){ if( g_opts.debug > 0 ) fprintf(stderr,"** bad ANALYZE datatype in hdr, %d\n",hdr->datatype); errs++; } } if( errs ) return 0; /* problems */ if( g_opts.debug > 2 ) fprintf(stderr,"-d nifti header looks good\n"); return 1; /* looks good */ } /*---------------------------------------------------------------------- * check whether byte swapping is needed * * dim[0] should be in [0,7], and sizeof_hdr should be accurate * * \returns > 0 : needs swap * 0 : does not need swap * < 0 : error condition *----------------------------------------------------------------------*/ static int need_nhdr_swap( short dim0, int hdrsize ) { short d0 = dim0; /* so we won't have to swap them on the stack */ int hsize = hdrsize; if( d0 != 0 ){ /* then use it for the check */ if( d0 > 0 && d0 <= 7 ) return 0; nifti_swap_2bytes(1, &d0); /* swap? */ if( d0 > 0 && d0 <= 7 ) return 1; if( g_opts.debug > 1 ){ fprintf(stderr,"** NIFTI: bad swapped d0 = %d, unswapped = ", d0); nifti_swap_2bytes(1, &d0); /* swap? */ fprintf(stderr,"%d\n", d0); } return -1; /* bad, naughty d0 */ } /* dim[0] == 0 should not happen, but could, so try hdrsize */ if( hsize == sizeof(nifti_1_header) ) return 0; nifti_swap_4bytes(1, &hsize); /* swap? */ if( hsize == sizeof(nifti_1_header) ) return 1; if( g_opts.debug > 1 ){ fprintf(stderr,"** NIFTI: bad swapped hsize = %d, unswapped = ", hsize); nifti_swap_4bytes(1, &hsize); /* swap? */ fprintf(stderr,"%d\n", hsize); } return -2; /* bad, naughty hsize */ } /* use macro LNI_FILE_ERROR instead of ERREX() #undef ERREX #define ERREX(msg) \ do{ fprintf(stderr,"** ERROR: nifti_image_read(%s): %s\n", \ (hname != NULL) ? hname : "(null)" , (msg) ) ; \ return NULL ; } while(0) */ /*************************************************************** * nifti_image_read ***************************************************************/ /*! \brief Read a nifti header and optionally the data, creating a nifti_image. - The data buffer will be byteswapped if necessary. - The data buffer will not be scaled. - The data buffer is allocated with calloc(). \param hname filename of the nifti dataset \param read_data Flag, true=read data blob, false=don't read blob. \return A pointer to the nifti_image data structure. \sa nifti_image_free, nifti_free_extensions, nifti_image_read_bricks */ nifti_image *nifti_image_read( const char *hname , int read_data ) { struct nifti_1_header nhdr ; nifti_image *nim ; znzFile fp ; int rv, ii , filesize, remaining; char fname[] = { "nifti_image_read" }; char *hfile=NULL; if( g_opts.debug > 1 ){ fprintf(stderr,"-d image_read from '%s', read_data = %d",hname,read_data); #ifdef HAVE_ZLIB fprintf(stderr,", HAVE_ZLIB = 1\n"); #else fprintf(stderr,", HAVE_ZLIB = 0\n"); #endif } /**- determine filename to use for header */ hfile = nifti_findhdrname(hname); if( hfile == NULL ){ if(g_opts.debug > 0) LNI_FERR(fname,"failed to find header file for", hname); return NULL; /* check return */ } else if( g_opts.debug > 1 ) fprintf(stderr,"-d %s: found header filename '%s'\n",fname,hfile); if( nifti_is_gzfile(hfile) ) filesize = -1; /* unknown */ else filesize = nifti_get_filesize(hfile); fp = znzopen(hfile, "rb", nifti_is_gzfile(hfile)); if( znz_isnull(fp) ){ if( g_opts.debug > 0 ) LNI_FERR(fname,"failed to open header file",hfile); free(hfile); return NULL; } rv = has_ascii_header( fp ); if( rv < 0 ){ if( g_opts.debug > 0 ) LNI_FERR(fname,"short header read",hfile); znzclose( fp ); free(hfile); return NULL; } else if ( rv == 1 ) /* process special file type */ return nifti_read_ascii_image( fp, hfile, filesize, read_data ); /* else, just process normally */ /**- read binary header */ ii = (int)znzread( &nhdr , 1 , sizeof(nhdr) , fp ) ; /* read the thing */ /* keep file open so we can check for exts. after nifti_convert_nhdr2nim() */ if( ii < (int) sizeof(nhdr) ){ if( g_opts.debug > 0 ){ LNI_FERR(fname,"bad binary header read for file", hfile); fprintf(stderr," - read %d of %d bytes\n",ii, (int)sizeof(nhdr)); } znzclose(fp) ; free(hfile); return NULL; } /* create output image struct and set it up */ /**- convert all nhdr fields to nifti_image fields */ nim = nifti_convert_nhdr2nim(nhdr,hfile); if( nim == NULL ){ znzclose( fp ) ; /* close the file */ if( g_opts.debug > 0 ) LNI_FERR(fname,"cannot create nifti image from header",hfile); free(hfile); /* had to save this for debug message */ return NULL; } if( g_opts.debug > 3 ){ fprintf(stderr,"+d nifti_image_read(), have nifti image:\n"); if( g_opts.debug > 2 ) nifti_image_infodump(nim); } /**- check for extensions (any errors here means no extensions) */ if( NIFTI_ONEFILE(nhdr) ) remaining = nim->iname_offset - sizeof(nhdr); else remaining = filesize - sizeof(nhdr); (void)nifti_read_extensions(nim, fp, remaining); znzclose( fp ) ; /* close the file */ free(hfile); /**- read the data if desired, then bug out */ if( read_data ){ if( nifti_image_load( nim ) < 0 ){ nifti_image_free(nim); /* take ball, go home. */ return NULL; } } else nim->data = NULL ; return nim ; } /*---------------------------------------------------------------------- * has_ascii_header - see if the NIFTI header is an ASCII format * * If the file starts with the ASCII string " 1 ) fprintf(stderr,"-d %s: have ASCII NIFTI file of size %d\n",fname,slen); if( slen > 65530 ) slen = 65530 ; sbuf = (char *)calloc(sizeof(char),slen+1) ; if( !sbuf ){ fprintf(stderr,"** %s: failed to alloc %d bytes for sbuf",lfunc,65530); free(fname); znzclose(fp); return NULL; } znzread( sbuf , 1 , slen , fp ) ; nim = nifti_image_from_ascii( sbuf, &txt_size ) ; free( sbuf ) ; if( nim == NULL ){ LNI_FERR(lfunc,"failed nifti_image_from_ascii()",fname); free(fname); znzclose(fp); return NULL; } nim->nifti_type = NIFTI_FTYPE_ASCII ; /* compute remaining space for extensions */ remain = flen - txt_size - (int)nifti_get_volsize(nim); if( remain > 4 ){ /* read extensions (reposition file pointer, first) */ znzseek(fp, txt_size, SEEK_SET); (void) nifti_read_extensions(nim, fp, remain); } free(fname); znzclose( fp ) ; nim->iname_offset = -1 ; /* check from the end of the file */ if( read_data ) rv = nifti_image_load( nim ) ; else nim->data = NULL ; /* check for nifti_image_load() failure, maybe bail out */ if( read_data && rv != 0 ){ if( g_opts.debug > 1 ) fprintf(stderr,"-d failed image_load, free nifti image struct\n"); free(nim); return NULL; } return nim ; } /*---------------------------------------------------------------------- * Read the extensions into the nifti_image struct 08 Dec 2004 [rickr] * * This function is called just after the header struct is read in, and * it is assumed the file pointer has not moved. The value in remain * is assumed to be accurate, reflecting the bytes of space for potential * extensions. * * return the number of extensions read in, or < 0 on error *----------------------------------------------------------------------*/ static int nifti_read_extensions( nifti_image *nim, znzFile fp, int remain ) { nifti1_extender extdr; /* defines extension existence */ nifti1_extension extn; /* single extension to process */ nifti1_extension * Elist; /* list of processed extensions */ int posn, count; if( !nim || znz_isnull(fp) ) { if( g_opts.debug > 0 ) fprintf(stderr,"** nifti_read_extensions: bad inputs (%p,%p)\n", (void *)nim, (void *)fp); return -1; } posn = znztell(fp); if( (posn != sizeof(nifti_1_header)) && (nim->nifti_type != NIFTI_FTYPE_ASCII) ) fprintf(stderr,"** WARNING: posn not header size (%d, %d)\n", posn, (int)sizeof(nifti_1_header)); if( g_opts.debug > 2 ) fprintf(stderr,"-d nre: posn = %d, offset = %d, type = %d, remain = %d\n", posn, nim->iname_offset, nim->nifti_type, remain); if( remain < 16 ){ if( g_opts.debug > 2 ){ if( g_opts.skip_blank_ext ) fprintf(stderr,"-d no extender in '%s' is okay, as " "skip_blank_ext is set\n",nim->fname); else fprintf(stderr,"-d remain=%d, no space for extensions\n",remain); } return 0; } count = (int)znzread( extdr.extension, 1, 4, fp ); /* get extender */ if( count < 4 ){ if( g_opts.debug > 1 ) fprintf(stderr,"-d file '%s' is too short for an extender\n", nim->fname); return 0; } if( extdr.extension[0] != 1 ){ if( g_opts.debug > 2 ) fprintf(stderr,"-d extender[0] (%d) shows no extensions for '%s'\n", extdr.extension[0], nim->fname); return 0; } remain -= 4; if( g_opts.debug > 2 ) fprintf(stderr,"-d found valid 4-byte extender, remain = %d\n", remain); /* so we expect extensions, but have no idea of how many there may be */ count = 0; Elist = NULL; while (nifti_read_next_extension(&extn, nim, remain, fp) > 0) { if( nifti_add_exten_to_list(&extn, &Elist, count+1) < 0 ){ if( g_opts.debug > 0 ) fprintf(stderr,"** failed adding ext %d to list\n", count); return -1; } /* we have a new extension */ if( g_opts.debug > 1 ){ fprintf(stderr,"+d found extension #%d, code = 0x%x, size = %d\n", count, extn.ecode, extn.esize); if( extn.ecode == NIFTI_ECODE_AFNI && g_opts.debug > 2 ) /* ~XML */ fprintf(stderr," AFNI extension: %.*s\n", extn.esize-8,extn.edata); else if( extn.ecode == NIFTI_ECODE_COMMENT && g_opts.debug > 2 ) fprintf(stderr," COMMENT extension: %.*s\n", /* TEXT */ extn.esize-8,extn.edata); } remain -= extn.esize; count++; } if( g_opts.debug > 2 ) fprintf(stderr,"+d found %d extension(s)\n", count); nim->num_ext = count; nim->ext_list = Elist; return count; } /*----------------------------------------------------------------------*/ /*! nifti_add_extension - add an extension, with a copy of the data Add an extension to the nim->ext_list array. Fill this extension with a copy of the data, noting the length and extension code. \param nim - nifti_image to add extension to \param data - raw extension data \param length - length of raw extension data \param ecode - extension code \sa extension codes NIFTI_ECODE_* in nifti1_io.h \sa nifti_free_extensions, valid_nifti_extensions, nifti_copy_extensions \return 0 on success, -1 on error (and free the entire list) *//*--------------------------------------------------------------------*/ int nifti_add_extension(nifti_image *nim, const char * data, int len, int ecode) { nifti1_extension ext; /* error are printed in functions */ if( nifti_fill_extension(&ext, data, len, ecode) ) return -1; if( nifti_add_exten_to_list(&ext, &nim->ext_list, nim->num_ext+1)) return -1; nim->num_ext++; /* success, so increment */ return 0; } /*----------------------------------------------------------------------*/ /* nifti_add_exten_to_list - add a new nifti1_extension to the list We will append via "malloc, copy and free", because on an error, the list will revert to the previous one (sorry realloc(), only quality dolphins get to become part of St@rk!st brand tunafish). return 0 on success, -1 on error (and free the entire list) *//*--------------------------------------------------------------------*/ static int nifti_add_exten_to_list( nifti1_extension * new_ext, nifti1_extension ** list, int new_length ) { nifti1_extension * tmplist; tmplist = *list; *list = (nifti1_extension *)malloc(new_length * sizeof(nifti1_extension)); /* check for failure first */ if( ! *list ){ fprintf(stderr,"** failed to alloc %d extension structs (%d bytes)\n", new_length, new_length*(int)sizeof(nifti1_extension)); if( !tmplist ) return -1; /* no old list to lose */ *list = tmplist; /* reset list to old one */ return -1; } /* if an old list exists, copy the pointers and free the list */ if( tmplist ){ memcpy(*list, tmplist, (new_length-1)*sizeof(nifti1_extension)); free(tmplist); } /* for some reason, I just don't like struct copy... */ (*list)[new_length-1].esize = new_ext->esize; (*list)[new_length-1].ecode = new_ext->ecode; (*list)[new_length-1].edata = new_ext->edata; if( g_opts.debug > 2 ) fprintf(stderr,"+d allocated and appended extension #%d to list\n", new_length); return 0; } /*----------------------------------------------------------------------*/ /* nifti_fill_extension - given data and length, fill an extension struct Allocate memory for data, copy data, set the size and code. return 0 on success, -1 on error (and free the entire list) *//*--------------------------------------------------------------------*/ static int nifti_fill_extension( nifti1_extension *ext, const char * data, int len, int ecode) { int esize; if( !ext || !data || len < 0 ){ fprintf(stderr,"** fill_ext: bad params (%p,%p,%d)\n", (void *)ext, data, len); return -1; } else if( ! nifti_is_valid_ecode(ecode) ){ fprintf(stderr,"** fill_ext: invalid ecode %d\n", ecode); return -1; } /* compute esize, first : len+8, and take ceiling up to a mult of 16 */ esize = len+8; if( esize & 0xf ) esize = (esize + 0xf) & ~0xf; ext->esize = esize; /* allocate esize-8 (maybe more than len), using calloc for fill */ ext->edata = (char *)calloc(esize-8, sizeof(char)); if( !ext->edata ){ fprintf(stderr,"** NFE: failed to alloc %d bytes for extension\n",len); return -1; } memcpy(ext->edata, data, len); /* copy the data, using len */ ext->ecode = ecode; /* set the ecode */ if( g_opts.debug > 2 ) fprintf(stderr,"+d alloc %d bytes for ext len %d, ecode %d, esize %d\n", esize-8, len, ecode, esize); return 0; } /*---------------------------------------------------------------------- * nifti_read_next_extension - read a single extension from the file * * return (>= 0 is okay): * * success : esize * no extension : 0 * error : -1 *----------------------------------------------------------------------*/ static int nifti_read_next_extension( nifti1_extension * nex, nifti_image *nim, int remain, znzFile fp ) { int swap = nim->byteorder != nifti_short_order(); int count, size, code; /* first clear nex */ nex->esize = nex->ecode = 0; nex->edata = NULL; if( remain < 16 ){ if( g_opts.debug > 2 ) fprintf(stderr,"-d only %d bytes remain, so no extension\n", remain); return 0; } /* must start with 4-byte size and code */ count = (int)znzread( &size, 4, 1, fp ); if( count == 1 ) count += (int)znzread( &code, 4, 1, fp ); if( count != 2 ){ if( g_opts.debug > 2 ) fprintf(stderr,"-d current extension read failed\n"); znzseek(fp, -4*count, SEEK_CUR); /* back up past any read */ return 0; /* no extension, no error condition */ } if( swap ){ if( g_opts.debug > 2 ) fprintf(stderr,"-d pre-swap exts: code %d, size %d\n", code, size); nifti_swap_4bytes(1, &size); nifti_swap_4bytes(1, &code); } if( g_opts.debug > 2 ) fprintf(stderr,"-d potential extension: code %d, size %d\n", code, size); if( !nifti_check_extension(nim, size, code, remain) ){ if( znzseek(fp, -8, SEEK_CUR) < 0 ){ /* back up past any read */ fprintf(stderr,"** failure to back out of extension read!\n"); return -1; } return 0; } /* now get the actual data */ nex->esize = size; nex->ecode = code; size -= 8; /* subtract space for size and code in extension */ nex->edata = (char *)malloc(size * sizeof(char)); if( !nex->edata ){ fprintf(stderr,"** failed to allocate %d bytes for extension\n",size); return -1; } count = (int)znzread(nex->edata, 1, size, fp); if( count < size ){ if( g_opts.debug > 0 ) fprintf(stderr,"-d read only %d (of %d) bytes for extension\n", count, size); free(nex->edata); nex->edata = NULL; return -1; } /* success! */ if( g_opts.debug > 2 ) fprintf(stderr,"+d successfully read extension, code %d, size %d\n", nex->ecode, nex->esize); return nex->esize; } /*----------------------------------------------------------------------*/ /*! for each extension, check code, size and data pointer *//*--------------------------------------------------------------------*/ int valid_nifti_extensions(const nifti_image * nim) { nifti1_extension * ext; int c, errs; if( nim->num_ext <= 0 || nim->ext_list == NULL ){ if( g_opts.debug > 2 ) fprintf(stderr,"-d empty extension list\n"); return 0; } /* for each extension, check code, size and data pointer */ ext = nim->ext_list; errs = 0; for ( c = 0; c < nim->num_ext; c++ ){ if( ! nifti_is_valid_ecode(ext->ecode) ) { if( g_opts.debug > 1 ) fprintf(stderr,"-d ext %d, invalid code %d\n", c, ext->ecode); errs++; } if( ext->esize <= 0 ){ if( g_opts.debug > 1 ) fprintf(stderr,"-d ext %d, bad size = %d\n", c, ext->esize); errs++; } else if( ext->esize & 0xf ){ if( g_opts.debug > 1 ) fprintf(stderr,"-d ext %d, size %d not multiple of 16\n", c, ext->esize); errs++; } if( ext->edata == NULL ){ if( g_opts.debug > 1 ) fprintf(stderr,"-d ext %d, missing data\n", c); errs++; } ext++; } if( errs > 0 ){ if( g_opts.debug > 0 ) fprintf(stderr,"-d had %d extension errors, none will be written\n", errs); return 0; } /* if we're here, we're good */ return 1; } /*----------------------------------------------------------------------*/ /*! check whether the extension code is valid \return 1 if valid, 0 otherwise *//*--------------------------------------------------------------------*/ int nifti_is_valid_ecode( int ecode ) { if( ecode < NIFTI_ECODE_IGNORE || /* minimum code number (0) */ ecode > NIFTI_MAX_ECODE || /* maximum code number */ ecode & 1 ) /* cannot be odd */ return 0; return 1; } /*---------------------------------------------------------------------- * check for valid size and code, as well as can be done *----------------------------------------------------------------------*/ static int nifti_check_extension(nifti_image *nim, int size, int code, int rem) { /* check for bad code before bad size */ if( ! nifti_is_valid_ecode(code) ) { if( g_opts.debug > 2 ) fprintf(stderr,"-d invalid extension code %d\n",code); return 0; } if( size < 16 ){ if( g_opts.debug > 2 ) fprintf(stderr,"-d ext size %d, no extension\n",size); return 0; } if( size > rem ){ if( g_opts.debug > 2 ) fprintf(stderr,"-d ext size %d, space %d, no extension\n", size, rem); return 0; } if( size & 0xf ){ if( g_opts.debug > 2 ) fprintf(stderr,"-d nifti extension size %d not multiple of 16\n",size); return 0; } if( nim->nifti_type == NIFTI_FTYPE_ASCII && size > LNI_MAX_NIA_EXT_LEN ){ if( g_opts.debug > 2 ) fprintf(stderr,"-d NVE, bad nifti_type 3 size %d\n", size); return 0; } return 1; } /*---------------------------------------------------------------------- * nifti_image_load_prep - prepare to read data * * Check nifti_image fields, open the file and seek to the appropriate * offset for reading. * * return NULL on failure *----------------------------------------------------------------------*/ static znzFile nifti_image_load_prep( nifti_image *nim ) { /* set up data space, open data file and seek, then call nifti_read_buffer */ size_t ntot , ii , ioff; znzFile fp; char *tmpimgname; char fname[] = { "nifti_image_load_prep" }; /**- perform sanity checks */ if( nim == NULL || nim->iname == NULL || nim->nbyper <= 0 || nim->nvox <= 0 ) { if ( g_opts.debug > 0 ){ if( !nim ) fprintf(stderr,"** ERROR: N_image_load: no nifti image\n"); else fprintf(stderr,"** ERROR: N_image_load: bad params (%p,%d,%u)\n", nim->iname, nim->nbyper, (unsigned)nim->nvox); } return NULL; } ntot = nifti_get_volsize(nim) ; /* total bytes to read */ /**- open image data file */ tmpimgname = nifti_findimgname(nim->iname , nim->nifti_type); if( tmpimgname == NULL ){ if( g_opts.debug > 0 ) fprintf(stderr,"** no image file found for '%s'\n",nim->iname); return NULL; } fp = znzopen(tmpimgname, "rb", nifti_is_gzfile(tmpimgname)); if (znz_isnull(fp)){ if(g_opts.debug > 0) LNI_FERR(fname,"cannot open data file",tmpimgname); free(tmpimgname); return NULL; /* bad open? */ } free(tmpimgname); /**- get image offset: a negative offset means to figure from end of file */ if( nim->iname_offset < 0 ){ if( nifti_is_gzfile(nim->iname) ){ if( g_opts.debug > 0 ) LNI_FERR(fname,"negative offset for compressed file",nim->iname); znzclose(fp); return NULL; } ii = nifti_get_filesize( nim->iname ) ; if( ii <= 0 ){ if( g_opts.debug > 0 ) LNI_FERR(fname,"empty data file",nim->iname); znzclose(fp); return NULL; } ioff = (ii > ntot) ? ii-ntot : 0 ; } else { /* non-negative offset */ ioff = nim->iname_offset ; /* means use it directly */ } /**- seek to the appropriate read position */ if( znzseek(fp , (long)ioff , SEEK_SET) < 0 ){ fprintf(stderr,"** could not seek to offset %u in file '%s'\n", (unsigned)ioff, nim->iname); znzclose(fp); return NULL; } /**- and return the File pointer */ return fp; } /*---------------------------------------------------------------------- * nifti_image_load *----------------------------------------------------------------------*/ /*! \fn int nifti_image_load( nifti_image *nim ) \brief Load the image blob into a previously initialized nifti_image. - If not yet set, the data buffer is allocated with calloc(). - The data buffer will be byteswapped if necessary. - The data buffer will not be scaled. This function is used to read the image from disk. It should be used after a function such as nifti_image_read(), so that the nifti_image structure is already initialized. \param nim pointer to a nifti_image (previously initialized) \return 0 on success, -1 on failure \sa nifti_image_read, nifti_image_free, nifti_image_unload */ int nifti_image_load( nifti_image *nim ) { /* set up data space, open data file and seek, then call nifti_read_buffer */ size_t ntot , ii ; znzFile fp ; /**- open the file and position the FILE pointer */ fp = nifti_image_load_prep( nim ); if( fp == NULL ){ if( g_opts.debug > 0 ) fprintf(stderr,"** nifti_image_load, failed load_prep\n"); return -1; } ntot = nifti_get_volsize(nim); /**- if the data pointer is not yet set, get memory space for the image */ if( nim->data == NULL ) { nim->data = (void *)calloc(1,ntot) ; /* create image memory */ if( nim->data == NULL ){ if( g_opts.debug > 0 ) fprintf(stderr,"** failed to alloc %d bytes for image data\n", (int)ntot); znzclose(fp); return -1; } } /**- now that everything is set up, do the reading */ ii = nifti_read_buffer(fp,nim->data,ntot,nim); if( ii < ntot ){ znzclose(fp) ; free(nim->data) ; nim->data = NULL ; return -1 ; /* errors were printed in nifti_read_buffer() */ } /**- close the file */ znzclose( fp ) ; return 0 ; } /* 30 Nov 2004 [rickr] #undef ERREX #define ERREX(msg) \ do{ fprintf(stderr,"** ERROR: nifti_read_buffer: %s\n",(msg)) ; \ return 0; } while(0) */ /*----------------------------------------------------------------------*/ /*! read ntot bytes of data from an open file and byte swaps if necessary note that nifti_image is required for information on datatype, bsize (for any needed byte swapping), etc. This function does not allocate memory, so dataptr must be valid. *//*--------------------------------------------------------------------*/ size_t nifti_read_buffer(znzFile fp, void* dataptr, size_t ntot, nifti_image *nim) { size_t ii; if( dataptr == NULL ){ if( g_opts.debug > 0 ) fprintf(stderr,"** ERROR: nifti_read_buffer: NULL dataptr\n"); return -1; } ii = znzread( dataptr , 1 , ntot , fp ) ; /* data input */ /* if read was short, fail */ if( ii < ntot ){ if( g_opts.debug > 0 ) fprintf(stderr,"++ WARNING: nifti_read_buffer(%s):\n" " data bytes needed = %u\n" " data bytes input = %u\n" " number missing = %u (set to 0)\n", nim->iname , (unsigned int)ntot , (unsigned int)ii , (unsigned int)(ntot-ii) ) ; /* memset( (char *)(dataptr)+ii , 0 , ntot-ii ) ; now failure [rickr] */ return -1 ; } if( g_opts.debug > 2 ) fprintf(stderr,"+d nifti_read_buffer: read %u bytes\n", (unsigned)ii); /* byte swap array if needed */ /* ntot/swapsize might not fit as int, use size_t 6 Jul 2010 [rickr] */ if( nim->swapsize > 1 && nim->byteorder != nifti_short_order() ) { if( g_opts.debug > 1 ) fprintf(stderr,"+d nifti_read_buffer: swapping data bytes...\n"); nifti_swap_Nbytes( ntot / nim->swapsize, nim->swapsize , dataptr ) ; } #ifdef isfinite { /* check input float arrays for goodness, and fix bad floats */ int fix_count = 0 ; switch( nim->datatype ){ case NIFTI_TYPE_FLOAT32: case NIFTI_TYPE_COMPLEX64:{ register float *far = (float *)dataptr ; register size_t jj,nj ; nj = ntot / sizeof(float) ; for( jj=0 ; jj < nj ; jj++ ) /* count fixes 30 Nov 2004 [rickr] */ if( !IS_GOOD_FLOAT(far[jj]) ){ far[jj] = 0 ; fix_count++ ; } } break ; case NIFTI_TYPE_FLOAT64: case NIFTI_TYPE_COMPLEX128:{ register double *far = (double *)dataptr ; register size_t jj,nj ; nj = ntot / sizeof(double) ; for( jj=0 ; jj < nj ; jj++ ) /* count fixes 30 Nov 2004 [rickr] */ if( !IS_GOOD_FLOAT(far[jj]) ){ far[jj] = 0 ; fix_count++ ; } } break ; } if( g_opts.debug > 1 ) fprintf(stderr,"+d in image, %d bad floats were set to 0\n", fix_count); } #endif return ii; } /*--------------------------------------------------------------------------*/ /*! Unload the data in a nifti_image struct, but keep the metadata. *//*------------------------------------------------------------------------*/ void nifti_image_unload( nifti_image *nim ) { if( nim != NULL && nim->data != NULL ){ free(nim->data) ; nim->data = NULL ; } return ; } /*--------------------------------------------------------------------------*/ /*! free 'everything' about a nifti_image struct (including the passed struct) free (only fields which are not NULL): - fname and iname - data - any ext_list[i].edata - ext_list - nim *//*------------------------------------------------------------------------*/ void nifti_image_free( nifti_image *nim ) { if( nim == NULL ) return ; if( nim->fname != NULL ) free(nim->fname) ; if( nim->iname != NULL ) free(nim->iname) ; if( nim->data != NULL ) free(nim->data ) ; (void)nifti_free_extensions( nim ) ; free(nim) ; return ; } /*--------------------------------------------------------------------------*/ /*! free the nifti extensions - If any edata pointer is set in the extension list, free() it. - Free ext_list, if it is set. - Clear num_ext and ext_list from nim. \return 0 on success, -1 on error \sa nifti_add_extension, nifti_copy_extensions *//*------------------------------------------------------------------------*/ int nifti_free_extensions( nifti_image *nim ) { int c ; if( nim == NULL ) return -1; if( nim->num_ext > 0 && nim->ext_list ){ for( c = 0; c < nim->num_ext; c++ ) if ( nim->ext_list[c].edata ) free(nim->ext_list[c].edata); free(nim->ext_list); } /* or if it is inconsistent, warn the user (if we are not in quiet mode) */ else if ( (nim->num_ext > 0 || nim->ext_list != NULL) && (g_opts.debug > 0) ) fprintf(stderr,"** warning: nifti extension num/ptr mismatch (%d,%p)\n", nim->num_ext, (void *)nim->ext_list); if( g_opts.debug > 2 ) fprintf(stderr,"+d free'd %d extension(s)\n", nim->num_ext); nim->num_ext = 0; nim->ext_list = NULL; return 0; } /*--------------------------------------------------------------------------*/ /*! Print to stdout some info about a nifti_image struct. *//*------------------------------------------------------------------------*/ void nifti_image_infodump( const nifti_image *nim ) { char *str = nifti_image_to_ascii( nim ) ; /* stdout -> stderr 2 Dec 2004 [rickr] */ if( str != NULL ){ fputs(str,stderr) ; free(str) ; } return ; } /*-------------------------------------------------------------------------- * nifti_write_buffer just check for a null znzFile and call znzwrite *--------------------------------------------------------------------------*/ /*! \fn size_t nifti_write_buffer(znzFile fp, void *buffer, size_t numbytes) \brief write numbytes of buffer to file, fp \param fp File pointer (from znzopen) to gzippable nifti datafile \param buffer data buffer to be written \param numbytes number of bytes in buffer to write \return number of bytes successfully written */ size_t nifti_write_buffer(znzFile fp, const void *buffer, size_t numbytes) { /* Write all the image data at once (no swapping here) */ size_t ss; if (znz_isnull(fp)){ fprintf(stderr,"** ERROR: nifti_write_buffer: null file pointer\n"); return 0; } ss = znzwrite( (void*)buffer , 1 , numbytes , fp ) ; return ss; } /*----------------------------------------------------------------------*/ /*! write the nifti_image data to file (from nim->data or from NBL) If NBL is not NULL, write the data from that structure. Otherwise, write it out from nim->data. No swapping is done here. \param fp : File pointer \param nim : nifti_image corresponding to the data \param NBL : optional source of write data (if NULL use nim->data) \return 0 on success, -1 on failure Note: the nifti_image byte_order is set as that of the current CPU. This is because such a conversion was made to the data upon reading, while byte_order was not set (so the programs would know what format the data was on disk). Effectively, since byte_order should match what is on disk, it should bet set to that of the current CPU whenever new filenames are assigned. *//*--------------------------------------------------------------------*/ int nifti_write_all_data(znzFile fp, nifti_image * nim, const nifti_brick_list * NBL) { size_t ss; int bnum; if( !NBL ){ /* just write one buffer and get out of here */ if( nim->data == NULL ){ fprintf(stderr,"** NWAD: no image data to write\n"); return -1; } ss = nifti_write_buffer(fp,nim->data,nim->nbyper * nim->nvox); if (ss < nim->nbyper * nim->nvox){ fprintf(stderr, "** ERROR: NWAD: wrote only %u of %u bytes to file\n", (unsigned)ss, (unsigned)(nim->nbyper * nim->nvox)); return -1; } if( g_opts.debug > 1 ) fprintf(stderr,"+d wrote single image of %u bytes\n", (unsigned)ss); } else { if( ! NBL->bricks || NBL->nbricks <= 0 || NBL->bsize <= 0 ){ fprintf(stderr,"** NWAD: no brick data to write (%p,%d,%u)\n", (void *)NBL->bricks, NBL->nbricks, (unsigned)NBL->bsize); return -1; } for( bnum = 0; bnum < NBL->nbricks; bnum++ ){ ss = nifti_write_buffer(fp, NBL->bricks[bnum], NBL->bsize); if( ss < NBL->bsize ){ fprintf(stderr, "** NWAD ERROR: wrote %u of %u bytes of brick %d of %d to file", (unsigned)ss, (unsigned)NBL->bsize, bnum+1, NBL->nbricks); return -1; } } if( g_opts.debug > 1 ) fprintf(stderr,"+d wrote image of %d brick(s), each of %u bytes\n", NBL->nbricks, (unsigned int)NBL->bsize); } /* mark as being in this CPU byte order */ nim->byteorder = nifti_short_order() ; return 0; } /* return number of extensions written, or -1 on error */ static int nifti_write_extensions(znzFile fp, nifti_image *nim) { nifti1_extension * list; char extdr[4] = { 0, 0, 0, 0 }; int c, size, ok = 1; if( znz_isnull(fp) || !nim || nim->num_ext < 0 ){ if( g_opts.debug > 0 ) fprintf(stderr,"** nifti_write_extensions, bad params\n"); return -1; } /* if no extensions and user requests it, skip extender */ if( g_opts.skip_blank_ext && (nim->num_ext == 0 || ! nim->ext_list ) ){ if( g_opts.debug > 1 ) fprintf(stderr,"-d no exts and skip_blank_ext set, " "so skipping 4-byte extender\n"); return 0; } /* if invalid extension list, clear num_ext */ if( ! valid_nifti_extensions(nim) ) nim->num_ext = 0; /* write out extender block */ if( nim->num_ext > 0 ) extdr[0] = 1; if( nifti_write_buffer(fp, extdr, 4) != 4 ){ fprintf(stderr,"** failed to write extender\n"); return -1; } list = nim->ext_list; for ( c = 0; c < nim->num_ext; c++ ){ size = (int)nifti_write_buffer(fp, &list->esize, sizeof(int)); ok = (size == (int)sizeof(int)); if( ok ){ size = (int)nifti_write_buffer(fp, &list->ecode, sizeof(int)); ok = (size == (int)sizeof(int)); } if( ok ){ size = (int)nifti_write_buffer(fp, list->edata, list->esize - 8); ok = (size == list->esize - 8); } if( !ok ){ fprintf(stderr,"** failed while writing extension #%d\n",c); return -1; } else if ( g_opts.debug > 2 ) fprintf(stderr,"+d wrote extension %d of %d bytes\n", c, size); list++; } if( g_opts.debug > 1 ) fprintf(stderr,"+d wrote out %d extension(s)\n", nim->num_ext); return nim->num_ext; } /*----------------------------------------------------------------------*/ /*! basic initialization of a nifti_image struct (to a 1x1x1 image) *//*--------------------------------------------------------------------*/ nifti_image* nifti_simple_init_nim(void) { nifti_image *nim; struct nifti_1_header nhdr; int nbyper, swapsize; memset(&nhdr,0,sizeof(nhdr)) ; /* zero out header, to be safe */ nhdr.sizeof_hdr = sizeof(nhdr) ; nhdr.regular = 'r' ; /* for some stupid reason */ nhdr.dim[0] = 3 ; nhdr.dim[1] = 1 ; nhdr.dim[2] = 1 ; nhdr.dim[3] = 1 ; nhdr.dim[4] = 0 ; nhdr.pixdim[0] = 0.0 ; nhdr.pixdim[1] = 1.0 ; nhdr.pixdim[2] = 1.0 ; nhdr.pixdim[3] = 1.0 ; nhdr.datatype = DT_FLOAT32 ; nifti_datatype_sizes( nhdr.datatype , &nbyper, &swapsize ); nhdr.bitpix = 8 * nbyper ; strcpy(nhdr.magic, "n+1"); /* init to single file */ nim = nifti_convert_nhdr2nim(nhdr,NULL); nim->fname = NULL; nim->iname = NULL; return nim; } /*----------------------------------------------------------------------*/ /*! basic initialization of a nifti_1_header struct (with given dimensions) Return an allocated nifti_1_header struct, based on the given dimensions and datatype. \param arg_dims : optional dim[8] array (default {3,1,1,1,0,0,0,0}) \param arg_dtype : optional datatype (default DT_FLOAT32) \return pointer to allocated nifti_1_header struct *//*--------------------------------------------------------------------*/ nifti_1_header * nifti_make_new_header(const int arg_dims[], int arg_dtype) { nifti_1_header * nhdr; const int default_dims[8] = { 3, 1, 1, 1, 0, 0, 0, 0 }; const int * dim; /* either passed or default dims */ int dtype; /* either passed or default dtype */ int c, nbyper, swapsize; /* if arg_dims is passed, apply it */ if( arg_dims ) dim = arg_dims; else dim = default_dims; /* validate dim: if there is any problem, apply default_dims */ if( dim[0] < 1 || dim[0] > 7 ) { fprintf(stderr,"** nifti_simple_hdr_with_dims: bad dim[0]=%d\n",dim[0]); dim = default_dims; } else { for( c = 1; c <= dim[0]; c++ ) if( dim[c] < 1 ) { fprintf(stderr, "** nifti_simple_hdr_with_dims: bad dim[%d]=%d\n",c,dim[c]); dim = default_dims; break; } } /* validate dtype, too */ dtype = arg_dtype; if( ! nifti_is_valid_datatype(dtype) ) { fprintf(stderr,"** nifti_simple_hdr_with_dims: bad dtype %d\n",dtype); dtype = DT_FLOAT32; } /* now populate the header struct */ if( g_opts.debug > 1 ) fprintf(stderr,"+d nifti_make_new_header, dim[0] = %d, datatype = %d\n", dim[0], dtype); nhdr = (nifti_1_header *)calloc(1,sizeof(nifti_1_header)); if( !nhdr ){ fprintf(stderr,"** nifti_make_new_header: failed to alloc hdr\n"); return NULL; } nhdr->sizeof_hdr = sizeof(nifti_1_header) ; nhdr->regular = 'r' ; /* for some stupid reason */ /* init dim and pixdim */ nhdr->dim[0] = dim[0] ; nhdr->pixdim[0] = 0.0; for( c = 1; c <= dim[0]; c++ ) { nhdr->dim[c] = dim[c]; nhdr->pixdim[c] = 1.0; } nhdr->datatype = dtype ; nifti_datatype_sizes( nhdr->datatype , &nbyper, &swapsize ); nhdr->bitpix = 8 * nbyper ; strcpy(nhdr->magic, "n+1"); /* init to single file */ return nhdr; } /*----------------------------------------------------------------------*/ /*! basic creation of a nifti_image struct Create a nifti_image from the given dimensions and data type. Optinally, allocate zero-filled data. \param dims : optional dim[8] (default {3,1,1,1,0,0,0,0}) \param datatype : optional datatype (default DT_FLOAT32) \param data_fill : if flag is set, allocate zero-filled data for image \return pointer to allocated nifti_image struct *//*--------------------------------------------------------------------*/ nifti_image * nifti_make_new_nim(const int dims[], int datatype, int data_fill) { nifti_image * nim; nifti_1_header * nhdr; nhdr = nifti_make_new_header(dims, datatype); if( !nhdr ) return NULL; /* error already printed */ nim = nifti_convert_nhdr2nim(*nhdr,NULL); free(nhdr); /* in any case, we are done with this */ if( !nim ){ fprintf(stderr,"** NMNN: nifti_convert_nhdr2nim failure\n"); return NULL; } if( g_opts.debug > 1 ) fprintf(stderr,"+d nifti_make_new_nim, data_fill = %d\n",data_fill); if( data_fill ) { nim->data = calloc(nim->nvox, nim->nbyper); /* if we cannot allocate data, take ball and go home */ if( !nim->data ) { fprintf(stderr,"** NMNN: failed to alloc %u bytes for data\n", (unsigned)(nim->nvox*nim->nbyper)); nifti_image_free(nim); nim = NULL; } } return nim; } /*----------------------------------------------------------------------*/ /*! convert a nifti_image structure to a nifti_1_header struct No allocation is done, this should be used via structure copy. As in:
    nifti_1_header my_header;
    my_header = nifti_convert_nim2nhdr(my_nim_pointer);
    
*//*--------------------------------------------------------------------*/ struct nifti_1_header nifti_convert_nim2nhdr(const nifti_image * nim) { struct nifti_1_header nhdr; memset(&nhdr,0,sizeof(nhdr)) ; /* zero out header, to be safe */ /**- load the ANALYZE-7.5 generic parts of the header struct */ nhdr.sizeof_hdr = sizeof(nhdr) ; nhdr.regular = 'r' ; /* for some stupid reason */ nhdr.dim[0] = nim->ndim ; nhdr.dim[1] = nim->nx ; nhdr.dim[2] = nim->ny ; nhdr.dim[3] = nim->nz ; nhdr.dim[4] = nim->nt ; nhdr.dim[5] = nim->nu ; nhdr.dim[6] = nim->nv ; nhdr.dim[7] = nim->nw ; nhdr.pixdim[0] = 0.0 ; nhdr.pixdim[1] = nim->dx ; nhdr.pixdim[2] = nim->dy ; nhdr.pixdim[3] = nim->dz ; nhdr.pixdim[4] = nim->dt ; nhdr.pixdim[5] = nim->du ; nhdr.pixdim[6] = nim->dv ; nhdr.pixdim[7] = nim->dw ; nhdr.datatype = nim->datatype ; nhdr.bitpix = 8 * nim->nbyper ; if( nim->cal_max > nim->cal_min ){ nhdr.cal_max = nim->cal_max ; nhdr.cal_min = nim->cal_min ; } if( nim->scl_slope != 0.0 ){ nhdr.scl_slope = nim->scl_slope ; nhdr.scl_inter = nim->scl_inter ; } if( nim->descrip[0] != '\0' ){ memcpy(nhdr.descrip ,nim->descrip ,79) ; nhdr.descrip[79] = '\0' ; } if( nim->aux_file[0] != '\0' ){ memcpy(nhdr.aux_file ,nim->aux_file ,23) ; nhdr.aux_file[23] = '\0' ; } /**- Load NIFTI specific stuff into the header */ if( nim->nifti_type > NIFTI_FTYPE_ANALYZE ){ /* then not ANALYZE */ if( nim->nifti_type == NIFTI_FTYPE_NIFTI1_1 ) strcpy(nhdr.magic,"n+1") ; else strcpy(nhdr.magic,"ni1") ; nhdr.pixdim[1] = fabs(nhdr.pixdim[1]) ; nhdr.pixdim[2] = fabs(nhdr.pixdim[2]) ; nhdr.pixdim[3] = fabs(nhdr.pixdim[3]) ; nhdr.pixdim[4] = fabs(nhdr.pixdim[4]) ; nhdr.pixdim[5] = fabs(nhdr.pixdim[5]) ; nhdr.pixdim[6] = fabs(nhdr.pixdim[6]) ; nhdr.pixdim[7] = fabs(nhdr.pixdim[7]) ; nhdr.intent_code = nim->intent_code ; nhdr.intent_p1 = nim->intent_p1 ; nhdr.intent_p2 = nim->intent_p2 ; nhdr.intent_p3 = nim->intent_p3 ; if( nim->intent_name[0] != '\0' ){ memcpy(nhdr.intent_name,nim->intent_name,15) ; nhdr.intent_name[15] = '\0' ; } nhdr.vox_offset = (float) nim->iname_offset ; nhdr.xyzt_units = SPACE_TIME_TO_XYZT( nim->xyz_units, nim->time_units ) ; nhdr.toffset = nim->toffset ; if( nim->qform_code > 0 ){ nhdr.qform_code = nim->qform_code ; nhdr.quatern_b = nim->quatern_b ; nhdr.quatern_c = nim->quatern_c ; nhdr.quatern_d = nim->quatern_d ; nhdr.qoffset_x = nim->qoffset_x ; nhdr.qoffset_y = nim->qoffset_y ; nhdr.qoffset_z = nim->qoffset_z ; nhdr.pixdim[0] = (nim->qfac >= 0.0) ? 1.0 : -1.0 ; } if( nim->sform_code > 0 ){ nhdr.sform_code = nim->sform_code ; nhdr.srow_x[0] = nim->sto_xyz.m[0][0] ; nhdr.srow_x[1] = nim->sto_xyz.m[0][1] ; nhdr.srow_x[2] = nim->sto_xyz.m[0][2] ; nhdr.srow_x[3] = nim->sto_xyz.m[0][3] ; nhdr.srow_y[0] = nim->sto_xyz.m[1][0] ; nhdr.srow_y[1] = nim->sto_xyz.m[1][1] ; nhdr.srow_y[2] = nim->sto_xyz.m[1][2] ; nhdr.srow_y[3] = nim->sto_xyz.m[1][3] ; nhdr.srow_z[0] = nim->sto_xyz.m[2][0] ; nhdr.srow_z[1] = nim->sto_xyz.m[2][1] ; nhdr.srow_z[2] = nim->sto_xyz.m[2][2] ; nhdr.srow_z[3] = nim->sto_xyz.m[2][3] ; } nhdr.dim_info = FPS_INTO_DIM_INFO( nim->freq_dim , nim->phase_dim , nim->slice_dim ) ; nhdr.slice_code = nim->slice_code ; nhdr.slice_start = nim->slice_start ; nhdr.slice_end = nim->slice_end ; nhdr.slice_duration = nim->slice_duration ; } return nhdr; } /*----------------------------------------------------------------------*/ /*! \fn int nifti_copy_extensions(nifti_image * nim_dest, nifti_image * nim_src) \brief copy the nifti1_extension list from src to dest Duplicate the list of nifti1_extensions. The dest structure must be clear of extensions. \return 0 on success, -1 on failure \sa nifti_add_extension, nifti_free_extensions */ int nifti_copy_extensions(nifti_image * nim_dest, const nifti_image * nim_src) { char * data; size_t bytes; int c, size, old_size; if( nim_dest->num_ext > 0 || nim_dest->ext_list != NULL ){ fprintf(stderr,"** will not copy extensions over existing ones\n"); return -1; } if( g_opts.debug > 1 ) fprintf(stderr,"+d duplicating %d extension(s)\n", nim_src->num_ext); if( nim_src->num_ext <= 0 ) return 0; bytes = nim_src->num_ext * sizeof(nifti1_extension); /* I'm lazy */ nim_dest->ext_list = (nifti1_extension *)malloc(bytes); if( !nim_dest->ext_list ){ fprintf(stderr,"** failed to allocate %d nifti1_extension structs\n", nim_src->num_ext); return -1; } /* copy the extension data */ nim_dest->num_ext = 0; for( c = 0; c < nim_src->num_ext; c++ ){ size = old_size = nim_src->ext_list[c].esize; if( size & 0xf ) size = (size + 0xf) & ~0xf; /* make multiple of 16 */ if( g_opts.debug > 2 ) fprintf(stderr,"+d dup'ing ext #%d of size %d (from size %d)\n", c, size, old_size); /* data length is size-8, as esize includes space for esize and ecode */ data = (char *)calloc(size-8,sizeof(char)); /* maybe size > old */ if( !data ){ fprintf(stderr,"** failed to alloc %d bytes for extention\n", size); if( c == 0 ) { free(nim_dest->ext_list); nim_dest->ext_list = NULL; } /* otherwise, keep what we have (a.o.t. deleting them all) */ return -1; } /* finally, fill the new structure */ nim_dest->ext_list[c].esize = size; nim_dest->ext_list[c].ecode = nim_src->ext_list[c].ecode; nim_dest->ext_list[c].edata = data; memcpy(data, nim_src->ext_list[c].edata, old_size-8); nim_dest->num_ext++; } return 0; } /*----------------------------------------------------------------------*/ /*! compute the total size of all extensions \return the total of all esize fields Note that each esize includes 4 bytes for ecode, 4 bytes for esize, and the bytes used for the data. Each esize also needs to be a multiple of 16, so it may be greater than the sum of its 3 parts. *//*--------------------------------------------------------------------*/ int nifti_extension_size(nifti_image *nim) { int c, size = 0; if( !nim || nim->num_ext <= 0 ) return 0; if( g_opts.debug > 2 ) fprintf(stderr,"-d ext sizes:"); for ( c = 0; c < nim->num_ext; c++ ){ size += nim->ext_list[c].esize; if( g_opts.debug > 2 ) fprintf(stderr," %d",nim->ext_list[c].esize); } if( g_opts.debug > 2 ) fprintf(stderr," (total = %d)\n",size); return size; } /*----------------------------------------------------------------------*/ /*! set the nifti_image iname_offset field, based on nifti_type - if writing to 2 files, set offset to 0 - if writing to a single NIFTI-1 file, set the offset to 352 + total extension size, then align to 16-byte boundary - if writing an ASCII header, set offset to -1 *//*--------------------------------------------------------------------*/ void nifti_set_iname_offset(nifti_image *nim) { int offset; switch( nim->nifti_type ){ default: /* writing into 2 files */ /* we only write files with 0 offset in the 2 file format */ nim->iname_offset = 0 ; break ; /* NIFTI-1 single binary file - always update */ case NIFTI_FTYPE_NIFTI1_1: offset = nifti_extension_size(nim)+sizeof(struct nifti_1_header)+4; /* be sure offset is aligned to a 16 byte boundary */ if ( ( offset % 16 ) != 0 ) offset = ((offset + 0xf) & ~0xf); if( nim->iname_offset != offset ){ if( g_opts.debug > 1 ) fprintf(stderr,"+d changing offset from %d to %d\n", nim->iname_offset, offset); nim->iname_offset = offset; } break ; /* non-standard case: NIFTI-1 ASCII header + binary data (single file) */ case NIFTI_FTYPE_ASCII: nim->iname_offset = -1 ; /* compute offset from filesize */ break ; } } /*----------------------------------------------------------------------*/ /*! write the nifti_image dataset to disk, optionally including data This is just a front-end for nifti_image_write_hdr_img2. \param nim nifti_image to write to disk \param write_data write options (see nifti_image_write_hdr_img2) \param opts file open options ("wb" from nifti_image_write) \sa nifti_image_write, nifti_image_write_hdr_img2, nifti_image_free, nifti_set_filenames *//*--------------------------------------------------------------------*/ znzFile nifti_image_write_hdr_img( nifti_image *nim , int write_data , const char* opts ) { return nifti_image_write_hdr_img2(nim,write_data,opts,NULL,NULL); } #undef ERREX #define ERREX(msg) \ do{ fprintf(stderr,"** ERROR: nifti_image_write_hdr_img: %s\n",(msg)) ; \ return fp ; } while(0) /* ----------------------------------------------------------------------*/ /*! This writes the header (and optionally the image data) to file * * If the image data file is left open it returns a valid znzFile handle. * It also uses imgfile as the open image file is not null, and modifies * it inside. * * \param nim nifti_image to write to disk * \param write_opts flags whether to write data and/or close file (see below) * \param opts file-open options, probably "wb" from nifti_image_write() * \param imgfile optional open znzFile struct, for writing image data (may be NULL) * \param NBL optional nifti_brick_list, containing the image data (may be NULL) * * Values for write_opts mode are based on two binary flags * ( 0/1 for no-write/write data, and 0/2 for close/leave-open files ) : * - 0 = do not write data and close (do not open data file) * - 1 = write data and close * - 2 = do not write data and leave data file open * - 3 = write data and leave data file open * * \sa nifti_image_write, nifti_image_write_hdr_img, nifti_image_free, * nifti_set_filenames *//*---------------------------------------------------------------------*/ znzFile nifti_image_write_hdr_img2(nifti_image *nim, int write_opts, const char * opts, znzFile imgfile, const nifti_brick_list * NBL) { struct nifti_1_header nhdr ; znzFile fp=NULL; size_t ss ; int write_data, leave_open; char func[] = { "nifti_image_write_hdr_img2" }; write_data = write_opts & 1; /* just separate the bits now */ leave_open = write_opts & 2; if( ! nim ) ERREX("NULL input") ; if( ! nifti_validfilename(nim->fname) ) ERREX("bad fname input") ; if( write_data && ! nim->data && ! NBL ) ERREX("no image data") ; if( write_data && NBL && ! nifti_NBL_matches_nim(nim, NBL) ) ERREX("NBL does not match nim"); nifti_set_iname_offset(nim); if( g_opts.debug > 1 ){ fprintf(stderr,"-d writing nifti file '%s'...\n", nim->fname); if( g_opts.debug > 2 ) fprintf(stderr,"-d nifti type %d, offset %d\n", nim->nifti_type, nim->iname_offset); } if( nim->nifti_type == NIFTI_FTYPE_ASCII ) /* non-standard case */ return nifti_write_ascii_image(nim,NBL,opts,write_data,leave_open); nhdr = nifti_convert_nim2nhdr(nim); /* create the nifti1_header struct */ /* if writing to 2 files, make sure iname is set and different from fname */ if( nim->nifti_type != NIFTI_FTYPE_NIFTI1_1 ){ if( nim->iname && strcmp(nim->iname,nim->fname) == 0 ){ free(nim->iname) ; nim->iname = NULL ; } if( nim->iname == NULL ){ /* then make a new one */ nim->iname = nifti_makeimgname(nim->fname,nim->nifti_type,0,0); if( nim->iname == NULL ) return NULL; } } /* if we have an imgfile and will write the header there, use it */ if( ! znz_isnull(imgfile) && nim->nifti_type == NIFTI_FTYPE_NIFTI1_1 ){ if( g_opts.debug > 2 ) fprintf(stderr,"+d using passed file for hdr\n"); fp = imgfile; } else { if( g_opts.debug > 2 ) fprintf(stderr,"+d opening output file %s [%s]\n",nim->fname,opts); fp = znzopen( nim->fname , opts , nifti_is_gzfile(nim->fname) ) ; if( znz_isnull(fp) ){ LNI_FERR(func,"cannot open output file",nim->fname); return fp; } } /* write the header and extensions */ ss = znzwrite(&nhdr , 1 , sizeof(nhdr) , fp); /* write header */ if( ss < sizeof(nhdr) ){ LNI_FERR(func,"bad header write to output file",nim->fname); znzclose(fp); return fp; } /* partial file exists, and errors have been printed, so ignore return */ if( nim->nifti_type != NIFTI_FTYPE_ANALYZE ) (void)nifti_write_extensions(fp,nim); /* if the header is all we want, we are done */ if( ! write_data && ! leave_open ){ if( g_opts.debug > 2 ) fprintf(stderr,"-d header is all we want: done\n"); znzclose(fp); return(fp); } if( nim->nifti_type != NIFTI_FTYPE_NIFTI1_1 ){ /* get a new file pointer */ znzclose(fp); /* first, close header file */ if( ! znz_isnull(imgfile) ){ if(g_opts.debug > 2) fprintf(stderr,"+d using passed file for img\n"); fp = imgfile; } else { if( g_opts.debug > 2 ) fprintf(stderr,"+d opening img file '%s'\n", nim->iname); fp = znzopen( nim->iname , opts , nifti_is_gzfile(nim->iname) ) ; if( znz_isnull(fp) ) ERREX("cannot open image file") ; } } znzseek(fp, nim->iname_offset, SEEK_SET); /* in any case, seek to offset */ if( write_data ) nifti_write_all_data(fp,nim,NBL); if( ! leave_open ) znzclose(fp); return fp; } /*----------------------------------------------------------------------*/ /*! write a nifti_image to disk in ASCII format *//*--------------------------------------------------------------------*/ znzFile nifti_write_ascii_image(nifti_image *nim, const nifti_brick_list * NBL, const char *opts, int write_data, int leave_open) { znzFile fp; char * hstr; hstr = nifti_image_to_ascii( nim ) ; /* get header in ASCII form */ if( ! hstr ){ fprintf(stderr,"** failed image_to_ascii()\n"); return NULL; } fp = znzopen( nim->fname , opts , nifti_is_gzfile(nim->fname) ) ; if( znz_isnull(fp) ){ free(hstr); fprintf(stderr,"** failed to open '%s' for ascii write\n",nim->fname); return fp; } znzputs(hstr,fp); /* header */ nifti_write_extensions(fp,nim); /* extensions */ if ( write_data ) { nifti_write_all_data(fp,nim,NBL); } /* data */ if ( ! leave_open ) { znzclose(fp); } free(hstr); return fp; /* returned but may be closed */ } /*--------------------------------------------------------------------------*/ /*! Write a nifti_image to disk. Since data is properly byte-swapped upon reading, it is assumed to be in the byte-order of the current CPU at write time. Thus, nim->byte_order should match that of the current CPU. Note that the nifti_set_filenames() function takes the flag, set_byte_order. The following fields of nim affect how the output appears: - nifti_type = 0 ==> ANALYZE-7.5 format file pair will be written - nifti_type = 1 ==> NIFTI-1 format single file will be written (data offset will be 352+extensions) - nifti_type = 2 ==> NIFTI_1 format file pair will be written - nifti_type = 3 ==> NIFTI_1 ASCII single file will be written - fname is the name of the output file (header or header+data) - if a file pair is being written, iname is the name of the data file - existing files WILL be overwritten with extreme prejudice - if qform_code > 0, the quatern_*, qoffset_*, and qfac fields determine the qform output, NOT the qto_xyz matrix; if you want to compute these fields from the qto_xyz matrix, you can use the utility function nifti_mat44_to_quatern() \sa nifti_image_write_bricks, nifti_image_free, nifti_set_filenames, nifti_image_write_hdr_img *//*------------------------------------------------------------------------*/ void nifti_image_write( nifti_image *nim ) { znzFile fp = nifti_image_write_hdr_img(nim,1,"wb"); if( fp ){ if( g_opts.debug > 2 ) fprintf(stderr,"-d niw: done with znzFile\n"); free(fp); } if( g_opts.debug > 1 ) fprintf(stderr,"-d nifti_image_write: done\n"); } /*----------------------------------------------------------------------*/ /*! similar to nifti_image_write, but data is in NBL struct, not nim->data \sa nifti_image_write, nifti_image_free, nifti_set_filenames, nifti_free_NBL *//*--------------------------------------------------------------------*/ void nifti_image_write_bricks( nifti_image *nim, const nifti_brick_list * NBL ) { znzFile fp = nifti_image_write_hdr_img2(nim,1,"wb",NULL,NBL); if( fp ){ if( g_opts.debug > 2 ) fprintf(stderr,"-d niwb: done with znzFile\n"); free(fp); } if( g_opts.debug > 1 ) fprintf(stderr,"-d niwb: done writing bricks\n"); } /*----------------------------------------------------------------------*/ /*! copy the nifti_image structure, without data Duplicate the structure, including fname, iname and extensions. Leave the data pointer as NULL. *//*--------------------------------------------------------------------*/ nifti_image * nifti_copy_nim_info(const nifti_image * src) { nifti_image *dest; dest = (nifti_image *)calloc(1,sizeof(nifti_image)); if( !dest ){ fprintf(stderr,"** NCNI: failed to alloc nifti_image\n"); return NULL; } memcpy(dest, src, sizeof(nifti_image)); if( src->fname ) dest->fname = nifti_strdup(src->fname); if( src->iname ) dest->iname = nifti_strdup(src->iname); dest->num_ext = 0; dest->ext_list = NULL; /* errors will be printed in NCE(), continue in either case */ (void)nifti_copy_extensions(dest, src); dest->data = NULL; return dest; } /*------------------------------------------------------------------------*/ /* Un-escape a C string in place -- that is, convert XML escape sequences back into their characters. (This can be done in place since the replacement is always smaller than the input.) Escapes recognized are: - < -> < - > -> > - " -> " - ' -> ' - & -> & Also replace CR LF pair (Microsoft), or CR alone (Macintosh) with LF (Unix), per the XML standard. Return value is number of replacements made (if you care). --------------------------------------------------------------------------*/ #undef CR #undef LF #define CR 0x0D #define LF 0x0A static int unescape_string( char *str ) { int ii,jj , nn,ll ; if( str == NULL ) return 0 ; /* no string? */ ll = (int)strlen(str) ; if( ll == 0 ) return 0 ; /* scan for escapes: &something; */ for( ii=jj=nn=0 ; ii': lout += 4 ; break ; /* replace '<' with "<" */ case '"' : case '\'': lout += 6 ; break ; /* replace '"' with """ */ case CR: case LF: lout += 6 ; break ; /* replace CR with " " LF with " " */ default: lout++ ; break ; /* copy all other chars */ } } out = (char *)calloc(1,lout) ; /* allocate output string */ if( !out ){ fprintf(stderr,"** escapize_string: failed to alloc %d bytes\n",lout); return NULL; } out[0] = '\'' ; /* opening quote mark */ for( ii=0,jj=1 ; ii < lstr ; ii++ ){ switch( str[ii] ){ default: out[jj++] = str[ii] ; break ; /* normal characters */ case '&': memcpy(out+jj,"&",5) ; jj+=5 ; break ; case '<': memcpy(out+jj,"<",4) ; jj+=4 ; break ; case '>': memcpy(out+jj,">",4) ; jj+=4 ; break ; case '"' : memcpy(out+jj,""",6) ; jj+=6 ; break ; case '\'': memcpy(out+jj,"'",6) ; jj+=6 ; break ; case CR: memcpy(out+jj," ",6) ; jj+=6 ; break ; case LF: memcpy(out+jj," ",6) ; jj+=6 ; break ; } } out[jj++] = '\'' ; /* closing quote mark */ out[jj] = '\0' ; /* terminate the string */ return out ; } /*---------------------------------------------------------------------------*/ /*! Dump the information in a NIFTI image header to an XML-ish ASCII string that can later be converted back into a NIFTI header in nifti_image_from_ascii(). The resulting string can be free()-ed when you are done with it. *//*-------------------------------------------------------------------------*/ char *nifti_image_to_ascii( const nifti_image *nim ) { char *buf , *ebuf ; int nbuf ; if( nim == NULL ) return NULL ; /* stupid caller */ buf = (char *)calloc(1,65534); nbuf = 0; /* longer than needed, to be safe */ if( !buf ){ fprintf(stderr,"** NITA: failed to alloc %d bytes\n",65534); return NULL; } sprintf( buf , "nifti_type == NIFTI_FTYPE_NIFTI1_1) ? "NIFTI-1+" :(nim->nifti_type == NIFTI_FTYPE_NIFTI1_2) ? "NIFTI-1" :(nim->nifti_type == NIFTI_FTYPE_ASCII ) ? "NIFTI-1A" : "ANALYZE-7.5" ) ; /** Strings that we don't control (filenames, etc.) that might contain "weird" characters (like quotes) are "escaped": - A few special characters are replaced by XML-style escapes, using the function escapize_string(). - On input, function unescape_string() reverses this process. - The result is that the NIFTI ASCII-format header is XML-compliant. */ ebuf = escapize_string(nim->fname) ; sprintf( buf+strlen(buf) , " header_filename = %s\n",ebuf); free(ebuf); ebuf = escapize_string(nim->iname) ; sprintf( buf+strlen(buf) , " image_filename = %s\n", ebuf); free(ebuf); sprintf( buf+strlen(buf) , " image_offset = '%d'\n" , nim->iname_offset ); sprintf( buf+strlen(buf), " ndim = '%d'\n", nim->ndim); sprintf( buf+strlen(buf), " nx = '%d'\n", nim->nx ); if( nim->ndim > 1 ) sprintf( buf+strlen(buf), " ny = '%d'\n", nim->ny ); if( nim->ndim > 2 ) sprintf( buf+strlen(buf), " nz = '%d'\n", nim->nz ); if( nim->ndim > 3 ) sprintf( buf+strlen(buf), " nt = '%d'\n", nim->nt ); if( nim->ndim > 4 ) sprintf( buf+strlen(buf), " nu = '%d'\n", nim->nu ); if( nim->ndim > 5 ) sprintf( buf+strlen(buf), " nv = '%d'\n", nim->nv ); if( nim->ndim > 6 ) sprintf( buf+strlen(buf), " nw = '%d'\n", nim->nw ); sprintf( buf+strlen(buf), " dx = '%g'\n", nim->dx ); if( nim->ndim > 1 ) sprintf( buf+strlen(buf), " dy = '%g'\n", nim->dy ); if( nim->ndim > 2 ) sprintf( buf+strlen(buf), " dz = '%g'\n", nim->dz ); if( nim->ndim > 3 ) sprintf( buf+strlen(buf), " dt = '%g'\n", nim->dt ); if( nim->ndim > 4 ) sprintf( buf+strlen(buf), " du = '%g'\n", nim->du ); if( nim->ndim > 5 ) sprintf( buf+strlen(buf), " dv = '%g'\n", nim->dv ); if( nim->ndim > 6 ) sprintf( buf+strlen(buf), " dw = '%g'\n", nim->dw ); sprintf( buf+strlen(buf) , " datatype = '%d'\n" , nim->datatype ) ; sprintf( buf+strlen(buf) , " datatype_name = '%s'\n" , nifti_datatype_string(nim->datatype) ) ; sprintf( buf+strlen(buf) , " nvox = '%u'\n" , (unsigned)nim->nvox ) ; sprintf( buf+strlen(buf) , " nbyper = '%d'\n" , nim->nbyper ) ; sprintf( buf+strlen(buf) , " byteorder = '%s'\n" , (nim->byteorder==MSB_FIRST) ? "MSB_FIRST" : "LSB_FIRST" ) ; if( nim->cal_min < nim->cal_max ){ sprintf( buf+strlen(buf) , " cal_min = '%g'\n", nim->cal_min ) ; sprintf( buf+strlen(buf) , " cal_max = '%g'\n", nim->cal_max ) ; } if( nim->scl_slope != 0.0 ){ sprintf( buf+strlen(buf) , " scl_slope = '%g'\n" , nim->scl_slope ) ; sprintf( buf+strlen(buf) , " scl_inter = '%g'\n" , nim->scl_inter ) ; } if( nim->intent_code > 0 ){ sprintf( buf+strlen(buf) , " intent_code = '%d'\n", nim->intent_code ) ; sprintf( buf+strlen(buf) , " intent_code_name = '%s'\n" , nifti_intent_string(nim->intent_code) ) ; sprintf( buf+strlen(buf) , " intent_p1 = '%g'\n" , nim->intent_p1 ) ; sprintf( buf+strlen(buf) , " intent_p2 = '%g'\n" , nim->intent_p2 ) ; sprintf( buf+strlen(buf) , " intent_p3 = '%g'\n" , nim->intent_p3 ) ; if( nim->intent_name[0] != '\0' ){ ebuf = escapize_string(nim->intent_name) ; sprintf( buf+strlen(buf) , " intent_name = %s\n",ebuf) ; free(ebuf) ; } } if( nim->toffset != 0.0 ) sprintf( buf+strlen(buf) , " toffset = '%g'\n",nim->toffset ) ; if( nim->xyz_units > 0 ) sprintf( buf+strlen(buf) , " xyz_units = '%d'\n" " xyz_units_name = '%s'\n" , nim->xyz_units , nifti_units_string(nim->xyz_units) ) ; if( nim->time_units > 0 ) sprintf( buf+strlen(buf) , " time_units = '%d'\n" " time_units_name = '%s'\n" , nim->time_units , nifti_units_string(nim->time_units) ) ; if( nim->freq_dim > 0 ) sprintf( buf+strlen(buf) , " freq_dim = '%d'\n",nim->freq_dim ) ; if( nim->phase_dim > 0 ) sprintf( buf+strlen(buf) , " phase_dim = '%d'\n",nim->phase_dim ) ; if( nim->slice_dim > 0 ) sprintf( buf+strlen(buf) , " slice_dim = '%d'\n",nim->slice_dim ) ; if( nim->slice_code > 0 ) sprintf( buf+strlen(buf) , " slice_code = '%d'\n" " slice_code_name = '%s'\n" , nim->slice_code , nifti_slice_string(nim->slice_code) ) ; if( nim->slice_start >= 0 && nim->slice_end > nim->slice_start ) sprintf( buf+strlen(buf) , " slice_start = '%d'\n" " slice_end = '%d'\n" , nim->slice_start , nim->slice_end ) ; if( nim->slice_duration != 0.0 ) sprintf( buf+strlen(buf) , " slice_duration = '%g'\n", nim->slice_duration ) ; if( nim->descrip[0] != '\0' ){ ebuf = escapize_string(nim->descrip) ; sprintf( buf+strlen(buf) , " descrip = %s\n",ebuf) ; free(ebuf) ; } if( nim->aux_file[0] != '\0' ){ ebuf = escapize_string(nim->aux_file) ; sprintf( buf+strlen(buf) , " aux_file = %s\n",ebuf) ; free(ebuf) ; } if( nim->qform_code > 0 ){ int i,j,k ; sprintf( buf+strlen(buf) , " qform_code = '%d'\n" " qform_code_name = '%s'\n" " qto_xyz_matrix = '%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g'\n" , nim->qform_code , nifti_xform_string(nim->qform_code) , nim->qto_xyz.m[0][0] , nim->qto_xyz.m[0][1] , nim->qto_xyz.m[0][2] , nim->qto_xyz.m[0][3] , nim->qto_xyz.m[1][0] , nim->qto_xyz.m[1][1] , nim->qto_xyz.m[1][2] , nim->qto_xyz.m[1][3] , nim->qto_xyz.m[2][0] , nim->qto_xyz.m[2][1] , nim->qto_xyz.m[2][2] , nim->qto_xyz.m[2][3] , nim->qto_xyz.m[3][0] , nim->qto_xyz.m[3][1] , nim->qto_xyz.m[3][2] , nim->qto_xyz.m[3][3] ) ; sprintf( buf+strlen(buf) , " qto_ijk_matrix = '%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g'\n" , nim->qto_ijk.m[0][0] , nim->qto_ijk.m[0][1] , nim->qto_ijk.m[0][2] , nim->qto_ijk.m[0][3] , nim->qto_ijk.m[1][0] , nim->qto_ijk.m[1][1] , nim->qto_ijk.m[1][2] , nim->qto_ijk.m[1][3] , nim->qto_ijk.m[2][0] , nim->qto_ijk.m[2][1] , nim->qto_ijk.m[2][2] , nim->qto_ijk.m[2][3] , nim->qto_ijk.m[3][0] , nim->qto_ijk.m[3][1] , nim->qto_ijk.m[3][2] , nim->qto_ijk.m[3][3] ) ; sprintf( buf+strlen(buf) , " quatern_b = '%g'\n" " quatern_c = '%g'\n" " quatern_d = '%g'\n" " qoffset_x = '%g'\n" " qoffset_y = '%g'\n" " qoffset_z = '%g'\n" " qfac = '%g'\n" , nim->quatern_b , nim->quatern_c , nim->quatern_d , nim->qoffset_x , nim->qoffset_y , nim->qoffset_z , nim->qfac ) ; nifti_mat44_to_orientation( nim->qto_xyz , &i,&j,&k ) ; if( i > 0 && j > 0 && k > 0 ) sprintf( buf+strlen(buf) , " qform_i_orientation = '%s'\n" " qform_j_orientation = '%s'\n" " qform_k_orientation = '%s'\n" , nifti_orientation_string(i) , nifti_orientation_string(j) , nifti_orientation_string(k) ) ; } if( nim->sform_code > 0 ){ int i,j,k ; sprintf( buf+strlen(buf) , " sform_code = '%d'\n" " sform_code_name = '%s'\n" " sto_xyz_matrix = '%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g'\n" , nim->sform_code , nifti_xform_string(nim->sform_code) , nim->sto_xyz.m[0][0] , nim->sto_xyz.m[0][1] , nim->sto_xyz.m[0][2] , nim->sto_xyz.m[0][3] , nim->sto_xyz.m[1][0] , nim->sto_xyz.m[1][1] , nim->sto_xyz.m[1][2] , nim->sto_xyz.m[1][3] , nim->sto_xyz.m[2][0] , nim->sto_xyz.m[2][1] , nim->sto_xyz.m[2][2] , nim->sto_xyz.m[2][3] , nim->sto_xyz.m[3][0] , nim->sto_xyz.m[3][1] , nim->sto_xyz.m[3][2] , nim->sto_xyz.m[3][3] ) ; sprintf( buf+strlen(buf) , " sto_ijk matrix = '%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g'\n" , nim->sto_ijk.m[0][0] , nim->sto_ijk.m[0][1] , nim->sto_ijk.m[0][2] , nim->sto_ijk.m[0][3] , nim->sto_ijk.m[1][0] , nim->sto_ijk.m[1][1] , nim->sto_ijk.m[1][2] , nim->sto_ijk.m[1][3] , nim->sto_ijk.m[2][0] , nim->sto_ijk.m[2][1] , nim->sto_ijk.m[2][2] , nim->sto_ijk.m[2][3] , nim->sto_ijk.m[3][0] , nim->sto_ijk.m[3][1] , nim->sto_ijk.m[3][2] , nim->sto_ijk.m[3][3] ) ; nifti_mat44_to_orientation( nim->sto_xyz , &i,&j,&k ) ; if( i > 0 && j > 0 && k > 0 ) sprintf( buf+strlen(buf) , " sform_i_orientation = '%s'\n" " sform_j_orientation = '%s'\n" " sform_k_orientation = '%s'\n" , nifti_orientation_string(i) , nifti_orientation_string(j) , nifti_orientation_string(k) ) ; } sprintf( buf+strlen(buf) , " num_ext = '%d'\n", nim->num_ext ) ; sprintf( buf+strlen(buf) , "/>\n" ) ; /* XML-ish closer */ nbuf = (int)strlen(buf) ; buf = (char *)realloc((void *)buf, nbuf+1); /* cut back to proper length */ if( !buf ) fprintf(stderr,"** NITA: failed to realloc %d bytes\n",nbuf+1); return buf ; } /*---------------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/ /*! get the byte order for this CPU - LSB_FIRST means least significant byte, first (little endian) - MSB_FIRST means most significant byte, first (big endian) *//*--------------------------------------------------------------------*/ int nifti_short_order(void) /* determine this CPU's byte order */ { union { unsigned char bb[2] ; short ss ; } fred ; fred.bb[0] = 1 ; fred.bb[1] = 0 ; return (fred.ss == 1) ? LSB_FIRST : MSB_FIRST ; } /*---------------------------------------------------------------------------*/ #undef QQNUM #undef QNUM #undef QSTR /* macro to check lhs string against "n1"; if it matches, interpret rhs string as a number, and put it into nim->"n2" */ #define QQNUM(n1,n2) if( strcmp(lhs,#n1)==0 ) nim->n2=strtod(rhs,NULL) /* same, but where "n1" == "n2" */ #define QNUM(nam) QQNUM(nam,nam) /* macro to check lhs string against "nam"; if it matches, put rhs string into nim->"nam" string, with max length = "ml" */ #define QSTR(nam,ml) if( strcmp(lhs,#nam) == 0 ) \ strncpy(nim->nam,rhs,ml), nim->nam[ml]='\0' /*---------------------------------------------------------------------------*/ /*! Take an XML-ish ASCII string and create a NIFTI image header to match. NULL is returned if enough information isn't present in the input string. - The image data can later be loaded with nifti_image_load(). - The struct returned here can be liberated with nifti_image_free(). - Not a lot of error checking is done here to make sure that the input values are reasonable! *//*-------------------------------------------------------------------------*/ nifti_image *nifti_image_from_ascii( const char *str, int * bytes_read ) { char lhs[1024] , rhs[1024] ; int ii , spos, nn ; nifti_image *nim ; /* will be output */ if( str == NULL || *str == '\0' ) return NULL ; /* bad input!? */ /* scan for opening string */ spos = 0 ; ii = sscanf( str+spos , "%1023s%n" , lhs , &nn ) ; spos += nn ; if( ii == 0 || strcmp(lhs,"nx = nim->ny = nim->nz = nim->nt = nim->nu = nim->nv = nim->nw = 1 ; nim->dx = nim->dy = nim->dz = nim->dt = nim->du = nim->dv = nim->dw = 0 ; nim->qfac = 1.0 ; nim->byteorder = nifti_short_order() ; /* starting at str[spos], scan for "equations" of the form lhs = 'rhs' and assign rhs values into the struct component named by lhs */ while(1){ while( isspace((int) str[spos]) ) spos++ ; /* skip whitespace */ if( str[spos] == '\0' ) break ; /* end of string? */ /* get lhs string */ ii = sscanf( str+spos , "%1023s%n" , lhs , &nn ) ; spos += nn ; if( ii == 0 || strcmp(lhs,"/>") == 0 ) break ; /* end of input? */ /* skip whitespace and the '=' marker */ while( isspace((int) str[spos]) || str[spos] == '=' ) spos++ ; if( str[spos] == '\0' ) break ; /* end of string? */ /* if next character is a quote ', copy everything up to next ' otherwise, copy everything up to next nonblank */ if( str[spos] == '\'' ){ ii = spos+1 ; while( str[ii] != '\0' && str[ii] != '\'' ) ii++ ; nn = ii-spos-1 ; if( nn > 1023 ) nn = 1023 ; memcpy(rhs,str+spos+1,nn) ; rhs[nn] = '\0' ; spos = (str[ii] == '\'') ? ii+1 : ii ; } else { ii = sscanf( str+spos , "%1023s%n" , rhs , &nn ) ; spos += nn ; if( ii == 0 ) break ; /* nothing found? */ } unescape_string(rhs) ; /* remove any XML escape sequences */ /* Now can do the assignment, based on lhs string. Start with special cases that don't fit the QNUM/QSTR macros. */ if( strcmp(lhs,"nifti_type") == 0 ){ if( strcmp(rhs,"ANALYZE-7.5") == 0 ) nim->nifti_type = NIFTI_FTYPE_ANALYZE ; else if( strcmp(rhs,"NIFTI-1+") == 0 ) nim->nifti_type = NIFTI_FTYPE_NIFTI1_1 ; else if( strcmp(rhs,"NIFTI-1") == 0 ) nim->nifti_type = NIFTI_FTYPE_NIFTI1_2 ; else if( strcmp(rhs,"NIFTI-1A") == 0 ) nim->nifti_type = NIFTI_FTYPE_ASCII ; } else if( strcmp(lhs,"header_filename") == 0 ){ nim->fname = nifti_strdup(rhs) ; } else if( strcmp(lhs,"image_filename") == 0 ){ nim->iname = nifti_strdup(rhs) ; } else if( strcmp(lhs,"sto_xyz_matrix") == 0 ){ sscanf( rhs , "%f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f" , &(nim->sto_xyz.m[0][0]) , &(nim->sto_xyz.m[0][1]) , &(nim->sto_xyz.m[0][2]) , &(nim->sto_xyz.m[0][3]) , &(nim->sto_xyz.m[1][0]) , &(nim->sto_xyz.m[1][1]) , &(nim->sto_xyz.m[1][2]) , &(nim->sto_xyz.m[1][3]) , &(nim->sto_xyz.m[2][0]) , &(nim->sto_xyz.m[2][1]) , &(nim->sto_xyz.m[2][2]) , &(nim->sto_xyz.m[2][3]) , &(nim->sto_xyz.m[3][0]) , &(nim->sto_xyz.m[3][1]) , &(nim->sto_xyz.m[3][2]) , &(nim->sto_xyz.m[3][3]) ) ; } else if( strcmp(lhs,"byteorder") == 0 ){ if( strcmp(rhs,"MSB_FIRST") == 0 ) nim->byteorder = MSB_FIRST ; if( strcmp(rhs,"LSB_FIRST") == 0 ) nim->byteorder = LSB_FIRST ; } else QQNUM(image_offset,iname_offset) ; else QNUM(datatype) ; else QNUM(ndim) ; else QNUM(nx) ; else QNUM(ny) ; else QNUM(nz) ; else QNUM(nt) ; else QNUM(nu) ; else QNUM(nv) ; else QNUM(nw) ; else QNUM(dx) ; else QNUM(dy) ; else QNUM(dz) ; else QNUM(dt) ; else QNUM(du) ; else QNUM(dv) ; else QNUM(dw) ; else QNUM(cal_min) ; else QNUM(cal_max) ; else QNUM(scl_slope) ; else QNUM(scl_inter) ; else QNUM(intent_code) ; else QNUM(intent_p1) ; else QNUM(intent_p2) ; else QNUM(intent_p3) ; else QSTR(intent_name,15) ; else QNUM(toffset) ; else QNUM(xyz_units) ; else QNUM(time_units) ; else QSTR(descrip,79) ; else QSTR(aux_file,23) ; else QNUM(qform_code) ; else QNUM(quatern_b) ; else QNUM(quatern_c) ; else QNUM(quatern_d) ; else QNUM(qoffset_x) ; else QNUM(qoffset_y) ; else QNUM(qoffset_z) ; else QNUM(qfac) ; else QNUM(sform_code) ; else QNUM(freq_dim) ; else QNUM(phase_dim) ; else QNUM(slice_dim) ; else QNUM(slice_code) ; else QNUM(slice_start) ; else QNUM(slice_end) ; else QNUM(slice_duration) ; else QNUM(num_ext) ; } /* end of while loop */ if( bytes_read ) *bytes_read = spos+1; /* "process" last '\n' */ /* do miscellaneous checking and cleanup */ if( nim->ndim <= 0 ){ nifti_image_free(nim); return NULL; } /* bad! */ nifti_datatype_sizes( nim->datatype, &(nim->nbyper), &(nim->swapsize) ); if( nim->nbyper == 0 ){ nifti_image_free(nim); return NULL; } /* bad! */ nim->dim[0] = nim->ndim ; nim->dim[1] = nim->nx ; nim->pixdim[1] = nim->dx ; nim->dim[2] = nim->ny ; nim->pixdim[2] = nim->dy ; nim->dim[3] = nim->nz ; nim->pixdim[3] = nim->dz ; nim->dim[4] = nim->nt ; nim->pixdim[4] = nim->dt ; nim->dim[5] = nim->nu ; nim->pixdim[5] = nim->du ; nim->dim[6] = nim->nv ; nim->pixdim[6] = nim->dv ; nim->dim[7] = nim->nw ; nim->pixdim[7] = nim->dw ; nim->nvox = (size_t)nim->nx * nim->ny * nim->nz * nim->nt * nim->nu * nim->nv * nim->nw ; if( nim->qform_code > 0 ) nim->qto_xyz = nifti_quatern_to_mat44( nim->quatern_b, nim->quatern_c, nim->quatern_d, nim->qoffset_x, nim->qoffset_y, nim->qoffset_z, nim->dx , nim->dy , nim->dz , nim->qfac ) ; else nim->qto_xyz = nifti_quatern_to_mat44( 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , nim->dx , nim->dy , nim->dz , 0.0 ) ; nim->qto_ijk = nifti_mat44_inverse( nim->qto_xyz ) ; if( nim->sform_code > 0 ) nim->sto_ijk = nifti_mat44_inverse( nim->sto_xyz ) ; return nim ; } /*---------------------------------------------------------------------------*/ /*! validate the nifti_image \return 1 if the structure seems valid, otherwise 0 \sa nifti_nim_has_valid_dims, nifti_hdr_looks_good *//*-------------------------------------------------------------------------*/ int nifti_nim_is_valid(nifti_image * nim, int complain) { int errs = 0; if( !nim ){ fprintf(stderr,"** is_valid_nim: nim is NULL\n"); return 0; } if( g_opts.debug > 2 ) fprintf(stderr,"-d nim_is_valid check...\n"); /**- check that dim[] matches the individual values ndim, nx, ny, ... */ if( ! nifti_nim_has_valid_dims(nim,complain) ){ if( !complain ) return 0; errs++; } /* might check nbyper, pixdim, q/sforms, swapsize, nifti_type, ... */ /**- be explicit in return of 0 or 1 */ if( errs > 0 ) return 0; else return 1; } /*---------------------------------------------------------------------------*/ /*! validate nifti dimensions \return 1 if valid, 0 if not \sa nifti_nim_is_valid, nifti_hdr_looks_good rely on dim[] as the master *//*-------------------------------------------------------------------------*/ int nifti_nim_has_valid_dims(nifti_image * nim, int complain) { size_t prod; int c, errs = 0; /**- start with dim[0]: failure here is considered terminal */ if( nim->dim[0] <= 0 || nim->dim[0] > 7 ){ errs++; if( complain ) fprintf(stderr,"** NVd: dim[0] (%d) out of range [1,7]\n",nim->dim[0]); return 0; } /**- check whether ndim equals dim[0] */ if( nim->ndim != nim->dim[0] ){ errs++; if( ! complain ) return 0; fprintf(stderr,"** NVd: ndim != dim[0] (%d,%d)\n",nim->ndim,nim->dim[0]); } /**- compare each dim[i] to the proper nx, ny, ... */ if( ( (nim->dim[0] >= 1) && (nim->dim[1] != nim->nx) ) || ( (nim->dim[0] >= 2) && (nim->dim[2] != nim->ny) ) || ( (nim->dim[0] >= 3) && (nim->dim[3] != nim->nz) ) || ( (nim->dim[0] >= 4) && (nim->dim[4] != nim->nt) ) || ( (nim->dim[0] >= 5) && (nim->dim[5] != nim->nu) ) || ( (nim->dim[0] >= 6) && (nim->dim[6] != nim->nv) ) || ( (nim->dim[0] >= 7) && (nim->dim[7] != nim->nw) ) ){ errs++; if( !complain ) return 0; fprintf(stderr,"** NVd mismatch: dims = %d,%d,%d,%d,%d,%d,%d\n" " nxyz... = %d,%d,%d,%d,%d,%d,%d\n", nim->dim[1], nim->dim[2], nim->dim[3], nim->dim[4], nim->dim[5], nim->dim[6], nim->dim[7], nim->nx, nim->ny, nim->nz, nim->nt, nim->nu, nim->nv, nim->nw ); } if( g_opts.debug > 2 ){ fprintf(stderr,"-d check dim[%d] =", nim->dim[0]); for( c = 0; c < 7; c++ ) fprintf(stderr," %d", nim->dim[c]); fputc('\n', stderr); } /**- check the dimensions, and that their product matches nvox */ prod = 1; for( c = 1; c <= nim->dim[0]; c++ ){ if( nim->dim[c] > 0) prod *= nim->dim[c]; else if( nim->dim[c] <= 0 ){ if( !complain ) return 0; fprintf(stderr,"** NVd: dim[%d] (=%d) <= 0\n",c, nim->dim[c]); errs++; } } if( prod != nim->nvox ){ if( ! complain ) return 0; fprintf(stderr,"** NVd: nvox does not match %d-dim product (%u, %u)\n", nim->dim[0], (unsigned)nim->nvox, (unsigned)prod); errs++; } /**- if debug, warn about any remaining dim that is neither 0, nor 1 */ /* (values in dims above dim[0] are undefined, as reminded by Cinly Ooi and Alle Meije Wink) 16 Nov 2005 [rickr] */ if( g_opts.debug > 1 ) for( c = nim->dim[0]+1; c <= 7; c++ ) if( nim->dim[c] != 0 && nim->dim[c] != 1 ) fprintf(stderr,"** NVd warning: dim[%d] = %d, but ndim = %d\n", c, nim->dim[c], nim->dim[0]); if( g_opts.debug > 2 ) fprintf(stderr,"-d nim_has_valid_dims check, errs = %d\n", errs); /**- return invalid or valid */ if( errs > 0 ) return 0; else return 1; } /*---------------------------------------------------------------------------*/ /*! read a nifti image, collapsed across dimensions according to dims[8]

    This function may be used to read parts of a nifti dataset, such as
    the time series for a single voxel, or perhaps a slice.  It is similar
    to nifti_image_load(), though the passed 'data' parameter is used for
    returning the image, not nim->data.

    \param nim  given nifti_image struct, corresponding to the data file
    \param dims given list of dimensions (see below)
    \param data pointer to data pointer (if *data is NULL, data will be
                allocated, otherwise not)

    Here, dims is an array of 8 ints, similar to nim->dim[8].  While dims[0]
    is unused at this point, the other indices specify which dimensions to
    collapse (and at which index), and which not to collapse.  If dims[i] is
    set to -1, then that entire dimension will be read in, from index 0 to
    index (nim->dim[i] - 1).  If dims[i] >= 0, then only that index will be
    read in (so dims[i] must also be < nim->dim[i]).

    Example: given  nim->dim[8] = { 4, 64, 64, 21, 80, 1, 1, 1 } (4-D dataset)

      if dims[8] = { 0,  5,  4, 17, -1, -1, -1, -1 }
         -> read time series for voxel i,j,k = 5,4,17

      if dims[8] = { 0, -1, -1, -1, 17, -1, -1, -1 }
         -> read single volume at time point 17

    Example: given  nim->dim[8] = { 6, 64, 64, 21, 80, 4, 3, 1 } (6-D dataset)

      if dims[8] = { 0, 5, 4, 17, -1, 2, 1, 0 }
         -> read time series for the voxel i,j,k = 5,4,17, and dim 5,6 = 2,1

      if dims[8] = { 0, 5, 4, -1, -1, 0, 0, 0 }
         -> read time series for slice at i,j = 5,4, and dim 5,6,7 = 0,0,0
            (note that dims[7] is not relevant, but must be 0 or -1)

    If *data is NULL, then *data will be set as a pointer to new memory,
    allocated here for the resulting collapsed image data.

      e.g. { int    dims[8] = { 0,  5,  4, 17, -1, -1, -1, -1 };
             void * data    = NULL;
             ret_val = nifti_read_collapsed_image(nim, dims, &data);
             if( ret_val > 0 ){
                process_time_series(data);
                if( data != NULL ) free(data);
             }
           }

    NOTE: If *data is not NULL, then it will be assumed that it points to
          valid memory, sufficient to hold the results.  This is done for
          speed and possibly repeated calls to this function.

      e.g. { int    dims[8] = { 0,  -1, -1, -1, -1, -1, -1, -1 };
             void * data    = NULL;
             for( zslice = 0; zslice < nzslices; zslice++ ){
                dims[3] = zslice;
                ret_val = nifti_read_collapsed_image(nim, dims, &data);
                if( ret_val > 0 ) process_slice(zslice, data);
             }
             if( data != NULL ) free(data);
           }

    \return
        -  the total number of bytes read, or < 0 on failure
        -  the read and byte-swapped data, in 'data'            
\sa nifti_image_read, nifti_image_free, nifti_image_read_bricks nifti_image_load *//*-------------------------------------------------------------------------*/ int nifti_read_collapsed_image( nifti_image * nim, const int dims [8], void ** data ) { znzFile fp; int pivots[8], prods[8], nprods; /* sizes are bounded by dims[], so 8 */ int c, bytes; /** - check pointers for sanity */ if( !nim || !dims || !data ){ fprintf(stderr,"** nifti_RCI: bad params %p, %p, %p\n", (void *)nim, (void *)dims, (void *)data); return -1; } if( g_opts.debug > 2 ){ fprintf(stderr,"-d read_collapsed_image:\n dims ="); for(c = 0; c < 8; c++) fprintf(stderr," %3d", dims[c]); fprintf(stderr,"\n nim->dims ="); for(c = 0; c < 8; c++) fprintf(stderr," %3d", nim->dim[c]); fputc('\n', stderr); } /** - verify that dim[] makes sense */ if( ! nifti_nim_is_valid(nim, g_opts.debug > 0) ){ fprintf(stderr,"** invalid nim (file is '%s')\n", nim->fname ); return -1; } /** - verify that dims[] makes sense for this dataset */ for( c = 1; c <= nim->dim[0]; c++ ){ if( dims[c] >= nim->dim[c] ){ fprintf(stderr,"** nifti_RCI: dims[%d] >= nim->dim[%d] (%d,%d)\n", c, c, dims[c], nim->dim[c]); return -1; } } /** - prepare pivot list - pivots are fixed indices */ if( make_pivot_list(nim, dims, pivots, prods, &nprods) < 0 ) return -1; bytes = rci_alloc_mem(data, prods, nprods, nim->nbyper); if( bytes < 0 ) return -1; /** - open the image file for reading at the appropriate offset */ fp = nifti_image_load_prep( nim ); if( ! fp ){ free(*data); *data = NULL; return -1; } /* failure */ /** - call the recursive reading function, passing nim, the pivot info, location to store memory, and file pointer and position */ c = rci_read_data(nim, pivots,prods,nprods,dims, (char *)*data, fp, znztell(fp)); znzclose(fp); /* in any case, close the file */ if( c < 0 ){ free(*data); *data = NULL; return -1; } /* failure */ if( g_opts.debug > 1 ) fprintf(stderr,"+d read %d bytes of collapsed image from %s\n", bytes, nim->fname); return bytes; } /* local function to find strides per dimension. assumes 7D size and ** stride array. */ static void compute_strides(int *strides,const int *size,int nbyper) { int i; strides[0] = nbyper; for(i = 1; i < 7; i++) { strides[i] = size[i-1] * strides[i-1]; } } /*---------------------------------------------------------------------------*/ /*! read an arbitrary subregion from a nifti image This function may be used to read a single arbitary subregion of any rectangular size from a nifti dataset, such as a small 5x5x5 subregion around the center of a 3D image. \param nim given nifti_image struct, corresponding to the data file \param start_index the index location of the first voxel that will be returned \param region_size the size of the subregion to be returned \param data pointer to data pointer (if *data is NULL, data will be allocated, otherwise not) Example: given nim->dim[8] = {3, 64, 64, 64, 1, 1, 1, 1 } (3-D dataset) if start_index[7] = { 29, 29, 29, 0, 0, 0, 0 } and region_size[7] = { 5, 5, 5, 1, 1, 1, 1 } -> read 5x5x5 region starting with the first voxel location at (29,29,29) NOTE: If *data is not NULL, then it will be assumed that it points to valid memory, sufficient to hold the results. This is done for speed and possibly repeated calls to this function. \return - the total number of bytes read, or < 0 on failure - the read and byte-swapped data, in 'data' \sa nifti_image_read, nifti_image_free, nifti_image_read_bricks nifti_image_load, nifti_read_collapsed_image *//*-------------------------------------------------------------------------*/ int nifti_read_subregion_image( nifti_image * nim, int *start_index, int *region_size, void ** data ) { znzFile fp; /* file to read */ int i,j,k,l,m,n; /* indices for dims */ long int bytes = 0; /* total # bytes read */ int total_alloc_size; /* size of buffer allocation */ char *readptr; /* where in *data to read next */ int strides[7]; /* strides between dimensions */ int collapsed_dims[8]; /* for read_collapsed_image */ int *image_size; /* pointer to dimensions in header */ long int initial_offset; long int offset; /* seek offset for reading current row */ /* probably ignored, but set to ndim for consistency*/ collapsed_dims[0] = nim->ndim; /* build a dims array for collapsed image read */ for(i = 0; i < nim->ndim; i++) { /* if you take the whole extent in this dimension */ if(start_index[i] == 0 && region_size[i] == nim->dim[i+1]) { collapsed_dims[i+1] = -1; } /* if you specify a single element in this dimension */ else if(region_size[i] == 1) { collapsed_dims[i+1] = start_index[i]; } else { collapsed_dims[i+1] = -2; /* sentinel value */ } } /* fill out end of collapsed_dims */ for(i = nim->ndim ; i < 7; i++) { collapsed_dims[i+1] = -1; } /* check to see whether collapsed read is possible */ for(i = 1; i <= nim->ndim; i++) { if(collapsed_dims[i] == -2) { break; } } /* if you get through all the dimensions without hitting ** a subrange of size > 1, a collapsed read is possible */ if(i > nim->ndim) { return nifti_read_collapsed_image(nim, collapsed_dims, data); } /* point past first element of dim, which holds nim->ndim */ image_size = &(nim->dim[1]); /* check region sizes for sanity */ for(i = 0; i < nim->ndim; i++) { if(start_index[i] + region_size[i] > image_size[i]) { if(g_opts.debug > 1) { fprintf(stderr,"region doesn't fit within image size\n"); } return -1; } } /* get the file open */ fp = nifti_image_load_prep( nim ); /* the current offset is just past the nifti header, save * location so that SEEK_SET can be used below */ initial_offset = znztell(fp); /* get strides*/ compute_strides(strides,image_size,nim->nbyper); total_alloc_size = nim->nbyper; /* size of pixel */ /* find alloc size */ for(i = 0; i < nim->ndim; i++) { total_alloc_size *= region_size[i]; } /* allocate buffer, if necessary */ if(*data == 0) { *data = (void *)malloc(total_alloc_size); } if(*data == 0) { if(g_opts.debug > 1) { fprintf(stderr,"allocation of %d bytes failed\n",total_alloc_size); return -1; } } /* point to start of data buffer as char * */ readptr = *((char **)data); { /* can't assume that start_index and region_size have any more than ** nim->ndim elements so make local copies, filled out to seven elements */ int si[7], rs[7]; for(i = 0; i < nim->ndim; i++) { si[i] = start_index[i]; rs[i] = region_size[i]; } for(i = nim->ndim; i < 7; i++) { si[i] = 0; rs[i] = 1; } /* loop through subregion and read a row at a time */ for(i = si[6]; i < (si[6] + rs[6]); i++) { for(j = si[5]; j < (si[5] + rs[5]); j++) { for(k = si[4]; k < (si[4] + rs[4]); k++) { for(l = si[3]; l < (si[3] + rs[3]); l++) { for(m = si[2]; m < (si[2] + rs[2]); m++) { for(n = si[1]; n < (si[1] + rs[1]); n++) { int nread,read_amount; offset = initial_offset + (i * strides[6]) + (j * strides[5]) + (k * strides[4]) + (l * strides[3]) + (m * strides[2]) + (n * strides[1]) + (si[0] * strides[0]); znzseek(fp, offset, SEEK_SET); /* seek to current row */ read_amount = rs[0] * nim->nbyper; /* read a row of the subregion*/ nread = (int)nifti_read_buffer(fp, readptr, read_amount, nim); if(nread != read_amount) { if(g_opts.debug > 1) { fprintf(stderr,"read of %d bytes failed\n",read_amount); return -1; } } bytes += nread; readptr += read_amount; } } } } } } } return bytes; } /* read the data from the file pointed to by fp - this a recursive function, so start with the base case - data is now (char *) for easy incrementing return 0 on success, < 0 on failure */ static int rci_read_data(nifti_image * nim, int * pivots, int * prods, int nprods, const int dims[], char * data, znzFile fp, size_t base_offset) { size_t sublen, offset, read_size; int c; /* bad check first - base_offset may not have been checked */ if( nprods <= 0 ){ fprintf(stderr,"** rci_read_data, bad prods, %d\n", nprods); return -1; } /* base case: actually read the data */ if( nprods == 1 ){ size_t nread, bytes; /* make sure things look good here */ if( *pivots != 0 ){ fprintf(stderr,"** rciRD: final pivot == %d!\n", *pivots); return -1; } /* so just seek and read (prods[0] * nbyper) bytes from the file */ znzseek(fp, (long)base_offset, SEEK_SET); bytes = (size_t)prods[0] * nim->nbyper; nread = nifti_read_buffer(fp, data, bytes, nim); if( nread != bytes ){ fprintf(stderr,"** rciRD: read only %u of %u bytes from '%s'\n", (unsigned)nread, (unsigned)bytes, nim->fname); return -1; } else if( g_opts.debug > 3 ) fprintf(stderr,"+d successful read of %u bytes at offset %u\n", (unsigned)bytes, (unsigned)base_offset); return 0; /* done with base case - return success */ } /* not the base case, so do a set of reduced reads */ /* compute size of sub-brick: all dimensions below pivot */ for( c = 1, sublen = 1; c < *pivots; c++ ) sublen *= nim->dim[c]; /* compute number of values to read, i.e. remaining prods */ for( c = 1, read_size = 1; c < nprods; c++ ) read_size *= prods[c]; read_size *= nim->nbyper; /* and multiply by bytes per voxel */ /* now repeatedly compute offsets, and recursively read */ for( c = 0; c < prods[0]; c++ ){ /* offset is (c * sub-block size (including pivot dim)) */ /* + (dims[] index into pivot sub-block) */ /* the unneeded multiplication is to make this more clear */ offset = (size_t)c * sublen * nim->dim[*pivots] + (size_t)sublen * dims[*pivots]; offset *= nim->nbyper; if( g_opts.debug > 3 ) fprintf(stderr,"-d reading %u bytes, foff %u + %u, doff %u\n", (unsigned)read_size, (unsigned)base_offset, (unsigned)offset, (unsigned)(c*read_size)); /* now read the next level down, adding this offset */ if( rci_read_data(nim, pivots+1, prods+1, nprods-1, dims, data + c * read_size, fp, base_offset + offset) < 0 ) return -1; } return 0; } /* allocate memory for all collapsed image data If *data is already set, do not allocate, but still calculate size for debug report. return total size on success, and < 0 on failure */ static int rci_alloc_mem(void ** data, int prods[8], int nprods, int nbyper ) { int size, index; if( nbyper < 0 || nprods < 1 || nprods > 8 ){ fprintf(stderr,"** rci_am: bad params, %d, %d\n", nbyper, nprods); return -1; } for( index = 0, size = 1; index < nprods; index++ ) size *= prods[index]; size *= nbyper; if( ! *data ){ /* then allocate what is needed */ if( g_opts.debug > 1 ) fprintf(stderr,"+d alloc %d (= %d x %d) bytes for collapsed image\n", size, size/nbyper, nbyper); *data = malloc(size); /* actually allocate the memory */ if( ! *data ){ fprintf(stderr,"** rci_am: failed to alloc %d bytes for data\n", size); return -1; } } else if( g_opts.debug > 1 ) fprintf(stderr,"-d rci_am: *data already set, need %d (%d x %d) bytes\n", size, size/nbyper, nbyper); return size; } /* prepare a pivot list for reading The pivot points are the indices into dims where the calling function wants to collapse a dimension. The last pivot should always be zero (note that we have space for that in the lists). */ static int make_pivot_list(nifti_image * nim, const int dims[], int pivots[], int prods[], int * nprods ) { int len, index; len = 0; index = nim->dim[0]; while( index > 0 ){ prods[len] = 1; while( index > 0 && (nim->dim[index] == 1 || dims[index] == -1) ){ prods[len] *= nim->dim[index]; index--; } pivots[len] = index; len++; index--; /* fine, let it drop out at -1 */ } /* make sure to include 0 as a pivot (instead of just 1, if it is) */ if( pivots[len-1] != 0 ){ pivots[len] = 0; prods[len] = 1; len++; } *nprods = len; if( g_opts.debug > 2 ){ fprintf(stderr,"+d pivot list created, pivots :"); for(index = 0; index < len; index++) fprintf(stderr," %d", pivots[index]); fprintf(stderr,", prods :"); for(index = 0; index < len; index++) fprintf(stderr," %d", prods[index]); fputc('\n',stderr); } return 0; } #undef ISEND #define ISEND(c) ( (c)==']' || (c)=='}' || (c)=='\0' ) /*---------------------------------------------------------------------*/ /*! Get an integer list in the range 0..(nvals-1), from the character string str. If we call the output pointer fred, then fred[0] = number of integers in the list (> 0), and fred[i] = i-th integer in the list for i=1..fred[0]. If on return, fred == NULL or fred[0] == 0, then something is wrong, and the caller must deal with that. Syntax of input string: - initial '{' or '[' is skipped, if present - ends when '}' or ']' or end of string is found - contains entries separated by commas - entries have one of these forms: - a single number - a dollar sign '$', which means nvals-1 - a sequence of consecutive numbers in the form "a..b" or "a-b", where "a" and "b" are single numbers (or '$') - a sequence of evenly spaced numbers in the form "a..b(c)" or "a-b(c)", where "c" encodes the step - Example: "[2,7..4,3..9(2)]" decodes to the list 2 7 6 5 4 3 5 7 9 - entries should be in the range 0..nvals-1 (borrowed, with permission, from thd_intlist.c) *//*-------------------------------------------------------------------*/ int * nifti_get_intlist( int nvals , const char * str ) { int *subv = NULL ; int ii , ipos , nout , slen ; int ibot,itop,istep , nused ; char *cpt ; /* Meaningless input? */ if( nvals < 1 ) return NULL ; /* No selection list? */ if( str == NULL || str[0] == '\0' ) return NULL ; /* skip initial '[' or '{' */ subv = (int *)malloc( sizeof(int) * 2 ) ; if( !subv ) { fprintf(stderr,"** nifti_get_intlist: failed alloc of 2 ints\n"); return NULL; } subv[0] = nout = 0 ; ipos = 0 ; if( str[ipos] == '[' || str[ipos] == '{' ) ipos++ ; if( g_opts.debug > 1 ) fprintf(stderr,"-d making int_list (vals = %d) from '%s'\n", nvals, str); /**- for each sub-selector until end of input... */ slen = (int)strlen(str) ; while( ipos < slen && !ISEND(str[ipos]) ){ while( isspace((int) str[ipos]) ) ipos++ ; /* skip blanks */ if( ISEND(str[ipos]) ) break ; /* done */ /**- get starting value */ if( str[ipos] == '$' ){ /* special case */ ibot = nvals-1 ; ipos++ ; } else { /* decode an integer */ ibot = strtol( str+ipos , &cpt , 10 ) ; if( ibot < 0 ){ fprintf(stderr,"** ERROR: list index %d is out of range 0..%d\n", ibot,nvals-1) ; free(subv) ; return NULL ; } if( ibot >= nvals ){ fprintf(stderr,"** ERROR: list index %d is out of range 0..%d\n", ibot,nvals-1) ; free(subv) ; return NULL ; } nused = (cpt-(str+ipos)) ; if( ibot == 0 && nused == 0 ){ fprintf(stderr,"** ERROR: list syntax error '%s'\n",str+ipos) ; free(subv) ; return NULL ; } ipos += nused ; } while( isspace((int) str[ipos]) ) ipos++ ; /* skip blanks */ /**- if that's it for this sub-selector, add one value to list */ if( str[ipos] == ',' || ISEND(str[ipos]) ){ nout++ ; subv = (int *)realloc( (char *)subv , sizeof(int) * (nout+1) ) ; if( !subv ) { fprintf(stderr,"** nifti_get_intlist: failed realloc of %d ints\n", nout+1); return NULL; } subv[0] = nout ; subv[nout] = ibot ; if( ISEND(str[ipos]) ) break ; /* done */ ipos++ ; continue ; /* re-start loop at next sub-selector */ } /**- otherwise, must have '..' or '-' as next inputs */ if( str[ipos] == '-' ){ ipos++ ; } else if( str[ipos] == '.' && str[ipos+1] == '.' ){ ipos++ ; ipos++ ; } else { fprintf(stderr,"** ERROR: index list syntax is bad: '%s'\n", str+ipos) ; free(subv) ; return NULL ; } /**- get ending value for loop now */ if( str[ipos] == '$' ){ /* special case */ itop = nvals-1 ; ipos++ ; } else { /* decode an integer */ itop = strtol( str+ipos , &cpt , 10 ) ; if( itop < 0 ){ fprintf(stderr,"** ERROR: index %d is out of range 0..%d\n", itop,nvals-1) ; free(subv) ; return NULL ; } if( itop >= nvals ){ fprintf(stderr,"** ERROR: index %d is out of range 0..%d\n", itop,nvals-1) ; free(subv) ; return NULL ; } nused = (cpt-(str+ipos)) ; if( itop == 0 && nused == 0 ){ fprintf(stderr,"** ERROR: index list syntax error '%s'\n",str+ipos) ; free(subv) ; return NULL ; } ipos += nused ; } /**- set default loop step */ istep = (ibot <= itop) ? 1 : -1 ; while( isspace((int) str[ipos]) ) ipos++ ; /* skip blanks */ /**- check if we have a non-default loop step */ if( str[ipos] == '(' ){ /* decode an integer */ ipos++ ; istep = strtol( str+ipos , &cpt , 10 ) ; if( istep == 0 ){ fprintf(stderr,"** ERROR: index loop step is 0!\n") ; free(subv) ; return NULL ; } nused = (cpt-(str+ipos)) ; ipos += nused ; if( str[ipos] == ')' ) ipos++ ; if( (ibot-itop)*istep > 0 ){ fprintf(stderr,"** WARNING: index list '%d..%d(%d)' means nothing\n", ibot,itop,istep ) ; } } /**- add values to output */ for( ii=ibot ; (ii-itop)*istep <= 0 ; ii += istep ){ nout++ ; subv = (int *)realloc( (char *)subv , sizeof(int) * (nout+1) ) ; if( !subv ) { fprintf(stderr,"** nifti_get_intlist: failed realloc of %d ints\n", nout+1); return NULL; } subv[0] = nout ; subv[nout] = ii ; } /**- check if we have a comma to skip over */ while( isspace((int) str[ipos]) ) ipos++ ; /* skip blanks */ if( str[ipos] == ',' ) ipos++ ; /* skip commas */ } /* end of loop through selector string */ if( g_opts.debug > 1 ) { fprintf(stderr,"+d int_list (vals = %d): ", subv[0]); for( ii = 1; ii <= subv[0]; ii++ ) fprintf(stderr,"%d ", subv[ii]); fputc('\n',stderr); } if( subv[0] == 0 ){ free(subv); subv = NULL; } return subv ; } /*---------------------------------------------------------------------*/ /*! Given a NIFTI_TYPE string, such as "NIFTI_TYPE_INT16", return the * corresponding integral type code. The type code is the macro * value defined in nifti1.h. *//*-------------------------------------------------------------------*/ int nifti_datatype_from_string( const char * name ) { int tablen = sizeof(nifti_type_list)/sizeof(nifti_type_ele); int c; if( !name ) return DT_UNKNOWN; for( c = tablen-1; c > 0; c-- ) if( !strcmp(name, nifti_type_list[c].name) ) break; return nifti_type_list[c].type; } /*---------------------------------------------------------------------*/ /*! Given a NIFTI_TYPE value, such as NIFTI_TYPE_INT16, return the * corresponding macro label as a string. The dtype code is the * macro value defined in nifti1.h. *//*-------------------------------------------------------------------*/ char * nifti_datatype_to_string( int dtype ) { int tablen = sizeof(nifti_type_list)/sizeof(nifti_type_ele); int c; for( c = tablen-1; c > 0; c-- ) if( nifti_type_list[c].type == dtype ) break; return nifti_type_list[c].name; } /*---------------------------------------------------------------------*/ /*! Determine whether dtype is a valid NIFTI_TYPE. * * DT_UNKNOWN is considered invalid * * The only difference 'for_nifti' makes is that DT_BINARY * should be invalid for a NIfTI dataset. *//*-------------------------------------------------------------------*/ int nifti_datatype_is_valid( int dtype, int for_nifti ) { int tablen = sizeof(nifti_type_list)/sizeof(nifti_type_ele); int c; /* special case */ if( for_nifti && dtype == DT_BINARY ) return 0; for( c = tablen-1; c > 0; c-- ) if( nifti_type_list[c].type == dtype ) return 1; return 0; } /*---------------------------------------------------------------------*/ /*! Only as a test, verify that the new nifti_type_list table matches * the the usage of nifti_datatype_sizes (which could be changed to * use the table, if there were interest). * * return the number of errors (so 0 is success, as usual) *//*-------------------------------------------------------------------*/ int nifti_test_datatype_sizes(int verb) { int tablen = sizeof(nifti_type_list)/sizeof(nifti_type_ele); int nbyper, ssize; int c, errs = 0; for( c = 0; c < tablen; c++ ) { nbyper = ssize = -1; nifti_datatype_sizes(nifti_type_list[c].type, &nbyper, &ssize); if( nbyper < 0 || ssize < 0 || nbyper != nifti_type_list[c].nbyper || ssize != nifti_type_list[c].swapsize ) { if( verb || g_opts.debug > 2 ) fprintf(stderr, "** type mismatch: %s, %d, %d, %d : %d, %d\n", nifti_type_list[c].name, nifti_type_list[c].type, nifti_type_list[c].nbyper, nifti_type_list[c].swapsize, nbyper, ssize); errs++; } } if( errs ) fprintf(stderr,"** nifti_test_datatype_sizes: found %d errors\n",errs); else if( verb || g_opts.debug > 1 ) fprintf(stderr,"-- nifti_test_datatype_sizes: all OK\n"); return errs; } /*---------------------------------------------------------------------*/ /*! Display the nifti_type_list table. * * if which == 1 : display DT_* * if which == 2 : display NIFTI_TYPE* * else : display all *//*-------------------------------------------------------------------*/ int nifti_disp_type_list( int which ) { char * style; int tablen = sizeof(nifti_type_list)/sizeof(nifti_type_ele); int lwhich, c; if ( which == 1 ){ lwhich = 1; style = "DT_"; } else if( which == 2 ){ lwhich = 2; style = "NIFTI_TYPE_"; } else { lwhich = 3; style = "ALL"; } printf("nifti_type_list entries (%s) :\n" " name type nbyper swapsize\n" " --------------------- ---- ------ --------\n", style); for( c = 0; c < tablen; c++ ) if( (lwhich & 1 && nifti_type_list[c].name[0] == 'D') || (lwhich & 2 && nifti_type_list[c].name[0] == 'N') ) printf(" %-22s %5d %3d %5d\n", nifti_type_list[c].name, nifti_type_list[c].type, nifti_type_list[c].nbyper, nifti_type_list[c].swapsize); return 0; } xmedcon-0.14.1/libs/nifti/znzlib.c0000644000175000017510000002001011436274141013666 00000000000000/** \file znzlib.c \brief Low level i/o interface to compressed and noncompressed files. Written by Mark Jenkinson, FMRIB This library provides an interface to both compressed (gzip/zlib) and uncompressed (normal) file IO. The functions are written to have the same interface as the standard file IO functions. To use this library instead of normal file IO, the following changes are required: - replace all instances of FILE* with znzFile - change the name of all function calls, replacing the initial character f with the znz (e.g. fseek becomes znzseek) one exception is rewind() -> znzrewind() - add a third parameter to all calls to znzopen (previously fopen) that specifies whether to use compression (1) or not (0) - use znz_isnull rather than any (pointer == NULL) comparisons in the code for znzfile types (normally done after a return from znzopen) NB: seeks for writable files with compression are quite restricted */ #include "znzlib.h" /* znzlib.c (zipped or non-zipped library) ***** This code is released to the public domain. ***** ***** Author: Mark Jenkinson, FMRIB Centre, University of Oxford ***** ***** Date: September 2004 ***** ***** Neither the FMRIB Centre, the University of Oxford, nor any of ***** ***** its employees imply any warranty of usefulness of this software ***** ***** for any purpose, and do not assume any liability for damages, ***** ***** incidental or otherwise, caused by any use of this document. ***** */ /* Note extra argument (use_compression) where use_compression==0 is no compression use_compression!=0 uses zlib (gzip) compression */ znzFile znzopen(const char *path, const char *mode, int use_compression) { znzFile file; file = (znzFile) calloc(1,sizeof(struct znzptr)); if( file == NULL ){ fprintf(stderr,"** ERROR: znzopen failed to alloc znzptr\n"); return NULL; } file->nzfptr = NULL; #ifdef HAVE_ZLIB file->zfptr = NULL; if (use_compression) { file->withz = 1; if((file->zfptr = gzopen(path,mode)) == NULL) { free(file); file = NULL; } } else { #endif file->withz = 0; if((file->nzfptr = fopen(path,mode)) == NULL) { free(file); file = NULL; } #ifdef HAVE_ZLIB } #endif return file; } znzFile znzdopen(int fd, const char *mode, int use_compression) { znzFile file; file = (znzFile) calloc(1,sizeof(struct znzptr)); if( file == NULL ){ fprintf(stderr,"** ERROR: znzdopen failed to alloc znzptr\n"); return NULL; } #ifdef HAVE_ZLIB if (use_compression) { file->withz = 1; file->zfptr = gzdopen(fd,mode); file->nzfptr = NULL; } else { #endif file->withz = 0; #ifdef HAVE_FDOPEN file->nzfptr = fdopen(fd,mode); #endif #ifdef HAVE_ZLIB file->zfptr = NULL; }; #endif return file; } int Xznzclose(znzFile * file) { int retval = 0; if (*file!=NULL) { #ifdef HAVE_ZLIB if ((*file)->zfptr!=NULL) { retval = gzclose((*file)->zfptr); } #endif if ((*file)->nzfptr!=NULL) { retval = fclose((*file)->nzfptr); } free(*file); *file = NULL; } return retval; } /* we already assume ints are 4 bytes */ #undef ZNZ_MAX_BLOCK_SIZE #define ZNZ_MAX_BLOCK_SIZE (1<<30) size_t znzread(void* buf, size_t size, size_t nmemb, znzFile file) { size_t remain = size*nmemb; char * cbuf = (char *)buf; unsigned n2read; int nread; if (file==NULL) { return 0; } #ifdef HAVE_ZLIB if (file->zfptr!=NULL) { /* gzread/write take unsigned int length, so maybe read in int pieces (noted by M Hanke, example given by M Adler) 6 July 2010 [rickr] */ while( remain > 0 ) { n2read = (remain < ZNZ_MAX_BLOCK_SIZE) ? remain : ZNZ_MAX_BLOCK_SIZE; nread = gzread(file->zfptr, (void *)cbuf, n2read); if( nread < 0 ) return nread; /* returns -1 on error */ remain -= nread; cbuf += nread; /* require reading n2read bytes, so we don't get stuck */ if( nread < (int)n2read ) break; /* return will be short */ } /* warn of a short read that will seem complete */ if( remain > 0 && remain < size ) fprintf(stderr,"** znzread: read short by %u bytes\n",(unsigned)remain); return nmemb - remain/size; /* return number of members processed */ } #endif return fread(buf,size,nmemb,file->nzfptr); } size_t znzwrite(const void* buf, size_t size, size_t nmemb, znzFile file) { size_t remain = size*nmemb; char * cbuf = (char *)buf; unsigned n2write; int nwritten; if (file==NULL) { return 0; } #ifdef HAVE_ZLIB if (file->zfptr!=NULL) { while( remain > 0 ) { n2write = (remain < ZNZ_MAX_BLOCK_SIZE) ? remain : ZNZ_MAX_BLOCK_SIZE; nwritten = gzwrite(file->zfptr, (void *)cbuf, n2write); /* gzread returns 0 on error, but in case that ever changes... */ if( nwritten < 0 ) return nwritten; remain -= nwritten; cbuf += nwritten; /* require writing n2write bytes, so we don't get stuck */ if( nwritten < (int)n2write ) break; } /* warn of a short write that will seem complete */ if( remain > 0 && remain < size ) fprintf(stderr,"** znzwrite: write short by %u bytes\n",(unsigned)remain); return nmemb - remain/size; /* return number of members processed */ } #endif return fwrite(buf,size,nmemb,file->nzfptr); } long znzseek(znzFile file, long offset, int whence) { if (file==NULL) { return 0; } #ifdef HAVE_ZLIB if (file->zfptr!=NULL) return (long) gzseek(file->zfptr,offset,whence); #endif return fseek(file->nzfptr,offset,whence); } int znzrewind(znzFile stream) { if (stream==NULL) { return 0; } #ifdef HAVE_ZLIB /* On some systems, gzrewind() fails for uncompressed files. Use gzseek(), instead. 10, May 2005 [rickr] if (stream->zfptr!=NULL) return gzrewind(stream->zfptr); */ if (stream->zfptr!=NULL) return (int)gzseek(stream->zfptr, 0L, SEEK_SET); #endif rewind(stream->nzfptr); return 0; } long znztell(znzFile file) { if (file==NULL) { return 0; } #ifdef HAVE_ZLIB if (file->zfptr!=NULL) return (long) gztell(file->zfptr); #endif return ftell(file->nzfptr); } int znzputs(const char * str, znzFile file) { if (file==NULL) { return 0; } #ifdef HAVE_ZLIB if (file->zfptr!=NULL) return gzputs(file->zfptr,str); #endif return fputs(str,file->nzfptr); } char * znzgets(char* str, int size, znzFile file) { if (file==NULL) { return NULL; } #ifdef HAVE_ZLIB if (file->zfptr!=NULL) return gzgets(file->zfptr,str,size); #endif return fgets(str,size,file->nzfptr); } int znzflush(znzFile file) { if (file==NULL) { return 0; } #ifdef HAVE_ZLIB if (file->zfptr!=NULL) return gzflush(file->zfptr,Z_SYNC_FLUSH); #endif return fflush(file->nzfptr); } int znzeof(znzFile file) { if (file==NULL) { return 0; } #ifdef HAVE_ZLIB if (file->zfptr!=NULL) return gzeof(file->zfptr); #endif return feof(file->nzfptr); } int znzputc(int c, znzFile file) { if (file==NULL) { return 0; } #ifdef HAVE_ZLIB if (file->zfptr!=NULL) return gzputc(file->zfptr,c); #endif return fputc(c,file->nzfptr); } int znzgetc(znzFile file) { if (file==NULL) { return 0; } #ifdef HAVE_ZLIB if (file->zfptr!=NULL) return gzgetc(file->zfptr); #endif return fgetc(file->nzfptr); } #if !defined (WIN32) int znzprintf(znzFile stream, const char *format, ...) { int retval=0; char *tmpstr; va_list va; if (stream==NULL) { return 0; } va_start(va, format); #ifdef HAVE_ZLIB if (stream->zfptr!=NULL) { int size; /* local to HAVE_ZLIB block */ size = strlen(format) + 1000000; /* overkill I hope */ tmpstr = (char *)calloc(1, size); if( tmpstr == NULL ){ fprintf(stderr,"** ERROR: znzprintf failed to alloc %d bytes\n", size); return retval; } vsprintf(tmpstr,format,va); retval=gzprintf(stream->zfptr,"%s",tmpstr); free(tmpstr); } else #endif { retval=vfprintf(stream->nzfptr,format,va); } va_end(va); return retval; } #endif xmedcon-0.14.1/libs/nifti/nifti1_io.h0000644000175000017510000006202011436274141014253 00000000000000/** \file nifti1_io.h \brief Data structures for using nifti1_io API. - Written by Bob Cox, SSCC NIMH - Revisions by Rick Reynolds, SSCC NIMH */ #ifndef _NIFTI_IO_HEADER_ #define _NIFTI_IO_HEADER_ #include #include #include #include #include #ifndef DONT_INCLUDE_ANALYZE_STRUCT #define DONT_INCLUDE_ANALYZE_STRUCT /*** not needed herein ***/ #endif #include "nifti1.h" /*** NIFTI-1 header specification ***/ #include /*=================*/ #ifdef __cplusplus extern "C" { #endif /*=================*/ /*****===================================================================*****/ /***** File nifti1_io.h == Declarations for nifti1_io.c *****/ /*****...................................................................*****/ /***** This code is released to the public domain. *****/ /*****...................................................................*****/ /***** Author: Robert W Cox, SSCC/DIRP/NIMH/NIH/DHHS/USA/EARTH *****/ /***** Date: August 2003 *****/ /*****...................................................................*****/ /***** Neither the National Institutes of Health (NIH), nor any of its *****/ /***** employees imply any warranty of usefulness of this software for *****/ /***** any purpose, and do not assume any liability for damages, *****/ /***** incidental or otherwise, caused by any use of this document. *****/ /*****===================================================================*****/ /* Modified by: Mark Jenkinson (FMRIB Centre, University of Oxford, UK) Date: July/August 2004 Mainly adding low-level IO and changing things to allow gzipped files to be read and written Full backwards compatability should have been maintained Modified by: Rick Reynolds (SSCC/DIRP/NIMH, National Institutes of Health) Date: December 2004 Modified and added many routines for I/O. */ /********************** Some sample data structures **************************/ typedef struct { /** 4x4 matrix struct **/ float m[4][4] ; } mat44 ; typedef struct { /** 3x3 matrix struct **/ float m[3][3] ; } mat33 ; /*...........................................................................*/ /*! \enum analyze_75_orient_code * \brief Old-style analyze75 orientation * codes. */ typedef enum _analyze75_orient_code { a75_transverse_unflipped = 0, a75_coronal_unflipped = 1, a75_sagittal_unflipped = 2, a75_transverse_flipped = 3, a75_coronal_flipped = 4, a75_sagittal_flipped = 5, a75_orient_unknown = 6 } analyze_75_orient_code; /*! \struct nifti_image \brief High level data structure for open nifti datasets in the nifti1_io API. Note that this structure is not part of the nifti1 format definition; it is used to implement one API for reading/writing formats in the nifti1 format. */ typedef struct { /*!< Image storage struct **/ int ndim ; /*!< last dimension greater than 1 (1..7) */ int nx ; /*!< dimensions of grid array */ int ny ; /*!< dimensions of grid array */ int nz ; /*!< dimensions of grid array */ int nt ; /*!< dimensions of grid array */ int nu ; /*!< dimensions of grid array */ int nv ; /*!< dimensions of grid array */ int nw ; /*!< dimensions of grid array */ int dim[8] ; /*!< dim[0]=ndim, dim[1]=nx, etc. */ size_t nvox ; /*!< number of voxels = nx*ny*nz*...*nw */ int nbyper ; /*!< bytes per voxel, matches datatype */ int datatype ; /*!< type of data in voxels: DT_* code */ float dx ; /*!< grid spacings */ float dy ; /*!< grid spacings */ float dz ; /*!< grid spacings */ float dt ; /*!< grid spacings */ float du ; /*!< grid spacings */ float dv ; /*!< grid spacings */ float dw ; /*!< grid spacings */ float pixdim[8] ; /*!< pixdim[1]=dx, etc. */ float scl_slope ; /*!< scaling parameter - slope */ float scl_inter ; /*!< scaling parameter - intercept */ float cal_min ; /*!< calibration parameter, minimum */ float cal_max ; /*!< calibration parameter, maximum */ int qform_code ; /*!< codes for (x,y,z) space meaning */ int sform_code ; /*!< codes for (x,y,z) space meaning */ int freq_dim ; /*!< indexes (1,2,3, or 0) for MRI */ int phase_dim ; /*!< directions in dim[]/pixdim[] */ int slice_dim ; /*!< directions in dim[]/pixdim[] */ int slice_code ; /*!< code for slice timing pattern */ int slice_start ; /*!< index for start of slices */ int slice_end ; /*!< index for end of slices */ float slice_duration ; /*!< time between individual slices */ /*! quaternion transform parameters [when writing a dataset, these are used for qform, NOT qto_xyz] */ float quatern_b , quatern_c , quatern_d , qoffset_x , qoffset_y , qoffset_z , qfac ; mat44 qto_xyz ; /*!< qform: transform (i,j,k) to (x,y,z) */ mat44 qto_ijk ; /*!< qform: transform (x,y,z) to (i,j,k) */ mat44 sto_xyz ; /*!< sform: transform (i,j,k) to (x,y,z) */ mat44 sto_ijk ; /*!< sform: transform (x,y,z) to (i,j,k) */ float toffset ; /*!< time coordinate offset */ int xyz_units ; /*!< dx,dy,dz units: NIFTI_UNITS_* code */ int time_units ; /*!< dt units: NIFTI_UNITS_* code */ int nifti_type ; /*!< 0==ANALYZE, 1==NIFTI-1 (1 file), 2==NIFTI-1 (2 files), 3==NIFTI-ASCII (1 file) */ int intent_code ; /*!< statistic type (or something) */ float intent_p1 ; /*!< intent parameters */ float intent_p2 ; /*!< intent parameters */ float intent_p3 ; /*!< intent parameters */ char intent_name[16] ; /*!< optional description of intent data */ char descrip[80] ; /*!< optional text to describe dataset */ char aux_file[24] ; /*!< auxiliary filename */ char *fname ; /*!< header filename (.hdr or .nii) */ char *iname ; /*!< image filename (.img or .nii) */ int iname_offset ; /*!< offset into iname where data starts */ int swapsize ; /*!< swap unit in image data (might be 0) */ int byteorder ; /*!< byte order on disk (MSB_ or LSB_FIRST) */ void *data ; /*!< pointer to data: nbyper*nvox bytes */ int num_ext ; /*!< number of extensions in ext_list */ nifti1_extension * ext_list ; /*!< array of extension structs (with data) */ analyze_75_orient_code analyze75_orient; /*!< for old analyze files, orient */ } nifti_image ; /* struct for return from nifti_image_read_bricks() */ typedef struct { int nbricks; /* the number of allocated pointers in 'bricks' */ size_t bsize; /* the length of each data block, in bytes */ void ** bricks; /* array of pointers to data blocks */ } nifti_brick_list; /*****************************************************************************/ /*------------------ NIfTI version of ANALYZE 7.5 structure -----------------*/ /* (based on fsliolib/dbh.h, but updated for version 7.5) */ typedef struct { /* header info fields - describes the header overlap with NIfTI */ /* ------------------ */ int sizeof_hdr; /* 0 + 4 same */ char data_type[10]; /* 4 + 10 same */ char db_name[18]; /* 14 + 18 same */ int extents; /* 32 + 4 same */ short int session_error; /* 36 + 2 same */ char regular; /* 38 + 1 same */ char hkey_un0; /* 39 + 1 40 bytes */ /* image dimension fields - describes image sizes */ short int dim[8]; /* 0 + 16 same */ short int unused8; /* 16 + 2 intent_p1... */ short int unused9; /* 18 + 2 ... */ short int unused10; /* 20 + 2 intent_p2... */ short int unused11; /* 22 + 2 ... */ short int unused12; /* 24 + 2 intent_p3... */ short int unused13; /* 26 + 2 ... */ short int unused14; /* 28 + 2 intent_code */ short int datatype; /* 30 + 2 same */ short int bitpix; /* 32 + 2 same */ short int dim_un0; /* 34 + 2 slice_start */ float pixdim[8]; /* 36 + 32 same */ float vox_offset; /* 68 + 4 same */ float funused1; /* 72 + 4 scl_slope */ float funused2; /* 76 + 4 scl_inter */ float funused3; /* 80 + 4 slice_end, */ /* slice_code, */ /* xyzt_units */ float cal_max; /* 84 + 4 same */ float cal_min; /* 88 + 4 same */ float compressed; /* 92 + 4 slice_duration */ float verified; /* 96 + 4 toffset */ int glmax,glmin; /* 100 + 8 108 bytes */ /* data history fields - optional */ char descrip[80]; /* 0 + 80 same */ char aux_file[24]; /* 80 + 24 same */ char orient; /* 104 + 1 NO GOOD OVERLAP */ char originator[10]; /* 105 + 10 FROM HERE DOWN... */ char generated[10]; /* 115 + 10 */ char scannum[10]; /* 125 + 10 */ char patient_id[10]; /* 135 + 10 */ char exp_date[10]; /* 145 + 10 */ char exp_time[10]; /* 155 + 10 */ char hist_un0[3]; /* 165 + 3 */ int views; /* 168 + 4 */ int vols_added; /* 172 + 4 */ int start_field; /* 176 + 4 */ int field_skip; /* 180 + 4 */ int omax, omin; /* 184 + 8 */ int smax, smin; /* 192 + 8 200 bytes */ } nifti_analyze75; /* total: 348 bytes */ /*****************************************************************************/ /*--------------- Prototypes of functions defined in this file --------------*/ char *nifti_datatype_string ( int dt ) ; char *nifti_units_string ( int uu ) ; char *nifti_intent_string ( int ii ) ; char *nifti_xform_string ( int xx ) ; char *nifti_slice_string ( int ss ) ; char *nifti_orientation_string( int ii ) ; int nifti_is_inttype( int dt ) ; mat44 nifti_mat44_inverse( mat44 R ) ; mat33 nifti_mat33_inverse( mat33 R ) ; mat33 nifti_mat33_polar ( mat33 A ) ; float nifti_mat33_rownorm( mat33 A ) ; float nifti_mat33_colnorm( mat33 A ) ; float nifti_mat33_determ ( mat33 R ) ; mat33 nifti_mat33_mul ( mat33 A , mat33 B ) ; void nifti_swap_2bytes ( size_t n , void *ar ) ; void nifti_swap_4bytes ( size_t n , void *ar ) ; void nifti_swap_8bytes ( size_t n , void *ar ) ; void nifti_swap_16bytes( size_t n , void *ar ) ; void nifti_swap_Nbytes ( size_t n , int siz , void *ar ) ; int nifti_datatype_is_valid (int dtype, int for_nifti); int nifti_datatype_from_string(const char * name); char * nifti_datatype_to_string (int dtype); int nifti_get_filesize( const char *pathname ) ; void swap_nifti_header ( struct nifti_1_header *h , int is_nifti ) ; void old_swap_nifti_header( struct nifti_1_header *h , int is_nifti ); int nifti_swap_as_analyze( nifti_analyze75 *h ); /* main read/write routines */ nifti_image *nifti_image_read_bricks(const char *hname , int nbricks, const int *blist, nifti_brick_list * NBL); int nifti_image_load_bricks(nifti_image *nim , int nbricks, const int *blist, nifti_brick_list * NBL); void nifti_free_NBL( nifti_brick_list * NBL ); nifti_image *nifti_image_read ( const char *hname , int read_data ) ; int nifti_image_load ( nifti_image *nim ) ; void nifti_image_unload ( nifti_image *nim ) ; void nifti_image_free ( nifti_image *nim ) ; int nifti_read_collapsed_image( nifti_image * nim, const int dims [8], void ** data ); int nifti_read_subregion_image( nifti_image * nim, int *start_index, int *region_size, void ** data ); void nifti_image_write ( nifti_image * nim ) ; void nifti_image_write_bricks(nifti_image * nim, const nifti_brick_list * NBL); void nifti_image_infodump( const nifti_image * nim ) ; void nifti_disp_lib_hist( void ) ; /* to display library history */ void nifti_disp_lib_version( void ) ; /* to display library version */ int nifti_disp_matrix_orient( const char * mesg, mat44 mat ); int nifti_disp_type_list( int which ); char * nifti_image_to_ascii ( const nifti_image * nim ) ; nifti_image *nifti_image_from_ascii( const char * str, int * bytes_read ) ; size_t nifti_get_volsize(const nifti_image *nim) ; /* basic file operations */ int nifti_set_filenames(nifti_image * nim, const char * prefix, int check, int set_byte_order); char * nifti_makehdrname (const char * prefix, int nifti_type, int check, int comp); char * nifti_makeimgname (const char * prefix, int nifti_type, int check, int comp); int is_nifti_file (const char *hname); char * nifti_find_file_extension(const char * name); int nifti_is_complete_filename(const char* fname); int nifti_validfilename(const char* fname); int disp_nifti_1_header(const char * info, const nifti_1_header * hp ) ; void nifti_set_debug_level( int level ) ; void nifti_set_skip_blank_ext( int skip ) ; void nifti_set_allow_upper_fext( int allow ) ; int valid_nifti_brick_list(nifti_image * nim , int nbricks, const int * blist, int disp_error); /* znzFile operations */ znzFile nifti_image_open(const char * hname, char * opts, nifti_image ** nim); znzFile nifti_image_write_hdr_img(nifti_image *nim, int write_data, const char* opts); znzFile nifti_image_write_hdr_img2( nifti_image *nim , int write_opts , const char* opts, znzFile imgfile, const nifti_brick_list * NBL); size_t nifti_read_buffer(znzFile fp, void* datatptr, size_t ntot, nifti_image *nim); int nifti_write_all_data(znzFile fp, nifti_image * nim, const nifti_brick_list * NBL); size_t nifti_write_buffer(znzFile fp, const void * buffer, size_t numbytes); nifti_image *nifti_read_ascii_image(znzFile fp, char *fname, int flen, int read_data); znzFile nifti_write_ascii_image(nifti_image *nim, const nifti_brick_list * NBL, const char * opts, int write_data, int leave_open); void nifti_datatype_sizes( int datatype , int *nbyper, int *swapsize ) ; void nifti_mat44_to_quatern( mat44 R , float *qb, float *qc, float *qd, float *qx, float *qy, float *qz, float *dx, float *dy, float *dz, float *qfac ) ; mat44 nifti_quatern_to_mat44( float qb, float qc, float qd, float qx, float qy, float qz, float dx, float dy, float dz, float qfac ); mat44 nifti_make_orthog_mat44( float r11, float r12, float r13 , float r21, float r22, float r23 , float r31, float r32, float r33 ) ; int nifti_short_order(void) ; /* CPU byte order */ /* Orientation codes that might be returned from nifti_mat44_to_orientation().*/ #define NIFTI_L2R 1 /* Left to Right */ #define NIFTI_R2L 2 /* Right to Left */ #define NIFTI_P2A 3 /* Posterior to Anterior */ #define NIFTI_A2P 4 /* Anterior to Posterior */ #define NIFTI_I2S 5 /* Inferior to Superior */ #define NIFTI_S2I 6 /* Superior to Inferior */ void nifti_mat44_to_orientation( mat44 R , int *icod, int *jcod, int *kcod ) ; /*--------------------- Low level IO routines ------------------------------*/ char * nifti_findhdrname (const char* fname); char * nifti_findimgname (const char* fname , int nifti_type); int nifti_is_gzfile (const char* fname); char * nifti_makebasename(const char* fname); /* other routines */ struct nifti_1_header nifti_convert_nim2nhdr(const nifti_image* nim); nifti_1_header * nifti_make_new_header(const int arg_dims[], int arg_dtype); nifti_1_header * nifti_read_header(const char *hname, int *swapped, int check); nifti_image * nifti_copy_nim_info(const nifti_image * src); nifti_image * nifti_make_new_nim(const int dims[], int datatype, int data_fill); nifti_image * nifti_simple_init_nim(void); nifti_image * nifti_convert_nhdr2nim(struct nifti_1_header nhdr, const char * fname); int nifti_hdr_looks_good (const nifti_1_header * hdr); int nifti_is_valid_datatype (int dtype); int nifti_is_valid_ecode (int ecode); int nifti_nim_is_valid (nifti_image * nim, int complain); int nifti_nim_has_valid_dims (nifti_image * nim, int complain); int is_valid_nifti_type (int nifti_type); int nifti_test_datatype_sizes (int verb); int nifti_type_and_names_match (nifti_image * nim, int show_warn); int nifti_update_dims_from_array(nifti_image * nim); void nifti_set_iname_offset (nifti_image *nim); int nifti_set_type_from_names (nifti_image * nim); int nifti_add_extension(nifti_image * nim, const char * data, int len, int ecode ); int nifti_compiled_with_zlib (void); int nifti_copy_extensions (nifti_image *nim_dest,const nifti_image *nim_src); int nifti_free_extensions (nifti_image *nim); int * nifti_get_intlist (int nvals , const char *str); char * nifti_strdup (const char *str); int valid_nifti_extensions(const nifti_image *nim); /*-------------------- Some C convenience macros ----------------------------*/ /* NIfTI-1.1 extension codes: see http://nifti.nimh.nih.gov/nifti-1/documentation/faq#Q21 */ #define NIFTI_ECODE_IGNORE 0 /* changed from UNKNOWN, 29 June 2005 */ #define NIFTI_ECODE_DICOM 2 /* intended for raw DICOM attributes */ #define NIFTI_ECODE_AFNI 4 /* Robert W Cox: rwcox@nih.gov http://afni.nimh.nih.gov/afni */ #define NIFTI_ECODE_COMMENT 6 /* plain ASCII text only */ #define NIFTI_ECODE_XCEDE 8 /* David B Keator: dbkeator@uci.edu http://www.nbirn.net/Resources /Users/Applications/ /xcede/index.htm */ #define NIFTI_ECODE_JIMDIMINFO 10 /* Mark A Horsfield: mah5@leicester.ac.uk http://someplace/something */ #define NIFTI_ECODE_WORKFLOW_FWDS 12 /* Kate Fissell: fissell@pitt.edu http://kraepelin.wpic.pitt.edu /~fissell/NIFTI_ECODE_WORKFLOW_FWDS /NIFTI_ECODE_WORKFLOW_FWDS.html */ #define NIFTI_ECODE_FREESURFER 14 /* http://surfer.nmr.mgh.harvard.edu */ #define NIFTI_ECODE_PYPICKLE 16 /* embedded Python objects http://niftilib.sourceforge.net /pynifti */ /* LONI MiND codes: http://www.loni.ucla.edu/twiki/bin/view/Main/MiND */ #define NIFTI_ECODE_MIND_IDENT 18 /* Vishal Patel: vishal.patel@ucla.edu*/ #define NIFTI_ECODE_B_VALUE 20 #define NIFTI_ECODE_SPHERICAL_DIRECTION 22 #define NIFTI_ECODE_DT_COMPONENT 24 #define NIFTI_ECODE_SHC_DEGREEORDER 26 /* end LONI MiND codes */ #define NIFTI_ECODE_VOXBO 28 /* Dan Kimberg: www.voxbo.org */ #define NIFTI_ECODE_CARET 30 /* John Harwell: john@brainvis.wustl.edu http://brainvis.wustl.edu/wiki /index.php/Caret:Documentation :CaretNiftiExtension */ #define NIFTI_MAX_ECODE 30 /******* maximum extension code *******/ /* nifti_type file codes */ #define NIFTI_FTYPE_ANALYZE 0 #define NIFTI_FTYPE_NIFTI1_1 1 #define NIFTI_FTYPE_NIFTI1_2 2 #define NIFTI_FTYPE_ASCII 3 #define NIFTI_MAX_FTYPE 3 /* this should match the maximum code */ /*------------------------------------------------------------------------*/ /*-- the rest of these apply only to nifti1_io.c, check for _NIFTI1_IO_C_ */ /* Feb 9, 2005 [rickr] */ #ifdef _NIFTI1_IO_C_ typedef struct { int debug; /*!< debug level for status reports */ int skip_blank_ext; /*!< skip extender if no extensions */ int allow_upper_fext; /*!< allow uppercase file extensions */ } nifti_global_options; typedef struct { int type; /* should match the NIFTI_TYPE_ #define */ int nbyper; /* bytes per value, matches nifti_image */ int swapsize; /* bytes per swap piece, matches nifti_image */ char * name; /* text string to match #define */ } nifti_type_ele; #undef LNI_FERR /* local nifti file error, to be compact and repetative */ #define LNI_FERR(func,msg,file) \ fprintf(stderr,"** ERROR (%s): %s '%s'\n",func,msg,file) #undef swap_2 #undef swap_4 #define swap_2(s) nifti_swap_2bytes(1,&(s)) /* s: 2-byte short; swap in place */ #define swap_4(v) nifti_swap_4bytes(1,&(v)) /* v: 4-byte value; swap in place */ /***** isfinite() is a C99 macro, which is present in many C implementations already *****/ #undef IS_GOOD_FLOAT #undef FIXED_FLOAT #ifdef isfinite /* use isfinite() to check floats/doubles for goodness */ # define IS_GOOD_FLOAT(x) isfinite(x) /* check if x is a "good" float */ # define FIXED_FLOAT(x) (isfinite(x) ? (x) : 0) /* fixed if bad */ #else # define IS_GOOD_FLOAT(x) 1 /* don't check it */ # define FIXED_FLOAT(x) (x) /* don't fix it */ #endif #undef ASSIF /* assign v to *p, if possible */ #define ASSIF(p,v) if( (p)!=NULL ) *(p) = (v) #undef MSB_FIRST #undef LSB_FIRST #undef REVERSE_ORDER #define LSB_FIRST 1 #define MSB_FIRST 2 #define REVERSE_ORDER(x) (3-(x)) /* convert MSB_FIRST <--> LSB_FIRST */ #define LNI_MAX_NIA_EXT_LEN 100000 /* consider a longer extension invalid */ #endif /* _NIFTI1_IO_C_ section */ /*------------------------------------------------------------------------*/ /*=================*/ #ifdef __cplusplus } #endif /*=================*/ #endif /* _NIFTI_IO_HEADER_ */ xmedcon-0.14.1/libs/nifti/Makefile.in0000644000175000017510000004764612637622763014322 00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = libs/nifti DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp \ $(noinst_HEADERS) ChangeLog README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/source/m-depend.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libniftiio_la_LIBADD = am_libniftiio_la_OBJECTS = nifti1_io.lo libniftiio_la_OBJECTS = $(am_libniftiio_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libniftiio_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libniftiio_la_LDFLAGS) $(LDFLAGS) -o $@ libznz_la_LIBADD = am_libznz_la_OBJECTS = znzlib.lo libznz_la_OBJECTS = $(am_libznz_la_OBJECTS) libznz_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libznz_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/source depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libniftiio_la_SOURCES) $(libznz_la_SOURCES) DIST_SOURCES = $(libniftiio_la_SOURCES) $(libznz_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DECOMPRESS = @DECOMPRESS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_ACR = @ENABLE_ACR@ ENABLE_ANLZ = @ENABLE_ANLZ@ ENABLE_CONC = @ENABLE_CONC@ ENABLE_DICM = @ENABLE_DICM@ ENABLE_ECAT = @ENABLE_ECAT@ ENABLE_GIF = @ENABLE_GIF@ ENABLE_INTF = @ENABLE_INTF@ ENABLE_INW = @ENABLE_INW@ ENABLE_NIFTI = @ENABLE_NIFTI@ ENABLE_PNG = @ENABLE_PNG@ ENABLE_TPC = @ENABLE_TPC@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIBMDCETC = @GLIBMDCETC@ GLIBSUPPORTED = @GLIBSUPPORTED@ GREP = @GREP@ GTKONE = @GTKONE@ GTKSUPPORTED = @GTKSUPPORTED@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NIFTI_CFLAGS = @NIFTI_CFLAGS@ NIFTI_LDFLAGS = @NIFTI_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PNG_CFLAGS = @PNG_CFLAGS@ PNG_LDFLAGS = @PNG_LDFLAGS@ PNG_LIBS = @PNG_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TPC_CFLAGS = @TPC_CFLAGS@ TPC_LDFLAGS = @TPC_LDFLAGS@ VERSION = @VERSION@ XMDCETC = @XMDCETC@ XMEDCON_DATE = @XMEDCON_DATE@ XMEDCON_GLIB_CFLAGS = @XMEDCON_GLIB_CFLAGS@ XMEDCON_GLIB_LIBS = @XMEDCON_GLIB_LIBS@ XMEDCON_GTK_CFLAGS = @XMEDCON_GTK_CFLAGS@ XMEDCON_GTK_LIBS = @XMEDCON_GTK_LIBS@ XMEDCON_LIBVERS = @XMEDCON_LIBVERS@ XMEDCON_MAJOR = @XMEDCON_MAJOR@ XMEDCON_MICRO = @XMEDCON_MICRO@ XMEDCON_MINOR = @XMEDCON_MINOR@ XMEDCON_PRGR = @XMEDCON_PRGR@ XMEDCON_VERSION = @XMEDCON_VERSION@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LDFLAGS = @ZLIB_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_sizeof_int = @ac_cv_sizeof_int@ ac_cv_sizeof_long = @ac_cv_sizeof_long@ ac_cv_sizeof_long_long = @ac_cv_sizeof_long_long@ ac_cv_sizeof_short = @ac_cv_sizeof_short@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mdc_cv_bigendian = @mdc_cv_bigendian@ mdc_cv_enable_lnglng = @mdc_cv_enable_lnglng@ mdc_cv_glibsupport = @mdc_cv_glibsupport@ mdc_cv_gui = @mdc_cv_gui@ mdc_cv_include_acr = @mdc_cv_include_acr@ mdc_cv_include_anlz = @mdc_cv_include_anlz@ mdc_cv_include_conc = @mdc_cv_include_conc@ mdc_cv_include_dicm = @mdc_cv_include_dicm@ mdc_cv_include_ecat = @mdc_cv_include_ecat@ mdc_cv_include_gif = @mdc_cv_include_gif@ mdc_cv_include_intf = @mdc_cv_include_intf@ mdc_cv_include_inw = @mdc_cv_include_inw@ mdc_cv_include_nifti = @mdc_cv_include_nifti@ mdc_cv_include_png = @mdc_cv_include_png@ mdc_cv_include_tpc = @mdc_cv_include_tpc@ mdc_cv_ljpg = @mdc_cv_ljpg@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = gnu AM_CFLAGS = @ZLIB_CFLAGS@ noinst_LTLIBRARIES = libznz.la libniftiio.la libznz_la_SOURCES = znzlib.c libznz_la_LDFLAGS = @ZLIB_LDFLAGS@ libniftiio_la_SOURCES = nifti1_io.c libniftiio_la_LDFLAGS = @ZLIB_LDFLAGS@ noinst_HEADERS = znzlib.h nifti1.h nifti1_io.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libs/nifti/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu libs/nifti/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libniftiio.la: $(libniftiio_la_OBJECTS) $(libniftiio_la_DEPENDENCIES) $(EXTRA_libniftiio_la_DEPENDENCIES) $(AM_V_CCLD)$(libniftiio_la_LINK) $(libniftiio_la_OBJECTS) $(libniftiio_la_LIBADD) $(LIBS) libznz.la: $(libznz_la_OBJECTS) $(libznz_la_DEPENDENCIES) $(EXTRA_libznz_la_DEPENDENCIES) $(AM_V_CCLD)$(libznz_la_LINK) $(libznz_la_OBJECTS) $(libznz_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nifti1_io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/znzlib.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xmedcon-0.14.1/libs/dicom/0000755000175000017510000000000012637632716012275 500000000000000xmedcon-0.14.1/libs/dicom/Makefile.am0000644000175000017510000000421712357073470014250 00000000000000## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## filename: Makefile.am ## ## ## ## UTIL Make : Medical Image Conversion Utility ## ## ## ## purpose : dicom subdir Makefile template (automake) ## ## ## ## project : (X)MedCon by Erik Nolf ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## $Id: Makefile.am,v 1.8 2014/07/08 22:56:56 enlf Exp $ AUTOMAKE_OPTIONS = gnu ## ## dictionary ## DICTDATA = dictionary.data DICTSQ = dictionary.SQ DICTSRC = dicom.dic DICTSTD = dict-dicom.dic DICTXTR = dict-gemsi.dic dict-vision.dic dict-discovery.dic PARSE = parse ## ## lossless jpeg ## if DO_LJPG LJPG_DIR = ../ljpg LJPG_INC = -I$(LJPG_DIR) LJPG_DEF = -DMDC_SUPPORT_LJPG endif ## ## ## targets to build dictionaries manually ## dodicts: $(CC) -o $(PARSE) $(PARSE).c ./$(PARSE) < $(DICTSRC) > $(DICTDATA) fgrep SQ $(DICTSRC) | ./$(PARSE) > $(DICTSQ) rm -f $(PARSE) rmdicts: rm -f $(DICTDATA) $(DICTSQ) $(PARSE) ## ## targets to build dictionaries automatically ## $(DICTSRC): $(DICTSTD) $(DICTXTR) cat $(DICTSTD) $(DICTXTR) | grep -v "^#" > $(DICTSRC) $(DICTDATA): $(PARSE) $(DICTSRC) ./$(PARSE) < $(DICTSRC) > $(DICTDATA) $(DICTSQ): $(PARSE) $(DICTSRC) fgrep SQ $(DICTSRC) | ./$(PARSE) > $(DICTSQ) ## ## code to build library ## if DO_DICM noinst_PROGRAMS = $(PARSE) noinst_LTLIBRARIES = libdicom.la endif basic.c: $(DICTSQ) dictionary.c: $(DICTDATA) libdicom_la_SOURCES = \ log.c \ basic.c \ dictionary.c \ single.c \ bit.c \ transform.c \ image.c \ zoom.c \ process.c \ decomp.c noinst_HEADERS = dicom.h AM_CPPFLAGS = $(LJPG_INC) AM_CFLAGS = $(LJPG_DEF) CLEANFILES = $(DICTSRC) $(DICTDATA) $(DICTSQ) $(PARSE) EXTRA_DIST = $(DICTSTD) $(DICTXTR) $(PARSE).c xmedcon-0.14.1/libs/dicom/single.c0000644000175000017510000002015010535650104013622 00000000000000/************************* * libdicom by Tony Voet * *************************/ /* * $Id: single.c,v 1.11 2006/12/06 23:20:36 enlf Exp $ */ #include #include #include "dicom.h" #define MDC_ENCAP_OFFSET_TABLE 0 /* 0/1 using offset table */ static S32 dicom_pixel(const ELEMENT *); static SINGLE single; /********** * single * **********/ SINGLE *dicom_single(void) { ELEMENT *e; S32 length; U32 i, f; char *interpretation[]= { "MONOCHROME2", "MONOCHROME1", "PALETTE COLOR", "RGB", "HSV", "ARGB", "CMYK", "UNKNOWN" }; dicom_log(DEBUG,"dicom_single()"); memset(&single,0,sizeof(SINGLE)); single.frames=1; single.samples=1; for (;;) { e=dicom_element(); if (!e) break; if (mdc_dicom_skip_sequence(e)) { if (dicom_skip()) break; continue; } if (e->group==0x0028) { if (e->element==0x0002) { if (dicom_load(US)) break; single.samples=*e->value.US; eNlfSafeFree(e->value.US); continue; } if (e->element==0x0004) { if (dicom_load(CS)) break; dicom_clean(); for (single.photometric=0; single.photometricvalue.CS,interpretation[single.photometric], strlen(interpretation[single.photometric])) ) break; if (single.photometric==UNKNOWN) dicom_log(WARNING,"Unknown PhotometricInterpretation"); eNlfSafeFree(e->value.CS); continue; } if (e->element==0x0006) { if (dicom_load(US)) break; single.planar=*e->value.US; eNlfSafeFree(e->value.US); continue; } if (e->element==0x0008) { if (dicom_load(IS)) break; dicom_clean(); single.frames=atoi(*e->value.IS); eNlfSafeFree(e->value.IS); continue; } if (e->element==0x0010) { if (dicom_load(US)) break; single.h=*e->value.US; eNlfSafeFree(e->value.US); continue; } if (e->element==0x0011) { if (dicom_load(US)) break; single.w=*e->value.US; eNlfSafeFree(e->value.US); continue; } if (e->element==0x0100) { if (dicom_load(US)) break; single.alloc=*e->value.US; eNlfSafeFree(e->value.US); continue; } if (e->element==0x0101) { if (dicom_load(US)) break; single.bit=*e->value.US; eNlfSafeFree(e->value.US); continue; } if (e->element==0x0102) { if (dicom_load(US)) break; single.high=*e->value.US; eNlfSafeFree(e->value.US); if ((dicom_workaround & MDC_FIX_EZDICOM) && (single.high == 0)) { dicom_log(WARNING,"Wrong ezDICOM high bit value (fixed)"); single.high = (single.bit > 0) ? single.bit - 1 : 15; } continue; } if (e->element==0x0103) { if (dicom_load(US)) break; single.sign=*e->value.US; eNlfSafeFree(e->value.US); continue; } if (0x1101<=e->element && e->element<=0x1103) { if (dicom_load(US)) break; if (e->vm!=3) dicom_log(WARNING,"Wrong VM for PaletteColorLookupTableDescriptor"); else { i=e->element-0x1101; single.clut[i].size=e->value.US[0]; single.clut[i].threshold.u16=e->value.US[1]; single.clut[i].bit=e->value.US[2]; } eNlfSafeFree(e->value.US); continue; } if (0x1201<=e->element && e->element<=0x1203) { if (dicom_load(US)) break; single.clut[e->element-0x1201].data.u16=e->value.US; continue; } } if (!(e->group&1)) { if ((0x7F00<=e->group && e->group<0x7FFF) && (e->element==0x0010)) { unsigned frames, width, height, pixel; frames= (unsigned) single.frames; width = (unsigned) single.w; height= (unsigned) single.h; pixel = (unsigned) single.samples*single.alloc>>3; if (e->length!=0xFFFFFFFF) { /* pixel data, not encapsulated */ /* first fix bad VR values, confusing data endian swap */ switch (e->vr) { case OB: if (single.alloc==16) { dicom_log(WARNING,"Incorrect OB value representation (fixed)"); e->vr=OW; /* workaround for Amira 3.0 pixel data length bug */ /* http://www.amiravis.com/resources/Patch30-13-dicom */ if (e->length == 2 * frames * width * height * pixel) { dicom_log(WARNING,"Amira 3.0 pixel data length bug (fixed)"); e->length /= 2; } } break; case OW: if (single.alloc==8) { dicom_log(WARNING,"Incorrect OW value representation (fixed)"); e->vr=OB; } break; default: break; } length=dicom_pixel(e); if (length<0) break; if (length!= frames * width * height * pixel) dicom_log(WARNING,"Incorrect PixelData length"); return &single; } else if (e->length == 0xFFFFFFFF) { /* encapsulated data */ U8 *data; #if MDC_ENCAP_OFFSET_TABLE U32 *offset=NULL, begin=0; #endif /* skip offset table */ e=dicom_element(); if (!e) break; if (e->vm && e->length != 0) { /* a value present */ if (e->length != frames * 4L) break; /* get out, bad offset table */ #if MDC_ENCAP_OFFSET_TABLE dicom_load(UL); offset = e->value.UL; begin = mdc_dicom_ftell(); #else dicom_skip(); #endif } /* allocate memory for all frames, memset for sure */ /* eNlf: - allocate an extra 4 bytes, otherwise the bit.c */ /* eNlf: routines like source.u++ go beyond the boundaries */ /* eNlf: - memset the allocated buffer for sure */ data = (U8*)malloc(width*height*pixel*frames+4); if (!data) { dicom_log(ERROR,"Out of memory"); return 0L; } memset(data,0,width*height*pixel*frames+4); single.data = data; /* retrieve all frames and decompress */ for (f=0; fvr=OB; e->value.OB = data + f*width*height*pixel; if (mdc_dicom_decompress(&single,e)) { dicom_log(ERROR,"Decompression failed"); dicom_single_free(); return 0L; } } #if MDC_ENCAP_OFFSET_TABLE eNlfSafeFree(offset); #endif return &single; } } } if (dicom_skip()) break; } dicom_single_free(); return 0L; } /*************** * single free * ***************/ void dicom_single_free(void) { int i; dicom_log(DEBUG,"dicom_single_free()"); for (i=0; i<3; i++) eNlfSafeFree(single.clut[i].data.u16); eNlfSafeFree(single.data); memset(&single,0,sizeof(SINGLE)); } /********* * pixel * *********/ static S32 dicom_pixel(const ELEMENT *e) { U16 magic=0x1234; int error; dicom_log(DEBUG,"dicom_pixel()"); if (e->length!=0xFFFFFFFF) { if (single.alloc==16) { error=dicom_load(OW); }else if (single.alloc==12) { if ( *((U8*)&magic)==0x12 ) mdc_dicom_switch_endian(); error=dicom_load(OW); if ( *((U8*)&magic)==0x12 ) mdc_dicom_switch_endian(); }else{ error=dicom_load(OB); } if (error) return -1; single.data=e->value.OW; return e->length; } if (dicom_skip()) return -2; dicom_log(EMERGENCY,"Encapsulated PixelData is not implemented yet"); return -3; } xmedcon-0.14.1/libs/dicom/ChangeLog0000644000175000017510000000000011152103414013730 00000000000000xmedcon-0.14.1/libs/dicom/basic.c0000644000175000017510000005067312162147635013447 00000000000000/************************* * libdicom by Tony Voet * *************************/ /* * $Id: basic.c,v 1.27 2013/06/24 23:00:45 enlf Exp $ */ #include #include #include #include #include "dicom.h" char dicom_version[]="libdicom 0.31",**dicom_transfer_syntax=0L; WORKAROUND dicom_workaround; static void dicom_transfer(void); static void dicom_vr(void); static void dicom_encapsulated(int); static void dicom_sequence(int); static void dicom_endian(void); static int dicom_vm(void); #if MDC_DICOM_DEBUG static void mdc_dicom_debug_tag(void); #endif static void mdc_dicom_endian(void); static ELEMENT element; static FILE *stream=0L; static long position; static int meta; static enum { LITTLE=1, BIG=2, IMPLICIT=4, EXPLICIT=8, COMPRESSED_UNKNOWN=16, COMPRESSED_LOSSLESS = 32, COMPRESSED_LOSSLY = 64, COMPRESSED_RLE = 128 } syntax,endian,filesyntax,pixelsyntax,encapsyntax; #if MEDCON_INTEGRATED /* eNlf: routine for setting the stream from outside the library */ /* eNlf: in MedCon this library doesn't have to open or close stream */ /******** * init * ********/ void dicom_init(FILE *fp) { stream = fp; dicom_workaround = 0; } #endif /******** * open * ********/ int dicom_open(const char *file) { U16 magic=0x1234; char vr[2]; int r; #if MEDCON_INTEGRATED char buffer[512]; #else char *dot,*tmp,buffer[512]; #endif dicom_log(DEBUG,"dicom_open()"); #if !MEDCON_INTEGRATED if (!file) { dicom_log(ERROR,"No file given"); return -1; } dot=strrchr(file,'.'); if (dot) if (!strcmp(dot,".gz") || !strcmp(dot,".Z")) { tmp=tmpnam(0L); sprintf(buffer,"gzip -cd %.435s > %.64s",file,tmp); if (system(buffer)) { dicom_log(ERROR,"Unable to uncompress file"); unlink(tmp); return -2; } stream=fopen(tmp,"rb"); unlink(tmp); if (!stream) { dicom_log(ERROR,"Unable to open temporary file"); return -3; } } if (!stream) { stream=fopen(file,"rb"); if (!stream) { dicom_log(ERROR,"Unable to open file"); return -4; } } #else if (!stream) { dicom_log(ERROR,"Bad null stream"); return -4; } #endif r = fread(buffer,1,132,stream); if (r != 132) { if (dicom_check(0)) return -5; } if (!strncmp(buffer+128,"DICM",4)) { buffer[128]=0; dicom_log(INFO,"Dicom preamble"); dicom_log(INFO,buffer); meta=-1; syntax=LITTLE|EXPLICIT; /* watch out for LITTLE|IMPLICIT */ r = fread(&element.group,2,2,stream); if (r != 2) { if (dicom_check(0)) return -6; } dicom_swap(&element.group,2); dicom_swap(&element.element,2); r = fread(vr,1,2,stream); if (r != 2) { if (dicom_check(0)) return -7; } element.vr=(*vr<<8)|vr[1]; if (element.vr != UL) syntax=LITTLE|IMPLICIT; /* weird */ fseek(stream,132,SEEK_SET); } else { rewind(stream); meta=0; if (*buffer) { if (buffer[5]) { syntax=LITTLE|EXPLICIT; }else{ syntax=LITTLE|IMPLICIT; } }else{ if (buffer[4]) { syntax=BIG|EXPLICIT; }else{ syntax=BIG|IMPLICIT; } } } filesyntax=syntax; pixelsyntax=syntax; if ( *((U8*)&magic)==0x12 ) endian=BIG; else endian=LITTLE; dicom_encapsulated(-1); dicom_sequence(-1); return 0; } /*********** * element * ***********/ ELEMENT *dicom_element(void) { long rewind; U16 tmp; char vr[2]; int r; dicom_log(DEBUG,"dicom_element()"); if (!stream) return 0L; position=ftell(stream); r = fread(&element.group,2,2,stream); if (r != 2) { if (dicom_check(-1)) return 0L; } dicom_swap(&element.group,2); dicom_swap(&element.element,2); /* fix ezDICOM wrong transfer syntax */ /* MARK: 0x0800 not considered a group */ if ((element.group == 0x0800) && (syntax & BIG)) { dicom_log(WARNING,"Fix ezDICOM false endian transfer syntax"); dicom_workaround ^= MDC_FIX_EZDICOM; if (syntax & endian) { /* no previous swaps */ mdc_dicom_switch_syntax_endian(); dicom_swap(&element.group,2); dicom_swap(&element.element,2); }else{ /* undo previous swaps */ dicom_swap(&element.group,2); dicom_swap(&element.element,2); mdc_dicom_switch_syntax_endian(); } } if (meta) if (element.group>=0x0008) { meta=0; dicom_transfer(); fseek(stream,position,SEEK_SET); return dicom_element(); } if (syntax & IMPLICIT || element.group==0xFFFE) { dicom_vr(); r = fread(&element.length,4,1,stream); if (r != 1) { if (dicom_check(-1)) return 0L; } dicom_swap(&element.length,4); } else { r = fread(vr,1,2,stream); if (r != 2) { if (dicom_check(-1)) return 0L; } element.vr=(*vr<<8)|vr[1]; switch(element.vr) { case OB : case OW : case SQ : case UN : case UT : fseek(stream,2,SEEK_CUR); r = fread(&element.length,4,1,stream); if (r != 1) { if (dicom_check(-1)) return 0L; } dicom_swap(&element.length,4); break; default : r = fread(&tmp,2,1,stream); if (r != 1) { if (dicom_check(-1)) return 0L; } dicom_swap(&tmp,2); element.length=tmp; } } if (dicom_check(0)) return 0L; #if MDC_DICOM_DEBUG /* show tags before further processing */ mdc_dicom_debug_tag(); #endif if (element.length == 13) { /* fix naughty GE tag length */ dicom_log(WARNING,"Fix naughty GE tag length"); element.length = 10; }else if (((element.length % 2) != 0) && (element.length != 0xffffffff)) { /* debug info for uneven tag length */ dicom_log(WARNING,"Tag with uneven length"); } dicom_encapsulated(0); dicom_sequence(0); if (element.group==0x0002) if (element.element==0x0010) { rewind=ftell(stream); if (dicom_load(UI)) return 0L; fseek(stream,rewind,SEEK_SET); dicom_transfer_syntax=element.value.UI; } return &element; } /******** * skip * ********/ int dicom_skip(void) { dicom_log(DEBUG,"dicom_skip()"); if (!stream) { dicom_log(WARNING,"Stream closed - attempt to skip"); return -1; } if (element.vr==SQ || element.length==0xFFFFFFFF) return 0; if (element.group==0xFFFE) if (!element.encapsulated) return 0; fseek(stream,(long)element.length,SEEK_CUR); return dicom_check(0); } int mdc_dicom_skip_sequence(ELEMENT *e) { int answer = 0; if (e->sequence) { if (( e->sqtag.group == 0x0088) && (e->sqtag.element == 0x0200)) { answer = 1; } if ( e->sqtag.group % 2) { /* skip uneven (vendor specific) sequences */ answer = 1; } } return(answer); } /************* * MDC fseek * *************/ int mdc_dicom_fseek(U32 offset, int whence) { fseek(stream,(long)offset,whence); return(dicom_check(0)); } /************* * MDC ftell * *************/ U32 mdc_dicom_ftell(void) { return(ftell(stream)); } /******** * load * ********/ int dicom_load(VR vr) { int r; dicom_log(DEBUG,"dicom_load()"); if (!stream) { dicom_log(WARNING,"Stream closed - attempt to load"); return -1; } if (element.vr==UN) element.vr=vr; if (element.vr==SQ || element.length==0xFFFFFFFF) return 0; if (element.group==0xFFFE) if (!element.encapsulated) return 0; if (!element.length) element.value.UN=0L; else { /* eNlf: - allocate an extra 4 bytes, otherwise the bit.c */ /* eNlf: routines like source.u++ go beyond the boundaries */ /* eNlf: - memset the allocated buffer for sure */ element.value.UN=malloc(element.length + 4); if (!element.value.UN) { dicom_log(ERROR,"Out of memory"); dicom_close(); return -2; } memset(element.value.UN,0,element.length + 4); r = fread(element.value.UN,1,element.length,stream); if (r != element.length) { eNlfSafeFree(element.value.UN); if (dicom_check(0)) return -3; } mdc_dicom_endian(); } return dicom_vm(); } #if MDC_DICOM_DEBUG /***************** * MDC tag debug * *****************/ void mdc_dicom_debug_tag(void) { fprintf(stdout,"##### TAG DEBUG %12u: (%.4X,%.4X) %c%c[%u] (%u bytes)\n" ,position ,element.group,element.element ,element.vr>>8,element.vr&0xFF,element.vm ,element.length); } #endif /************** * MDC endian * **************/ /* * fix endian, take care of special pixel syntax */ void mdc_dicom_endian(void) { if ((element.group==0x7FE0) && (element.element == 0x0010)) { syntax=pixelsyntax; dicom_endian(); syntax=filesyntax; }else{ dicom_endian(); } } void mdc_dicom_switch_endian(void) { endian = (endian == LITTLE) ? BIG : LITTLE; } void mdc_dicom_switch_syntax_endian(void) { syntax ^= 0x3; /* endian in first two bits, so flip with XOR 0011 */ } /************ * MDC load * ************/ /* eNlf: BEGIN -- changes for integration in MedCon */ /* Routine for MedCon, at the end the tags are not handled by dicom_vm() so we can pass the tag through our MdcDoTag() routine and get the header info we need */ int mdc_dicom_load(VR vr) { int r; dicom_log(DEBUG,"dicom_load()"); if (!stream) { dicom_log(WARNING,"Stream closed - attempt to load"); return -1; } if (element.vr==UN) element.vr=vr; if (element.vr==SQ || element.length==0xFFFFFFFF) return 0; if (element.group==0xFFFE) if (!element.encapsulated) return 0; if (!element.length) element.value.UN=0L; else { /* eNlf: allocate an extra 4 bytes - see also dicom_load() */ element.value.UN=malloc(element.length + 4); if (!element.value.UN) { dicom_log(ERROR,"Out of memory"); dicom_close(); return -2; } memset(element.value.UN,0,element.length + 4); r = fread(element.value.UN,1,element.length,stream); if (r != element.length) { eNlfSafeFree(element.value.UN); if (dicom_check(0)) return -3; } mdc_dicom_endian(); } return 0; } /* eNlf: END -- changes for integration in MedCon */ /********* * clean * *********/ void dicom_clean(void) { U32 i; char *c; dicom_log(DEBUG,"dicom_clean()"); switch(element.vr) { case PN : for (i=0; i=element.value.AE[i]; c--) if (*c==' ' || *c=='\t') *c=0; else break; } break; default: break; } } /********* * close * *********/ int dicom_close(void) { dicom_log(DEBUG,"dicom_close()"); if (!stream) return 0; eNlfSafeFree(dicom_transfer_syntax); dicom_transfer_syntax=0L; #if ! MEDCON_INTEGRATED if (fclose(stream)) { dicom_log(WARNING,"Unable to close file"); stream=0L; return -1; } stream=0L; #else fseek(stream,0,SEEK_SET); #endif return 0; } /************ * transfer * ************/ static void dicom_transfer(void) { dicom_log(DEBUG,"dicom_transfer()"); if (!dicom_transfer_syntax) { dicom_log(WARNING,"No transfer syntax found"); return; } if (strncmp(*dicom_transfer_syntax,"1.2.840.113619.5.2",18) == 0) { syntax=LITTLE|IMPLICIT; filesyntax=syntax; pixelsyntax=BIG|IMPLICIT; return; } if (strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2",17)) { dicom_log(WARNING,"Transfer syntax is not DICOM"); return; } encapsyntax = 0; if (!strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4",19)) /* JPEG */ { if (!strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.50",22) || /* baseline */ !strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.51",22) || /* extended */ !strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.52",22) || /* extended */ !strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.53",22) || /* spectral selection, non-hierarchical */ !strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.54",22) || /* spectral selection, non-hierarchical */ !strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.55",22) || /* full progression, non-hierarchical */ !strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.56",22) || /* full progression, non-hierarchical */ !strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.59",22) || /* extended, hierarchical */ !strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.60",22) || /* extended, hierarchical */ !strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.61",22) || /* spectral selection, hierarchical */ !strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.62",22) || /* spectral selection, hierarchical */ !strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.63",22) || /* full progression, hierarchical */ !strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.64",22) ) /* full progression, hierarchical */ { encapsyntax = COMPRESSED_LOSSLY; return; } else if (!strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.57",22) || /* lossless, non-hierarchical */ !strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.58",22) || /* lossless, non-hierarchical */ !strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.65",22) || /* lossless, hierarchical */ !strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.66",22) || /* lossless, hierarchical */ !strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.4.70",22) ) /* lossless, hierarchical,, first order prediction */ { encapsyntax = COMPRESSED_LOSSLESS; return; } else { encapsyntax = COMPRESSED_UNKNOWN; return; } } if (!strncmp(*dicom_transfer_syntax,"1.2.840.10008.1.2.5",19)) /* RLE */ { encapsyntax = COMPRESSED_RLE; return; } if ((*dicom_transfer_syntax)[17]!='.') { syntax=LITTLE|IMPLICIT; filesyntax=syntax; pixelsyntax=syntax; }else{ switch((*dicom_transfer_syntax)[18]) { case '1' : case '4' : break; case '2' : syntax=BIG|EXPLICIT; filesyntax=syntax; pixelsyntax=syntax; break; default : dicom_log(WARNING,"Unknown transfer syntax"); dicom_log(WARNING,*dicom_transfer_syntax); } } } /****** * vr * ******/ static void dicom_vr(void) { static DICTIONARY data[]= { #include "dictionary.SQ" }; dicom_log(DEBUG,"dicom_vr()"); element.vr=dicom_private(data,&element)->vr; } /**************** * encapsulated * ****************/ static void dicom_encapsulated(int reset) { static int encapsulated; dicom_log(DEBUG,"dicom_encapsulated()"); if (reset) { encapsulated=0; return; } element.encapsulated=encapsulated; if (encapsulated) if (element.group==0xFFFE) if (element.element==0xE0DD) encapsulated=0; if (element.length==0xFFFFFFFF) if (element.vr!=SQ && element.group!=0xFFFE) encapsulated=-1; } /************ * sequence * ************/ static void dicom_sequence(int reset) { static U32 length[0x100]; static U8 sequence; static TAG sqtag[0x100]; dicom_log(DEBUG,"dicom_sequence()"); if (reset) { sequence=0; return; } element.sequence=sequence; if (sequence) { element.sqtag.group = sqtag[sequence].group; element.sqtag.element = sqtag[sequence].element; if ((element.group == 0xFFFE) && (element.element == 0x0000)) { /* skip those nasty item tags */ dicom_log(WARNING,"Skip PHILIPS premature item bug"); element.length=0; element.vm=0; fseek(stream,4,SEEK_CUR); return; } if (length[sequence]!=0xFFFFFFFF) { *length=ftell(stream)-position; if (element.length!=0xFFFFFFFF) if (element.group!=0xFFFE || element.element!=0xE000) *length+=element.length; if (*length>length[sequence]) { dicom_log(WARNING,"Incorrect sequence length"); sequence--; } else length[sequence]-=*length; if (!length[sequence]) sequence--; } } if (element.vr==SQ) { if (sequence!=0xFF) { sequence++; length[sequence]=element.length; sqtag[sequence].group = element.group; sqtag[sequence].element= element.element; } else dicom_log(WARNING,"Deep sequence hierarchy"); } if (element.group==0xFFFE) if (element.element==0xE0DD) { if (!element.encapsulated) { if (sequence) sequence--; else dicom_log(WARNING,"Incorrect sequence delimiter"); } } } /********** * endian * **********/ static void dicom_endian(void) { U32 i; U8 *s; dicom_log(DEBUG,"dicom_endian()"); if (syntax & endian) return; switch(element.vr) { case AT : case OW : case SS : case US : s=element.value.UN; for (i=element.length>>1; i; i--,s+=2) dicom_swap(s,2); return; case SL : case UL : case FL : s=element.value.UN; for (i=element.length>>2; i; i--,s+=4) dicom_swap(s,4); return; case FD : s=element.value.UN; for (i=element.length>>3; i; i--,s+=8) dicom_swap(s,8); return; default: return; } } /****** * vm * ******/ static int dicom_vm(void) { U32 i; char *c,**table,*s,*d; dicom_log(DEBUG,"dicom_vm()"); switch(element.length) { case 0 : element.vm=0; return 0; case 0xFFFFFFFF : element.vm=1; return 0; } switch(element.vr) { case LT : case OB : case OW : case SQ : case ST : case UT : default : element.vm=1; return 0; case SS : case US : element.vm=element.length>>1; return 0; case AT : case FL : case SL : case UL : element.vm=element.length>>2; return 0; case FD : element.vm=element.length>>3; return 0; case AE : case AS : case CS : case DA : case DS : case DT : case IS : case LO : case PN : case SH : case TM : case UI : element.vm=1; c=element.value.UN; for (i=element.length; i; i--,c++) if (*c=='\\') element.vm++; element.value.UN=realloc(element.value.UN,element.vm*sizeof(char*) +element.length+1); if (!element.value.UN) { dicom_log(ERROR,"Out of memory"); dicom_close(); return -1; } c=element.value.LT+element.vm*sizeof(char*); s=element.value.LT+element.length; d=c+element.length; for (i=element.length; i; i--) *--d=*--s; table=element.value.AE; *table++=c; for (i=element.length; i; i--,c++) if (*c=='\\') { *c=0; *table++=c+1; } *c=0; if (!(element.length&1)) if (*--c==' ') *c=0; return 0; } } /******** * swap * ********/ void dicom_swap(void *v,int n) { int i; U8 *b,*e,tmp; if (syntax & endian) return; b=v; e=b+n-1; for (i=n>>1; i; i--) { tmp=*b; *b++=*e; *e--=tmp; } } /********* * check * *********/ int dicom_check(int expected) { if (ferror(stream)) { dicom_log(ERROR,"Error while reading file"); dicom_close(); return -1; } if (feof(stream)) { if (!expected) dicom_log(ERROR,"Unexpected end of file"); dicom_close(); return -2; } return 0; } /****************** * MDC decompress * ******************/ int mdc_dicom_decompress(SINGLE *s, ELEMENT *e) { switch (encapsyntax) { case COMPRESSED_RLE : if (mdc_dicom_decomp_rle (stream,(U16*)e->value.OB,e->length)) return(-1); break; case COMPRESSED_LOSSLESS: if (s->w > 4096) { dicom_log(WARNING,"LJPG compiled with 4096-wide image limit"); dicom_log(WARNING,"Check out 'jpegutil.c' file to increase"); return(-2); } if (mdc_dicom_decomp_ljpg(stream,(U16*)e->value.OB,e->length ,(unsigned)s->alloc*s->samples)) return(-2); break; case COMPRESSED_LOSSLY : default: /* no valid decompressor */ return(-3); } return(0); } xmedcon-0.14.1/libs/dicom/log.c0000644000175000017510000000431107562323104013126 00000000000000/************************* * libdicom by Tony Voet * *************************/ /* * $Id: log.c,v 1.2 2002/11/06 23:31:16 enlf Exp $ */ #include #include #include #include #include "dicom.h" CONDITION dicom_log_level=NOTICE; /* eNlf: BEGIN -- change for compilation error on Red Hat 6.0 */ /* static FILE *stream=stderr; */ /* The above statement fails: initializer not constant */ /* eNlf: END -- change for compilation error on Red Hat 6.0 */ static FILE *stream=NULL; static char *program=NULL; /************ * log name * ************/ void dicom_log_name(char *name) { program=strrchr(name,'/'); if (program) program++; else program=name; } /************ * log open * ************/ int dicom_log_open(const char *file) { if (!file) { dicom_log(ERROR,"No file given"); return -1; } stream=fopen(file,"a"); if (!stream) { stream=stderr; dicom_log(ERROR,"Unable to open log file"); return -1; } return 0; } /******* * log * *******/ void dicom_log(CONDITION condition,const char *message) { time_t t; char tmp[32]; static char *explination[]= { "emergency", "alert", "critical", "error", "warning", "notice", "info", "debug" }; if (condition>dicom_log_level) return; time(&t); strftime(tmp,32,"%b %d %H:%M:%S",localtime(&t)); /* eNlf: BEGIN -- change for compilation error on Red Hat 6.0 */ if (stream == NULL) { fprintf(stderr,"%s %s[%u]: %s: %s\n", tmp, program ? program : "log", (unsigned int) getpid(), explination[condition], message); }else{ fprintf(stream,"%s %s[%u]: %s: %s\n", tmp, program ? program : "log", (unsigned int) getpid(), explination[condition], message); } /* eNlf: END -- change for compilation error on Red Hat 6.0 */ } /************* * log close * *************/ int dicom_log_close(void) { if (stream==stderr) { dicom_log(NOTICE,"Attempt to close stderr"); return -1; } if (fclose(stream)) { stream=stderr; dicom_log(WARNING,"Unable to close log"); return -2; } stream=stderr; return 0; } xmedcon-0.14.1/libs/dicom/process.c0000644000175000017510000001337207752564216014046 00000000000000/************************* * libdicom by Tony Voet * *************************/ /* * $Id: process.c,v 1.2 2003/11/07 00:34:22 enlf Exp $ */ #include #include "dicom.h" /******* * max * *******/ void dicom_max(IMAGE *image) { U32 length,l; U16 min,max,*pixel; dicom_log(DEBUG,"dicom_max()"); if (!image) { dicom_log(WARNING,"No image given"); return; } if (image->rgb) { dicom_log(WARNING,"Color image"); return; } length=image->frames*image->w*image->h; pixel=image->data.gray; min=*pixel; max=min; for (l=length; l; l--,pixel++) { if (*pixelmax) max=*pixel; } if (min==max) return; if (min==0) if (max==0xFFFFU) return; pixel=image->data.gray; for (l=length; l; l--, pixel++) *pixel=0xFFFFUL*(*pixel-min)/(max-min); } /********** * invert * **********/ void dicom_invert(IMAGE *image) { U32 l; U16 *pixel; dicom_log(DEBUG,"dicom_invert()"); if (!image) { dicom_log(WARNING,"No image given"); return; } if (image->rgb) { dicom_log(WARNING,"Color image"); return; } pixel=image->data.gray; for (l=image->frames*image->w*image->h; l; l--, pixel++) *pixel=0xFFFFU-*pixel; } /******* * voi * *******/ void dicom_voi(IMAGE *image,U16 min,U16 max) { U32 l; U16 *pixel; dicom_log(DEBUG,"dicom_voi()"); if (min==0) if (max==0xFFFFU) return; if (!image) { dicom_log(WARNING,"No image given"); return; } if (image->rgb) { dicom_log(WARNING,"Color image"); return; } pixel=image->data.gray; for (l=image->frames*image->w*image->h; l; l--,pixel++) { if (*pixel<=min) { *pixel=0; continue; } if (*pixel>=max) { *pixel=0xFFFFU; continue; } *pixel=0xFFFFUL*(*pixel-min)/(max-min); } } /******** * gray * ********/ void dicom_gray(IMAGE *image) { U32 length,l; U16 *target; U8 *source; dicom_log(DEBUG,"dicom_gray()"); if (!image) { dicom_log(WARNING,"No image given"); return; } if (!image->rgb) return; length=image->frames*image->w*image->h; source=image->data.rgb; target=image->data.gray; for (l=length; l; l--,source+=3) *target++=77UL*source[0]+151UL*source[1]+29UL*source[2]; image->rgb=0; target=realloc(image->data.gray,2*length); if (!target) dicom_log(WARNING,"Error reallocating memory"); else image->data.gray=target; dicom_max(image); } /* eNlf: BEGIN - add support for indexed color, use external function */ /*********** * color * ***********/ void dicom_color(IMAGE *image, U8 *palette, U8 dither, char *(*reduce)()) { U32 l, size, length; U16 *target16; U8 *dest; dicom_log(DEBUG,"dicom_color()"); if (!image) { dicom_log(WARNING,"No image given"); return; } if (!image->rgb) { dicom_log(WARNING,"No RGB image given"); return; } if (reduce == NULL) { dicom_log(WARNING,"Missing color quantization function"); return; } size = image->w * image->h; length = size * image->frames; /* work with 8-bits values */ dest = malloc(length); if (!dest) dicom_log(WARNING,"Error allocation 8bits memory"); /* reduce RGB to indexed, but for all frames at once */ /* otherwise different palette for each image */ reduce(image->data.rgb,dest,image->w,image->h*image->frames,palette,dither); image->rgb=0; /* translate to 16-bits values */ target16=realloc(image->data.gray,2*length); if (!target16) dicom_log(WARNING,"Error reallocating memory"); for (l=0; ldata.gray=target16; } /* eNlf: END - add support for indexed color, use external function */ /******* * hsv * *******/ void dicom_hsv(U16 h,U16 s,U16 v,U8 *rgb) { float hue,saturation,f; int i; U8 value,m,n; hue=h*6.0/65536.0; saturation=s/65535.0; value=v>>8; i=hue; f=hue-i; if (!(i&1)) f=1.0-f; m=value*(1.0-saturation); n=value*(1.0-saturation*f); switch(i) { case 0 : rgb[0]=value; rgb[1]=n; rgb[2]=m; break; case 1 : rgb[0]=n; rgb[1]=value; rgb[2]=m; break; case 2 : rgb[0]=m; rgb[1]=value; rgb[2]=n; break; case 3 : rgb[0]=m; rgb[1]=n; rgb[2]=value; break; case 4 : rgb[0]=n; rgb[1]=m; rgb[2]=value; break; case 5 : rgb[0]=value; rgb[1]=m; rgb[2]=n; } } /********* * merge * *********/ IMAGE *dicom_merge(const IMAGE *anatomic,const IMAGE *parametric,U16 saturation) { IMAGE *zoom,*merge; U16 bar,*value,*hue,frame,x,y; U8 *target; dicom_log(DEBUG,"dicom_merge()"); if (!anatomic || !parametric) { dicom_log(ERROR,"Image missing"); return 0L; } if (anatomic->rgb || parametric->rgb) { dicom_log(ERROR,"Wrong image type"); return 0L; } if (anatomic->frames!=parametric->frames) { dicom_log(ERROR,"Wrong number of frames"); return 0L; } zoom=dicom_zoom(parametric,anatomic->w,anatomic->h,-1); if (!zoom) return 0L; bar=anatomic->w>>5; merge=dicom_new(-1,anatomic->frames,anatomic->w+(bar<<1),anatomic->h); if (!merge) { dicom_free(zoom,1); return 0L; } value=anatomic->data.gray; hue=zoom->data.gray; target=merge->data.rgb; for (frame=anatomic->frames; frame; frame--) for (y=0; yh; y++) { for (x=anatomic->w; x; x--) { dicom_hsv(2UL*(0xFFFFU-*hue)/3U,*hue?saturation:0,*value,target); value++; hue++; target+=3; } for (x=3*bar; x; x--) *target++=0; for (x=bar; x; x--) { dicom_hsv(0xAAAAUL*y/(anatomic->h-1),saturation,0xFFFFU,target); target+=3; } } dicom_free(zoom,1); return merge; } xmedcon-0.14.1/libs/dicom/README0000644000175000017510000000774710124131460013067 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: README # # # # UTILITY text: Medical Image Conversion Utility # # # # purpose : the dicom 'you-should-read' file # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: README,v 1.3 2004/09/21 23:03:12 enlf Exp $ (X)MedCon's DICOM library ------------------------- This library code was originally contributed by 'Tony Voet'. Additional changes were made for use within the (X)MedCon project. Original version: libdicom 0.31 (1998) Adapted version: 13-Oct-2002 - without jpeg-6a lib dependency - use GNU's automake/autoconf/libtool (= libtools convenience library) - prevent rescaling of pixel values - using define MEDCON_INTEGRATED for a splitted library which: - enables to set file stream from outside the lib - disables closing of the file stream - changes to use original OFFIS DCMTK dicom.dic dictionary - read GE implicit little endian except big endian pixels - modular dictionaries, built during compilation process - support for color through color reduction with external function - unpacking of 12 bits allocated pixels - encapsulated pixeldata: rle, lossless jpeg License & Copyright notices: --------------------------- 1) VT-DICOM (C) 1998, Tony Voet. Read the file ./COPYING.LIB 2) LossLess JPEG: see the "ljpg/README" file. 3) dict-dicom.dic: dictionary borrowed from the OFFIS DCMTK Toolkit see http://www.offis.uni-oldenburg.de /* * Copyright (C) 1994-2001, OFFIS * * This software and supporting documentation were developed by * * Kuratorium OFFIS e.V. * Healthcare Information and Communication Systems * Escherweg 2 * D-26121 Oldenburg, Germany * * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. * * Copyright of the software and supporting documentation is, unless * otherwise stated, owned by OFFIS, and free access is hereby granted as * a license to use this software, copy this software and prepare * derivative works based upon this software. However, any distribution * of this software source code or supporting documentation or derivative * works (source code and supporting documentation) must include the * three paragraphs of this copyright notice. * */ Usage: ----- This directory needs to be configured from within the (X)MedCon distribution which will create the proper "Makefile". Building the library requires another two dictionary files: - dictionary.SQ - dictionary.data Both are extracted from the source dictionary file "dicom.dic". The latter can be a mixture of the standard dicom dictionary "dict-dicom.dic" and any other user specified dictionaries. See also "DICTXTR" variable in the "Makefile". Any changes in the dictionaries requires the rebuilt of the above two files. This can also be done manually: $> make rmdicts (to remove both dictionary files) $> make dodicts (to make both dictionary files) Support on encapsulated LossLess JPEG pixeldata provided in 'ljpg' subdir. Notes: ----- Any problems? enlf[at]users.sourceforge.net Where to get? http://sourceforge.net/projects/xmedcon Ofcourse, with special credits to Tony Voet (tony.voet[at]uzgent.be) xmedcon-0.14.1/libs/dicom/dict-vision.dic0000644000175000017510000000205610124131005015077 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: dict-vision.dic # # # # DICOM DICT: Medical Image Conversion Utility # # # # purpose : dicom dictionary for Siemens Vision files # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: dict-vision.dic,v 1.2 2004/09/21 22:58:13 enlf Exp $ # (0021,1120) DS FieldOfView 2 Si_vision (0021,1160) DS 1stSliceImagePos 3 Si_vision (0021,1161) DS ImageNormal 3 Si_vision (0021,116a) DS ImageRow 3 Si_vision (0021,116b) DS ImageColumn 3 Si_vision # xmedcon-0.14.1/libs/dicom/zoom.c0000644000175000017510000000775707725462417013366 00000000000000/************************* * libdicom by Tony Voet * *************************/ /* * $Id: zoom.c,v 1.2 2003/09/03 22:02:55 enlf Exp $ */ #include #include "dicom.h" static void dicom_zoom_gray(const IMAGE *,U16 *,U16 *); static void dicom_zoom_rgb(const IMAGE *,U8 *,U8 *); static void dicom_hyper_gray(const IMAGE *,U16 *,U16 *); static void dicom_hyper_rgb(const IMAGE *,U8 *,U8 *); static IMAGE *zoom; /******** * zoom * ********/ IMAGE *dicom_zoom(const IMAGE *image,int w,int h,int hyper) { U16 frame; int size; void *source,*target; dicom_log(DEBUG,"dicom_zoom()"); if (!image) { dicom_log(ERROR,"No image given"); return 0L; } zoom=dicom_new(image->rgb,image->frames,w,h); if (!zoom) return 0L; if (zoom->rgb) size=3; else size=2; if (w==image->w && h==image->h) { memcpy(zoom->data.rgb,image->data.rgb,(unsigned)zoom->frames* (unsigned)(w*h*size)); return zoom; } source=image->data.rgb; target=zoom->data.rgb; for (frame=zoom->frames; frame; frame--) { if (!hyper || (ww && hh)) if (zoom->rgb) dicom_zoom_rgb(image,source,target); else dicom_zoom_gray(image,source,target); else if (zoom->rgb) dicom_hyper_rgb(image,source,target); else dicom_hyper_gray(image,source,target); source=(U8*)source+image->w*image->h*size; target=(U8*)target+w*h*size; } return zoom; } /************* * zoom gray * *************/ static void dicom_zoom_gray(const IMAGE *image,U16 *source,U16 *target) { float x,y,sx,sy; U16 *line; dicom_log(DEBUG,"dicom_zoom_gray()"); sx=(float) image->w/zoom->w; sy=(float) image->h/zoom->h; for (y=sy/2.0; yh; y+=sy) { line=source+image->w*(int)y; for (x=sx/2.0; xw; x+=sx) *target++=line[(int)x]; } } /************ * zoom rgb * ************/ static void dicom_zoom_rgb(const IMAGE *image,U8 *source,U8 *target) { float x,y,sx,sy; int i; U8 *line; dicom_log(DEBUG,"dicom_zoom_rgb()"); sx=(float) image->w/zoom->w; sy=(float) image->h/zoom->h; for (y=sy/2.0; yh; y+=sy) { line=source+3*image->w*(int)y; for (x=sx/2.0; xw; x+=sx) { i=3*(int)x; *target++=line[i]; *target++=line[i+1]; *target++=line[i+2]; } } } /************** * hyper gray * **************/ static void dicom_hyper_gray(const IMAGE *image,U16 *source,U16 *target) { float x,y,sx,sy,dx,dy; int ix,iy; U16 *line,*next; dicom_log(DEBUG,"dicom_hyper_gray()"); sx=(float) image->w/zoom->w; sy=(float) image->h/zoom->h; for (y=sy/2.0; yh; y+=sy) { iy=(int)(y+0.5)-1; line=source+image->w*iy; next=line+image->w; for (x=sx/2.0; xw; x+=sx) { ix=(int)(x+0.5)-1; dx=x-ix-0.5; dy=y-iy-0.5; if (x<0.5) dx=1.0; if (image->w-0.5h-0.5w/zoom->w; sy=(float) image->h/zoom->h; for (y=sy/2.0; yh; y+=sy) { iy=(int)(y+0.5)-1; line=source+3*image->w*iy; next=line+3*image->w; for (x=sx/2.0; xw; x+=sx) { ix=(int)(x+0.5)-1; dx=x-ix-0.5; dy=y-iy-0.5; if (x<0.5) dx=1.0; if (image->w-0.5h-0.5 #include #include "dicom.h" static U16 dicom_clut(const CLUT *,U16); /********* * alloc * *********/ int dicom_alloc(SINGLE *single) { U32 length,l; U16 magic=0x1234,*data,*d; int high,bit,low; dicom_log(DEBUG,"dicom_alloc()"); if (!single) { dicom_log(ERROR,"No image given"); return -1; } if (single->alloc>16) dicom_log(WARNING,"Large BitsAllocated"); length=single->frames*single->w*single->h*single->samples; data=malloc(length*2); if (!data) { dicom_log(ERROR,"Out of memory"); return -2; } high=single->alloc-single->high-1; bit=single->bit; low=single->high+1-bit; d=data; dicom_bit(single->data); if ( *((U8*)&magic)==0x12 ) if (single->alloc==12) for (l=length; l; l-=2) { *d++=mdc_dicom_12_unpack(1); *d++=mdc_dicom_12_unpack(2); } else for (l=length; l; l--) { dicom_32_skip(high); *d++=dicom_32_read(bit); dicom_32_skip(low); } else if (single->alloc==16) for (l=length; l; l--) { dicom_16_skip(high); *d++=dicom_16_read(bit); dicom_16_skip(low); } else if (single->alloc==12) for (l=length; l; l-=2) { *d++=mdc_dicom_12_unpack(1); *d++=mdc_dicom_12_unpack(2); } else for (l=length; l; l--) { dicom_8_skip(high); *d++=dicom_8_read(bit); dicom_8_skip(low); } eNlfSafeFree(single->data); single->data=data; single->alloc=16; single->high=single->bit-1; return 0; } /******** * sign * ********/ int dicom_sign(SINGLE *single) { int edge,i; U32 length,l; U16 *d; dicom_log(DEBUG,"dicom_sign()"); if (!single) { dicom_log(ERROR,"No image given"); return -1; } if (!single->sign) return 0; if (single->alloc!=16) { dicom_log(ERROR,"BitsAllocated != 16"); return -2; } if (single->high!=single->bit-1) dicom_log(WARNING,"Wrong HighBit"); edge=1<<(single->bit-1); length=single->frames*single->w*single->h*single->samples; d=single->data; for (l=length; l; l--,d++) if (*dphotometric) { case PALETTE_COLOR : case ARGB : for (i=0; i<3; i++) if (single->clut[i].threshold.u16clut[i].threshold.u16+=edge; else single->clut[i].threshold.u16-=edge; for (i=0; i<3; i++) if (!single->clut[i].data.u16) dicom_log(ERROR,"Missing CLUT"); else { edge=1<<(single->clut[i].bit-1); d=single->clut[i].data.u16; for (l=single->clut[i].size; l; l--,d++) if (*dsign=0; return 0; } /********** * planar * **********/ int dicom_planar(SINGLE *single) { int i,j; U32 length,l; U16 *frame_s,*frame_d,*s,*d; dicom_log(DEBUG,"dicom_planar()"); if (!single) { dicom_log(ERROR,"No image given"); return -1; } if (single->samples<=1) return 0; if (!single->planar) return 0; if (single->alloc!=16) { dicom_log(ERROR,"BitsAllocated != 16"); return -2; } length=single->w*single->h; frame_d=malloc(length*single->samples*2); if (!frame_d) { dicom_log(ERROR,"Out of memory"); return -3; } for (i=0; iframes; i++) { frame_s=(U16*)single->data+i*length*single->samples; s=frame_s; for (j=0; jsamples; j++) { d=frame_d+j; for (l=length; l; l--) { *d=*s++; d+=single->samples; } } memcpy(frame_s,frame_d,length*single->samples*2); } eNlfSafeFree(frame_d); single->planar=0; return 0; } /********* * shift * *********/ int dicom_shift(SINGLE *single) { int shift,i; U32 length,l; U16 *d; dicom_log(DEBUG,"dicom_shift()"); if (!single) { dicom_log(ERROR,"No image given"); return -1; } if (single->photometric==MONOCHROME1 || single->photometric==MONOCHROME2) return 0; if (single->alloc!=16) { dicom_log(ERROR,"BitsAllocated != 16"); return -2; } switch(single->photometric) { default : shift=15-single->high; if (!shift) return 0; length=single->frames*single->w*single->h*single->samples; d=single->data; for (l=length; l; l--) *d++<<=shift; single->high=15; break; case ARGB : shift=15-single->high; if (shift) { length=single->frames*single->w*single->h; d=single->data; for (l=length; l; l--) { d++; *d++<<=shift; *d++<<=shift; *d++<<=shift; } single->high=15; } case PALETTE_COLOR : for (i=0; i<3; i++) { shift=16-single->clut[i].bit; if (!shift) continue; d=single->clut[i].data.u16; for (l=single->clut[i].size; l; l--) *d++<<=shift; single->clut[i].bit=16; } } return 0; } /************* * transform * *************/ IMAGE *dicom_transform(SINGLE *single,int parametric) { static IMAGE image; U32 length,l; U16 *s; U8 *d; dicom_log(DEBUG,"dicom_transform()"); if (!single) { dicom_log(ERROR,"No image given"); return 0L; } if (dicom_alloc(single)) return 0L; switch(single->photometric) { case MONOCHROME1: case MONOCHROME2: /* keep original values, either negative and/or quantified */ break; default: /* make positive, colored files */ if (dicom_sign(single)) return 0L; } if (dicom_planar(single)) return 0L; if (dicom_shift(single)) return 0L; memset(&image,0,sizeof(IMAGE)); image.frames=single->frames; image.w=single->w; image.h=single->h; switch(single->photometric) { case MONOCHROME1 : case MONOCHROME2 : image.rgb=0; image.data.gray=single->data; single->data=0L; if (parametric) return ℑ dicom_max(&image); if (single->photometric==MONOCHROME1) dicom_invert(&image); return ℑ case PALETTE_COLOR : case ARGB : if (!single->clut[0].data.u16 || !single->clut[1].data.u16 || !single->clut[2].data.u16) { dicom_log(ERROR,"Missing CLUT"); return 0L; } break; default : break; } image.rgb=-1; image.data.rgb=malloc((unsigned)(image.frames*image.w*image.h)*3U); if (!image.data.rgb) { dicom_log(ERROR,"Out of memory"); return 0L; } length=image.frames*image.w*image.h; s=(U16*)single->data; d=image.data.rgb; switch(single->photometric) { case PALETTE_COLOR : for (l=length; l; l--) { *d++=dicom_clut(single->clut, *s)>>8; *d++=dicom_clut(single->clut+1,*s)>>8; *d++=dicom_clut(single->clut+2,*s)>>8; s++; } break; case RGB : for (l=length*3; l; l--) *d++=*s++>>8; break; case HSV : for (l=length; l; l--) { dicom_hsv(s[0],s[1],s[2],d); s+=3; d+=3; } break; case ARGB : for (l=length; l; l--) if (*s) { *d++=dicom_clut(single->clut, *s)>>8; *d++=dicom_clut(single->clut+1,*s)>>8; *d++=dicom_clut(single->clut+2,*s)>>8; s+=4; } else { s++; *d++=*s++>>8; *d++=*s++>>8; *d++=*s++>>8; } break; case CMYK : for (l=length; l; l--) { *d++=(0xFFFF-*s++)>>8; *d++=(0xFFFF-*s++)>>8; *d++=(0xFFFF-*s++)>>8; s++; } break; default : break; } return ℑ } /******** * clut * ********/ static U16 dicom_clut(const CLUT *clut,U16 i) { if (i<=clut->threshold.u16) return clut->data.u16[0]; i-=clut->threshold.u16; if (i>=clut->size-1) return clut->data.u16[clut->size-1]; return clut->data.u16[i]; } xmedcon-0.14.1/libs/dicom/image.c0000644000175000017510000001325507725461157013452 00000000000000/************************* * libdicom by Tony Voet * *************************/ /* * $Id: image.c,v 1.2 2003/09/03 21:51:43 enlf Exp $ */ #include #include #include #include "dicom.h" /* eNlf: BEGIN - comment out unwanted stuff */ /* #include "jpeglib.h" */ /* eNlf: END - comment out unwanted stuff */ /******* * new * *******/ IMAGE *dicom_new(int rgb,U16 frames,U16 w,U16 h) { IMAGE *image; dicom_log(DEBUG,"dicom_new()"); image=malloc(sizeof(IMAGE)); if (!image) { dicom_log(ERROR,"Out of memory"); return 0L; } image->rgb=rgb; image->frames=frames; image->w=w; image->h=h; if (rgb) image->data.rgb=malloc((unsigned)(frames*w*h)*3U); else image->data.gray=malloc((unsigned)(frames*w*h)*2U); if (!image->data.rgb) { dicom_log(ERROR,"Out of memory"); eNlfSafeFree(image); return 0L; } return image; } /******** * read * ********/ int dicom_read(const char *file,IMAGE **image,int *images,int parametric) { SINGLE *single; IMAGE *new,*tmp; dicom_log(DEBUG,"dicom_read()"); if (!file) { dicom_log(ERROR,"No file given"); return -1; } if (!image || !images) { dicom_log(ERROR,"Argument missing"); return -2; } if (dicom_open(file)) return -3; for (*image=0L,*images=0;;) { single=dicom_single(); if (!single) break; new=dicom_transform(single,parametric); if (new) { if (*image) tmp=realloc(*image,(*images+1)*sizeof(IMAGE)); else tmp=malloc(sizeof(IMAGE)); if (!tmp) { dicom_log(ERROR,"Error reallocating memory"); eNlfSafeFree(new->data.rgb); } else { *image=tmp; memcpy(*image+*images,new,sizeof(IMAGE)); (*images)++; } } dicom_single_free(); } if (*images==0) { dicom_log(ERROR,"No images found"); /* eNlf: BEGIN -- changes for integration in MedCon */ dicom_close(); /* eNlf: END -- changes for integration in MedCon */ return -4; } return 0; } /******** * free * ********/ void dicom_free(IMAGE *image,int images) { int i; dicom_log(DEBUG,"dicom_free()"); if (!image) return; for (i=0; ih/(image->w<<1),-1); if (!zoom) return -3; dicom_gray(zoom); dicom_max(zoom); pixel=zoom->data.gray; for (frame=zoom->frames; frame; frame--) { for (y=zoom->h; y; y--) { for (x=zoom->w; x; x--,pixel++) putc(gray[(int) 69**pixel/0xFFFF],stream); puts(""); } puts(""); } dicom_free(zoom,1); return 0; } */ /************** * write jpeg * **************/ /* int dicom_write_jpeg(const char *file,const IMAGE *image,int quality) { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; JSAMPROW line,target; FILE *stream; U16 *source,l; dicom_log(DEBUG,"dicom_write_jpeg()"); if (!file) { dicom_log(ERROR,"No file given"); return -1; } if (!image) { dicom_log(ERROR,"No image given"); return -2; } if (!image->rgb) { line=malloc(image->w*2); if (!line) { dicom_log(ERROR,"Out of memory"); return -3; } } stream=fopen(file,"wb"); if (!stream) { dicom_log(ERROR,"Unable to create jpeg file"); return -4; } cinfo.err=jpeg_std_error(&jerr); jpeg_create_compress(&cinfo); jpeg_stdio_dest(&cinfo,stream); cinfo.image_width=image->w; cinfo.image_height=image->h*image->frames; if (image->rgb) { cinfo.input_components=3; cinfo.in_color_space=JCS_RGB; } else { cinfo.input_components=1; cinfo.in_color_space=JCS_GRAYSCALE; } jpeg_set_defaults(&cinfo); jpeg_set_quality(&cinfo,quality,-1); jpeg_start_compress(&cinfo,-1); while (cinfo.next_scanlinergb) line=image->data.rgb+cinfo.next_scanline*image->w*3; else { source=image->data.gray+cinfo.next_scanline*image->w; target=line; for (l=image->w; l; l--) *target++=*source++>>8; } jpeg_write_scanlines(&cinfo,&line,1); } if (!image->rgb) eNlfSafeFree(line); jpeg_finish_compress(&cinfo); fclose(stream); jpeg_destroy_compress(&cinfo); return 0; } */ /************* * write eps * *************/ /* int dicom_write_eps(const char *file,const IMAGE *image) { dicom_log(DEBUG,"dicom_write_eps()"); if (!file) { dicom_log(ERROR,"No file given"); return -1; } if (!image) { dicom_log(ERROR,"No image given"); return -2; } dicom_log(EMERGENCY,"DICOM write EPS is not implemented yet"); return -3; } */ /*eNlf: END - comment out unwanted stuff */ xmedcon-0.14.1/libs/dicom/parse.c0000644000175000017510000000565412161664345013500 00000000000000/**************************** * dicom parse by Tony Voet * ****************************/ /* * $Id: parse.c,v 1.2 2013/06/23 21:30:13 enlf Exp $ */ #include #include #include "dicom.h" static DICTIONARY *parse_input(char *); static void parse_output(const DICTIONARY *); static void parse_warn(const char *msg); /******** * main * ********/ #define LINE 8192 int main(int argc,char *argv[]) { DICTIONARY *dict; char line[LINE], *s; for (;;) { s = fgets(line,LINE,stdin); if (s != line) break; /*if (feof(stdin)) break;*/ dict=parse_input(line); if (dict) parse_output(dict++); } puts("{0xFFFF,0xFFFF,ANY, 0xFFFF,0xFFFF,ANY, UN, \"Unknown\"}"); return 0; } /********* * input * *********/ static DICTIONARY *parse_input(char *c) { static DICTIONARY d; if (*c=='#') return 0L; if (*c++!='(') { parse_warn("'(' expected"); parse_warn(c); return 0L; } d.group=strtol(c,&c,16); d.group_last=d.group; d.group_match=ANY; if (*c=='-') { switch(*++c) { default : d.group_match=EVEN; break; case 'u' : c+=2; break; case 'o' : d.group_match=ODD; c+=2; } d.group_last=strtol(c,&c,16); } if (*c++!=',') { parse_warn("',' expected"); parse_warn(c); return 0L; } d.element=strtol(c,&c,16); d.element_last=d.element; d.element_match=ANY; if (*c=='-') { switch(*++c) { default : d.element_match=EVEN; break; case 'u' : c+=2; break; case 'o' : d.element_match=ODD; c+=2; } d.element_last=strtol(c,&c,16); } if (*c++!=')') { parse_warn("')' expected"); parse_warn(c); return 0L; } if (*c++!='\t') { parse_warn("'\\t' expected"); parse_warn(c); return 0L; } d.vr=*c++<<8; d.vr|=*c++; switch(d.vr) { case AE : case AS : case AT : case CS : case DA : case DS : case DT : case FL : case FD : case IS : case LO : case LT : case OB : case OW : case PN : case SH : case SL : case SQ : case SS : case ST : case TM : case UI : case UL : case US : case UN : /* special tag (choice) */ case ox : break; default : d.vr=UN; } if (*c++!='\t') { parse_warn("'\\t' expected"); parse_warn(c); return 0L; } d.description=c; for (; *c!='\t'; c++); *c=0; return &d; } /********** * output * **********/ static void parse_output(const DICTIONARY *d) { static char *match[]= { "EVEN,", "ODD, ", "ANY, " }; if (!d) return; printf ( "{0x%.4X,0x%.4X,%s 0x%.4X,0x%.4X,%s %c%c, \"%s\"},\n", d->group, d->group_last, match[d->group_match], d->element, d->element_last, match[d->element_match], d->vr>>8, d->vr&0xFF, d->description ); } void parse_warn(const char *message) { fprintf(stderr,"parse: WARNING: %s\n",message); } xmedcon-0.14.1/libs/dicom/bit.c0000644000175000017510000000625607552637503013147 00000000000000/************************* * libdicom by Tony Voet * *************************/ /* * $Id: bit.c,v 1.1 2002/10/14 22:03:47 enlf Exp $ */ #include "dicom.h" union { U32 *u32; U16 *u16; U8 *u8; } source; U32 cache32; U16 cache16; U8 cache8; int left; /******* * bit * *******/ void dicom_bit(void *data) { dicom_log(DEBUG,"dicom_bit()"); source.u32=data; left=0; } /********** * 8 skip * **********/ void dicom_8_skip(int bit) { if (!bit) return; if (bit>(8-bit); cache8<<=bit; left-=bit; } else { result=cache8>>(8-left); bit-=left; cache8=*source.u8++; left=8; if (!bit) return result; result<<=bit; result|=dicom_8_read(bit); } return result; } /*********** * 16 read * ***********/ U32 dicom_16_read(int bit) { U32 result; if (!bit) return 0; if (bit>(16-bit); cache16<<=bit; left-=bit; } else { result=cache16>>(16-left); bit-=left; cache16=*source.u16++; left=16; if (!bit) return result; result<<=bit; result|=dicom_16_read(bit); } return result; } /*********** * 32 read * ***********/ U32 dicom_32_read(int bit) { U32 result; if (!bit) return 0; if (bit>(32-bit); cache32<<=bit; left-=bit; } else { result=cache32>>(32-left); bit-=left; cache32=*source.u32++; left=32; if (!bit) return result; result<<=bit; result|=dicom_32_read(bit); } return result; } /* eNlf: BEGIN - support for 12bit unpacking */ /************* * 12 unpack * *************/ /* 2 pix 12bit = [0xABCDEF] */ /* 2 pix 16bit = [0x0ABD] + [0x0FCE] */ U16 mdc_dicom_12_unpack(int pix) { U16 result; U8 b0, b1, b2; switch (pix) { case 1: /* ABD-part (1st pix) */ b0 = *source.u8++; b1 = *source.u8; result = ((b0 >> 4) << 8) + ((b0 & 0x0f) << 4) + (b1 & 0x0f); /* A */ /* B */ /* D */ break; case 2: /* FCE-part (2nd pix) */ b1 = *source.u8++; b2 = *source.u8++; result = ((b2 & 0x0f) << 8) + ((b1 >> 4) << 4) + (b2 >> 4); /* F */ /* C */ /* E */ break; default: result = 0; } return result; } /* eNlf: END - support for 12 bits unpacking */ xmedcon-0.14.1/libs/dicom/COPYING.LIB0000644000175000017510000006365007552637471013672 00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. ^L Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. ^L GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. ^L Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. ^L 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. ^L 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. ^L 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. ^L 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS ^L How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! xmedcon-0.14.1/libs/dicom/dictionary.c0000644000175000017510000000266407552637521014535 00000000000000/************************* * libdicom by Tony Voet * *************************/ /* * $Id: dictionary.c,v 1.1 2002/10/14 22:04:01 enlf Exp $ */ #include "dicom.h" /********* * query * *********/ DICTIONARY *dicom_query(ELEMENT *element) { static DICTIONARY data[]= { #include "dictionary.data" }; dicom_log(DEBUG,"dicom_query()"); if (!element) { dicom_log(ERROR,"No element given"); return 0L; } return dicom_private(data,element); } /*********** * private * ***********/ DICTIONARY *dicom_private(DICTIONARY *data,ELEMENT *e) { static DICTIONARY *d; dicom_log(DEBUG,"dicom_private()"); if (!data) { dicom_log(ERROR,"No dictionary given"); return 0L; } if (!e) { dicom_log(ERROR,"No element given"); return 0L; } for (d=data; d->group!=0xFFFF; d++) { if (e->groupgroup) continue; if (e->group>d->group_last) continue; switch(d->group_match) { case ANY : break; case EVEN : if (e->group&1) continue; break; case ODD : if (!(e->group&1)) continue; } if (e->elementelement) continue; if (e->element>d->element_last) continue; switch(d->element_match) { case ANY : break; case EVEN : if (e->element&1) continue; break; case ODD : if (!(e->element&1)) continue; } break; } return d; } xmedcon-0.14.1/libs/dicom/dict-gemsi.dic0000644000175000017510000000524607552637516014735 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: dict-gemsi.dic # # # # DICOM DICT: Medical Image Conversion Utility # # # # purpose : dicom dictionary for XA files from GEMSI Innova 2000 # # # # project : (X)MedCon by Erik Nolf # # # # credits : contributed by Paolo Marcheschi IFC-CNR Pisa (Italy). # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: dict-gemsi.dic,v 1.1 2002/10/14 22:03:58 enlf Exp $ # (0015,0010) LO PrivateCreator 1 GEMSI (0015,0011) LO PrivateCreator 1 GEMSI (0015,1086) IS LastXaNumber 1 GEMSI (0015,1187) IS NumberOfImages 1 GEMSI (0015,118D) IS ItemLocked 1 GEMSI # (0019,0010) LO PrivateCreator 1 GEMSI (0019,0011) LO PrivateCreator 1 GEMSI (0019,0012) LO PrivateCreator 1 GEMSI (0019,104C) CS InternalLabel 1 GEMSI (0019,104D) CS BrowserHide 1 GEMSI (0019,1117) IS UserSpaFltStrgth 1 GEMSI (0019,1118) IS UserZoomFactor 1 GEMSI (0019,1124) DS LambdaCmPincushionDistortion 1 GEMSI (0019,1125) DS SlopeLvRegression 1 GEMSI (0019,1126) DS InterceptLvRegressio 1 GEMSI (0019,120B) DS FovDimDouble 2 GEMSI (0019,1230) LO ImageFileName 1 GEMSI (0019,1231) IS DefSpaFltFamily 1 GEMSI (0019,1232) IS DefSpaFltStrgth 1 GEMSI (0019,124E) DS DefBrightContr 2 GEMSI (0019,124F) DS UserBrightContr 2 GEMSI # (0025,0010) DS PivotAngle 1 GEMSI (0025,1002) IS FrameID 1 GEMSI (0025,1003) DS DistanceSourceToDetector 1 GEMSI (0025,1004) DS DistanceSourceToPatient 1 GEMSI (0025,1005) DS DistanceSourceToSkin 1 GEMSI (0025,1006) DS PositionerPrimaryAngle 1 GEMSI (0025,1007) DS PositionerSecondaryAngle 1 GEMSI (0025,1009) DS LarmAngle 1 GEMSI (0025,1010) DS PivotAngle1 1 GEMSI (0025,101A) DS ArcAngle 1 GEMSI (0025,101B) DS TableVertPos 1 GEMSI (0025,101F) DS KvpActual 1 GEMSI (0025,1020) DS XrayTubeCurrentActual 1 GEMSI (0025,1021) DS ExposureTimeActual 1 GEMSI (0025,1027) DS TgtEntrDosenGy 1 GEMSI (0025,1028) DS CnrCmdPercent 1 GEMSI (0025,1029) DS ContrastCmdLSB 1 GEMSI (0025,102A) DS EptActualCm 1 GEMSI (0025,102B) IS ZNumberSpectralFilter 1 GEMSI (0025,1030) IS FovDimension 2 GEMSI (0025,1033) IS FovOrigin 2 GEMSI # xmedcon-0.14.1/libs/dicom/dicom.h0000644000175000017510000001216210031414574013445 00000000000000/************************* * libdicom by Tony Voet * *************************/ /* * $Id: dicom.h,v 1.10 2004/03/28 00:17:00 enlf Exp $ */ #ifndef __LIBDICOM__ #include #include /* change code for MedCon */ #define MEDCON_INTEGRATED 1 /* eNlf: BEGIN - add macro for safe freeing of pointers */ #define eNlfSafeFree(p) { if (p != NULL) free(p); p=NULL; } /* eNlf: END - add macro for safe freeing of pointers */ /* disable/enable DICOM debugging */ #define MDC_DICOM_DEBUG 0 #define S8 signed char #define S16 signed short #define S32 signed int #define U8 unsigned char #define U16 unsigned short #define U32 unsigned int /******* * fix * *******/ typedef enum { MDC_FIX_EZDICOM=1 } WORKAROUND; extern WORKAROUND dicom_workaround; /******* * log * *******/ typedef enum { EMERGENCY, ALERT, CRITICAL, ERROR, WARNING, NOTICE, INFO, DEBUG } CONDITION; extern CONDITION dicom_log_level; void dicom_log_name(char *); int dicom_log_open(const char *); void dicom_log(CONDITION,const char *); int dicom_log_close(void); /********** * single * **********/ typedef struct { U16 size,bit; union { U16 u16; S16 s16; } threshold; union { U16 *u16; S16 *s16; } data; } CLUT; typedef struct { enum { MONOCHROME2, MONOCHROME1, PALETTE_COLOR, RGB, HSV, ARGB, CMYK, UNKNOWN } photometric; int frames; U16 w,h,samples,alloc,bit,high,sign,planar; CLUT clut[3]; void *data; } SINGLE; SINGLE *dicom_single(void); void dicom_single_free(void); /********* * basic * *********/ typedef struct { U16 group,element; } TAG; typedef enum { AE=('A'<<8)|'E', AS=('A'<<8)|'S', AT=('A'<<8)|'T', CS=('C'<<8)|'S', DA=('D'<<8)|'A', DS=('D'<<8)|'S', DT=('D'<<8)|'T', FL=('F'<<8)|'L', FD=('F'<<8)|'D', IS=('I'<<8)|'S', LO=('L'<<8)|'O', LT=('L'<<8)|'T', OB=('O'<<8)|'B', OW=('O'<<8)|'W', PN=('P'<<8)|'N', SH=('S'<<8)|'H', SL=('S'<<8)|'L', SQ=('S'<<8)|'Q', SS=('S'<<8)|'S', ST=('S'<<8)|'T', TM=('T'<<8)|'M', UI=('U'<<8)|'I', UL=('U'<<8)|'L', US=('U'<<8)|'S', UN=('U'<<8)|'N', UT=('U'<<8)|'T', /* special tag (choices) */ ox=('o'<<8)|'x' } VR; typedef struct { U16 group,element; VR vr; U32 length; union { TAG *AT; double *FD; float *FL; U32 *UL; S32 *SL; U16 *OW,*US; S16 *SS; U8 *OB; char **AE,**AS,**CS,**DA,**DS,**DT,**IS, **LO,*LT,**PN,**SH,*ST,**TM,**UI, *UT; void *SQ,*UN; } value; U32 vm; int encapsulated; U8 sequence; TAG sqtag; } ELEMENT; extern char dicom_version[],**dicom_transfer_syntax; #if MEDCON_INTEGRATED void dicom_init(FILE *fp); #endif int dicom_open(const char *); ELEMENT *dicom_element(void); int dicom_skip(void); int dicom_load(VR); void dicom_clean(void); int dicom_close(void); void dicom_swap(void *,int); int dicom_check(int); /* eNlf: BEGIN -- changes for integration in MedCon */ int mdc_dicom_decompress(SINGLE *, ELEMENT *); int mdc_dicom_skip_sequence(ELEMENT *); int mdc_dicom_fseek(U32, int); U32 mdc_dicom_ftell(void); int mdc_dicom_load(VR); void mdc_dicom_switch_endian(void); void mdc_dicom_switch_syntax_endian(void); /* eNlf: END -- changes for integration in MedCon */ /************** * dictionary * **************/ typedef enum { EVEN, ODD, ANY } MATCH; typedef struct { U16 group,group_last; MATCH group_match; U16 element,element_last; MATCH element_match; VR vr; char *description; } DICTIONARY; DICTIONARY *dicom_query(ELEMENT *); DICTIONARY *dicom_private(DICTIONARY *,ELEMENT *); /******* * bit * *******/ void dicom_bit(void *); void dicom_8_skip(int); void dicom_16_skip(int); void dicom_32_skip(int); U32 dicom_8_read(int); U32 dicom_16_read(int); U32 dicom_32_read(int); U16 mdc_dicom_12_unpack(int); /********* * image * *********/ typedef struct { int rgb; U16 frames,w,h; union { U16 *gray; U8 *rgb; } data; } IMAGE; IMAGE *dicom_new(int,U16,U16,U16); int dicom_read(const char *,IMAGE **,int *,int); void dicom_free(IMAGE *,int); int dicom_write(const char *,const IMAGE *); /* eNlf: BEGIN - comment out unwanted stuff */ /* int dicom_write_ascii(const char *,const IMAGE *,int); */ /* int dicom_write_jpeg(const char *,const IMAGE *,int); */ /* int dicom_write_eps(const char *,const IMAGE *); */ /* eNlf: END - comment out unwanted stuff */ /************* * transform * *************/ int dicom_alloc(SINGLE *); int dicom_sign(SINGLE *); int dicom_planar(SINGLE *); int dicom_shift(SINGLE *); IMAGE *dicom_transform(SINGLE *,int); /******** * zoom * ********/ IMAGE *dicom_zoom(const IMAGE *,int,int,int); /*********** * process * ***********/ void dicom_max(IMAGE *); void dicom_invert(IMAGE *); void dicom_voi(IMAGE *,U16,U16); void dicom_gray(IMAGE *); void dicom_color(IMAGE *image, U8 *palette, U8 dither, char *(*reduce)()); void dicom_hsv(U16,U16,U16,U8 *); IMAGE *dicom_merge(const IMAGE *,const IMAGE *,U16); /************** * MDC decomp * **************/ S16 mdc_dicom_decomp_rle(FILE *, U16 *, U32); S16 mdc_dicom_decomp_ljpg(FILE *, U16 *, U32, U32); #define __LIBDICOM__ #endif xmedcon-0.14.1/libs/dicom/decomp.c0000644000175000017510000001047512162147635013631 00000000000000/***************************** * libdicom - MDC extensions * *****************************/ /* * $Id: decomp.c,v 1.6 2013/06/24 23:00:45 enlf Exp $ */ /* * Contributions by Jaslet Bertrand * * for handling encapsulated pixeldata: * * - RLE * * - LossLess JPEG */ #include "dicom.h" #ifdef MDC_SUPPORT_LJPG #include "jpeg.h" #include "jpegless.h" #endif #define MDC_MAX_RLE_SEGMENTS 4L /* max of 32 bits (ARGB) images supported */ /******* * RLE * *******/ static void mdc_dicom_decodeRLE_segment(U16 *, U8 *, U32, U32 , U32); /* * gets and decode an RLE pixel data element * return : the image */ S16 mdc_dicom_decomp_rle(FILE *fp, U16 *image16, U32 length) { U32 numberSegments, i; U8 *rle; long offset[MDC_MAX_RLE_SEGMENTS + 1], rlelen, skip; int r; dicom_log(DEBUG,"mdc_dicom_decomp_rle()"); /* for each image we have: */ /* 0xFFFE 0xE000 length RLE_header RLE_segment1 RLE_segment2 ... */ /* length is 4 bits / image */ /* read 4 chars from the file = number of segments */ r = fread(&numberSegments,4,1,fp); if (r != 1) { dicom_check(-1); dicom_log(ERROR,"RLE - Failure numberSegments"); return -1; } dicom_swap(&numberSegments,4); if (numberSegments > MDC_MAX_RLE_SEGMENTS) { dicom_log(ERROR,"RLE - Maximum of 32 bits images supported"); return -1; /* allow 8, 16, 24 & 32 bits images, 8 bits per segment */ } /* read offset0, offset1, offset2, ... */ for (i=0; i < numberSegments; i++) { r = fread(&offset[i],4,1,fp); if (r != 1) { dicom_check(-1); dicom_log(ERROR,"RLE - Failure offsets"); return -1; } dicom_swap(&offset[i],4); } /* skip rest of header */ skip = 60 - (numberSegments * 4); fseek(fp, skip, SEEK_CUR); if (dicom_check(-1)) { dicom_log(ERROR,"RLE - Failure header skip"); return -1; } offset[numberSegments] = length; /* needed for offset last segment */ /* read all segments */ for (i=0; i < numberSegments; i++) { /* read rle image */ rlelen = offset[i+1] - offset[i]; rle = (U8*)malloc((U32)(rlelen + 10L)); if (rle) { /* extract the image from the file */ r = fread((void *)rle, (unsigned)rlelen, 1L, fp); if (r != 1) { dicom_check(-1); dicom_log(ERROR,"RLE - Failure image read"); return -2; } mdc_dicom_decodeRLE_segment(image16,rle ,(unsigned)rlelen,numberSegments,i); /* delete buffer */ free(rle); } else { dicom_log(ERROR,"RLE - Out of memory"); return -3; } } return 0; } /* * decode a RLE segment * image : pointer on real image (8 or 16 bits) * rle : pointer on rle buffer (8bits) * length : length of rle buffer * segtot : total number of segments * segnb : number of current segment (zero based !) */ void mdc_dicom_decodeRLE_segment(U16 *image, U8 *rle, U32 length,U32 segtot, U32 segnb) { U32 j, indj; U8 *pix, val; U16 code; /* prevent warning: actually signed char >=128) = (256-code) */ U16 ii, iimax; dicom_log(DEBUG,"mdc_dicom_decodeRLE_segment()"); /* convert rle into real image */ pix = (U8*) image; /* initial start number, zero based */ /* segment 1st=0, 2nd=1, 3rd=2, ... */ indj = segnb; for (j = 0L; j < length; ) { code = (U16) rle [j]; j++; /* yes, I know but do not move it */ /* sequence of different bytes */ if (code == 0) { if (j < length - 1) pix [indj] = rle [j++]; indj += segtot; } else if ((code > 0) && (code <= 127)) { for (ii = 0; ii < (code + 1); ii++) { if (j == length) break; pix [indj] = rle [j++]; indj += segtot; } } /* repetition of the same byte */ else if ((code <= 255) && (code > 128)) { val = rle [j++]; iimax = 256-code; for (ii = 0; ii <= iimax; ii++) { pix [indj] = val; indj += segtot; } } } /* for */ } /***************** * LossLess JPEG * *****************/ S16 mdc_dicom_decomp_ljpg(FILE *fp, U16 *image16, U32 length, U32 depth) { #if MDC_SUPPORT_LJPG return(JPEGLosslessDecodeImage(fp,image16,(signed)depth,(signed)length)); #else return(-1); #endif } xmedcon-0.14.1/libs/dicom/dict-dicom.dic0000644000175000017510000037463410476121304014714 00000000000000# # Copyright (C) 1994-2005, OFFIS # # This software and supporting documentation were developed by # # Kuratorium OFFIS e.V. # Healthcare Information and Communication Systems # Escherweg 2 # D-26121 Oldenburg, Germany # # THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY # REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR # FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR # ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND # PERFORMANCE OF THE SOFTWARE IS WITH THE USER. # # Module: dcmdata # # Author: Andrew Hewett, Marco Eichelberg # # Purpose: # This is the global DICOM data dictionary for the dcmtk class library. # # Last Update: $Author: enlf $ # Update Date: $Date: 2006/09/01 21:14:44 $ # Source File: $Source: /cvsroot/xmedcon/xmedcon/libs/dicom/dict-dicom.dic,v $ # CVS/RCS Revision: $Revision: 1.5 $ # Status: $State: Exp $ # # This dictionary contains # - the complete dictionary from the 2004 DICOM publication # - all final text supplements and CPs as of the last CVS commit date # This includes: # supplements 1-42 (except 16, 21 and 34 which are cancelled), # 44-55 (46 is cancelled), 57-62, 64-73, 75-77, 79-94 # (81 is cancelled), 97, 99-101 and 103-105 as well as the # CP packages 1-33 (final text) # # Each line represents an entry in the data dictionary. Each line # has 5 fields (Tag, VR, Name, VM, Version). Entries need not be # in ascending tag order. # # Entries may override existing entries. # # Each field must be separated by a single tab. The tag values (gggg,eeee) # must be in hexedecimal and must be surrounded by parentheses. Repeating # groups are represented by indicating the range (gggg-gggg,eeee). By default # the repeating notation only represents even numbers. A range where only # odd numbers are valid is represented using the notation (gggg-o-gggg,eeee). # A range can represent both even and odd numbers using the notation # (gggg-u-gggg,eeee). The element part of the tag can also be a range. # # Comments have a '#' at the beginning of the line. # # Tag VR Name VM Version # (0000,0000) UL CommandGroupLength 1 dicom98 (0000,0002) UI AffectedSOPClassUID 1 dicom98 (0000,0003) UI RequestedSOPClassUID 1 dicom98 (0000,0100) US CommandField 1 dicom98 (0000,0110) US MessageID 1 dicom98 (0000,0120) US MessageIDBeingRespondedTo 1 dicom98 (0000,0600) AE MoveDestination 1 dicom98 (0000,0700) US Priority 1 dicom98 (0000,0800) US DataSetType 1 dicom98 (0000,0900) US Status 1 dicom98 (0000,0901) AT OffendingElement 1-n dicom98 (0000,0902) LO ErrorComment 1 dicom98 (0000,0903) US ErrorID 1 dicom98 (0000,1000) UI AffectedSOPInstanceUID 1 dicom98 (0000,1001) UI RequestedSOPInstanceUID 1 dicom98 (0000,1002) US EventTypeID 1 dicom98 (0000,1005) AT AttributeIdentifierList 1-n dicom98 (0000,1008) US ActionTypeID 1 dicom98 (0000,1020) US NumberOfRemainingSuboperations 1 dicom98 (0000,1021) US NumberOfCompletedSuboperations 1 dicom98 (0000,1022) US NumberOfFailedSuboperations 1 dicom98 (0000,1023) US NumberOfWarningSuboperations 1 dicom98 (0000,1030) AE MoveOriginatorApplicationEntityTitle 1 dicom98 (0000,1031) US MoveOriginatorMessageID 1 dicom98 (0002,0000) UL MetaElementGroupLength 1 dicom98 (0002,0001) OB FileMetaInformationVersion 1 dicom98 (0002,0002) UI MediaStorageSOPClassUID 1 dicom98 (0002,0003) UI MediaStorageSOPInstanceUID 1 dicom98 (0002,0010) UI TransferSyntaxUID 1 dicom98 (0002,0012) UI ImplementationClassUID 1 dicom98 (0002,0013) SH ImplementationVersionName 1 dicom98 (0002,0016) AE SourceApplicationEntityTitle 1 dicom98 (0002,0100) UI PrivateInformationCreatorUID 1 dicom98 (0002,0102) OB PrivateInformation 1 dicom98 (0004,0000) UL FileSetGroupLength 1 dicom98 (0004,1130) CS FileSetID 1 dicom98 (0004,1141) CS FileSetDescriptorFileID 1-8 dicom98 (0004,1142) CS SpecificCharacterSetOfFileSetDescriptorFile 1 dicom98 (0004,1200) up OffsetOfTheFirstDirectoryRecordOfTheRootDirectoryEntity 1 dicom98 (0004,1202) up OffsetOfTheLastDirectoryRecordOfTheRootDirectoryEntity 1 dicom98 (0004,1212) US FileSetConsistencyFlag 1 dicom98 (0004,1220) SQ DirectoryRecordSequence 1 dicom98 (0004,1400) up OffsetOfTheNextDirectoryRecord 1 dicom98 (0004,1410) US RecordInUseFlag 1 dicom98 (0004,1420) up OffsetOfReferencedLowerLevelDirectoryEntity 1 dicom98 (0004,1430) CS DirectoryRecordType 1 dicom98 (0004,1432) UI PrivateRecordUID 1 dicom98 (0004,1500) CS ReferencedFileID 1-8 dicom98 (0004,1504) up MRDRDirectoryRecordOffset 1 dicom98 (0004,1510) UI ReferencedSOPClassUIDInFile 1 dicom98 (0004,1511) UI ReferencedSOPInstanceUIDInFile 1 dicom98 (0004,1512) UI ReferencedTransferSyntaxUIDInFile 1 dicom98 (0004,151A) UI ReferencedRelatedGeneralSOPClassUIDInFile 1-n dicom2004 (0004,1600) UL NumberOfReferences 1 dicom98 (0008,0000) UL IdentifyingGroupLength 1 dicom98 # VM of (0008,0005) SpecificCharacterSet was 1 in DICOM93. Changed in DICOM96 (Supplement 9). (0008,0005) CS SpecificCharacterSet 1-n dicom98 (0008,0008) CS ImageType 1-n dicom98 (0008,0012) DA InstanceCreationDate 1 dicom98 (0008,0013) TM InstanceCreationTime 1 dicom98 (0008,0014) UI InstanceCreatorUID 1 dicom98 (0008,0016) UI SOPClassUID 1 dicom98 (0008,0018) UI SOPInstanceUID 1 dicom98 (0008,001A) UI RelatedGeneralSOPClassUID 1-n dicom2004 (0008,001B) UI OriginalSpecializedSOPClassUID 1 dicom2004 (0008,0020) DA StudyDate 1 dicom98 (0008,0021) DA SeriesDate 1 dicom98 (0008,0022) DA AcquisitionDate 1 dicom98 # (0008,0023) ContentDate was named ImageDate before. Changed in dicom2000 (Supplement 30). (0008,0023) DA ContentDate 1 dicom2000 (0008,0024) DA OverlayDate 1 dicom98 (0008,0025) DA CurveDate 1 dicom98 (0008,002A) DT AcquisitionDatetime 1 dicom2000 (0008,0030) TM StudyTime 1 dicom98 (0008,0031) TM SeriesTime 1 dicom98 (0008,0032) TM AcquisitionTime 1 dicom98 # (0008,0033) ContentTime was named ImageTime before. Changed in dicom2000 (Supplement 30). (0008,0033) TM ContentTime 1 dicom2000 (0008,0034) TM OverlayTime 1 dicom98 (0008,0035) TM CurveTime 1 dicom98 (0008,0050) SH AccessionNumber 1 dicom98 (0008,0052) CS QueryRetrieveLevel 1 dicom98 (0008,0054) AE RetrieveAETitle 1-n dicom98 (0008,0056) CS InstanceAvailability 1 dicom2000 (0008,0058) UI FailedSOPInstanceUIDList 1-n dicom98 (0008,0060) CS Modality 1 dicom98 (0008,0061) CS ModalitiesInStudy 1-n dicom98 (0008,0062) UI SOPClassesInStudy 1-n dicom2004 (0008,0064) CS ConversionType 1 dicom98 (0008,0068) CS PresentationIntentType 1 dicom99 (0008,0070) LO Manufacturer 1 dicom98 (0008,0080) LO InstitutionName 1 dicom98 (0008,0081) ST InstitutionAddress 1 dicom98 (0008,0082) SQ InstitutionCodeSequence 1 dicom98 (0008,0090) PN ReferringPhysiciansName 1 dicom98 (0008,0092) ST ReferringPhysiciansAddress 1 dicom98 (0008,0094) SH ReferringPhysiciansTelephoneNumbers 1-n dicom98 (0008,0096) SQ ReferringPhysicianIdentificationSequence 1 dicom2003 (0008,0100) SH CodeValue 1 dicom98 (0008,0102) SH CodingSchemeDesignator 1 dicom98 (0008,0103) SH CodingSchemeVersion 1 dicom99 (0008,0104) LO CodeMeaning 1 dicom98 (0008,0105) CS MappingResource 1 dicom99 (0008,0106) DT ContextGroupVersion 1 dicom99 (0008,0107) DT ContextGroupLocalVersion 1 dicom99 (0008,010B) CS CodeSetExtensionFlag 1 dicom99 # (0008,010C) CodingSchemeUID was named PrivateCodingSchemeCreatorUID before. Changed in dicom2002. (0008,010C) UI CodingSchemeUID 1 dicom99 (0008,010D) UI CodeSetExtensionCreatorUID 1 dicom99 (0008,010F) CS ContextIdentifier 1 dicom99 (0008,0110) SQ CodingSchemeIdentificationSequence 1 dicom2003 (0008,0112) LO CodingSchemeRegistry 1 dicom2003 (0008,0114) ST CodingSchemeExternalID 1 dicom2003 (0008,0115) ST CodingSchemeName 1 dicom2003 (0008,0116) ST ResponsibleOrganization 1 dicom2003 (0008,0201) SH TimezoneOffsetFromUTC 1 dicom2000 (0008,1010) SH StationName 1 dicom98 (0008,1030) LO StudyDescription 1 dicom98 (0008,1032) SQ ProcedureCodeSequence 1 dicom98 (0008,103E) LO SeriesDescription 1 dicom98 (0008,1040) LO InstitutionalDepartmentName 1 dicom98 (0008,1048) PN PhysiciansOfRecord 1-n dicom98 (0008,1049) SQ PhysiciansOfRecordIdentificationSequence 1 dicom2003 (0008,1050) PN PerformingPhysiciansName 1-n dicom98 (0008,1052) SQ PerformingPhysicianIdentificationSequence 1 dicom2003 (0008,1060) PN NameOfPhysiciansReadingStudy 1-n dicom98 (0008,1062) SQ PhysiciansReadingStudyIdentificationSequence 1 dicom2003 (0008,1070) PN OperatorsName 1-n dicom98 (0008,1072) SQ OperatorIdentificationSequence 1 dicom2003 (0008,1080) LO AdmittingDiagnosesDescription 1-n dicom98 # Renamed in CP 239, name was AdmittingDiagnosisCodeSequence before (0008,1084) SQ AdmittingDiagnosesCodeSequence 1 dicom2001 (0008,1090) LO ManufacturersModelName 1 dicom98 (0008,1100) SQ ReferencedResultsSequence 1 dicom98 (0008,1110) SQ ReferencedStudySequence 1 dicom98 # Name of (0008,1111) was ReferencedStudyComponentSequence. Renamed in CP 257. (0008,1111) SQ ReferencedPerformedProcedureStepSequence 1 dicom2003 (0008,1115) SQ ReferencedSeriesSequence 1 dicom98 (0008,1120) SQ ReferencedPatientSequence 1 dicom98 (0008,1125) SQ ReferencedVisitSequence 1 dicom98 (0008,1130) SQ ReferencedOverlaySequence 1 dicom98 (0008,113A) SQ ReferencedWaveformSequence 1 dicom2001 (0008,1140) SQ ReferencedImageSequence 1 dicom98 (0008,1145) SQ ReferencedCurveSequence 1 dicom98 (0008,114A) SQ ReferencedInstanceSequence 1 dicom2001 (0008,114B) SQ ReferencedRealWorldValueMappingInstanceSequence 1 dicom2005 (0008,1150) UI ReferencedSOPClassUID 1 dicom98 (0008,1155) UI ReferencedSOPInstanceUID 1 dicom98 (0008,115A) UI SOPClassesSupported 1-n dicom99 # VM of (0008,1160) ReferencedFrameNumber was 1 in dicom98. Changed in dicom2000 (Supplement 33). (0008,1160) IS ReferencedFrameNumber 1-n dicom2000 (0008,1195) UI TransactionUID 1 dicom98 (0008,1197) US FailureReason 1 dicom98 (0008,1198) SQ FailedSOPSequence 1 dicom98 (0008,1199) SQ ReferencedSOPSequence 1 dicom98 (0008,1200) SQ StudiesContainingOtherReferencedInstancesSequence 1 dicom2004 (0008,1250) SQ RelatedSeriesSequence 1 dicom2004 (0008,2111) ST DerivationDescription 1 dicom98 (0008,2112) SQ SourceImageSequence 1 dicom98 (0008,2120) SH StageName 1 dicom98 (0008,2122) IS StageNumber 1 dicom98 (0008,2124) IS NumberOfStages 1 dicom98 (0008,2127) SH ViewName 1 dicom2001 (0008,2128) IS ViewNumber 1 dicom98 (0008,2129) IS NumberOfEventTimers 1 dicom98 (0008,212A) IS NumberOfViewsInStage 1 dicom98 (0008,2130) DS EventElapsedTimes 1-n dicom98 (0008,2132) LO EventTimerNames 1-n dicom98 (0008,2142) IS StartTrim 1 dicom98 (0008,2143) IS StopTrim 1 dicom98 (0008,2144) IS RecommendedDisplayFrameRate 1 dicom98 (0008,2218) SQ AnatomicRegionSequence 1 dicom98 (0008,2220) SQ AnatomicRegionModifierSequence 1 dicom98 (0008,2228) SQ PrimaryAnatomicStructureSequence 1 dicom98 (0008,2229) SQ AnatomicStructureSpaceOrRegionSequence 1 dicom98 (0008,2230) SQ PrimaryAnatomicStructureModifierSequence 1 dicom98 (0008,2240) SQ TransducerPositionSequence 1 dicom98 (0008,2242) SQ TransducerPositionModifierSequence 1 dicom98 (0008,2244) SQ TransducerOrientationSequence 1 dicom98 (0008,2246) SQ TransducerOrientationModifierSequence 1 dicom98 (0008,3001) SQ AlternateRepresentationSequence 1 dicom2004 (0008,3010) UI IrradiationEventUID 1 dicom2005 (0008,9007) CS FrameType 4 dicom2003 (0008,9092) SQ ReferencedImageEvidenceSequence 1 dicom2003 (0008,9121) SQ ReferencedRawDataSequence 1 dicom2003 (0008,9123) UI CreatorVersionUID 1 dicom2003 (0008,9124) SQ DerivationImageSequence 1 dicom2003 (0008,9154) SQ SourceImageEvidenceSequence 1 dicom2003 (0008,9205) CS PixelPresentation 1 dicom2003 (0008,9206) CS VolumetricProperties 1 dicom2003 (0008,9207) CS VolumeBasedCalculationTechnique 1 dicom2003 (0008,9208) CS ComplexImageComponent 1 dicom2003 (0008,9209) CS AcquisitionContrast 1 dicom2003 (0008,9215) SQ DerivationCodeSequence 1 dicom2003 (0008,9237) SQ ReferencedGrayscalePresentationStateSequence 1 dicom2003 (0008,9410) SQ ReferencedOtherPlaneSequence 1 dicom2005 (0008,9458) SQ FrameDisplaySequence 1 dicom2005 (0008,9459) FL RecommendedDisplayFrameRateInFloat 1 dicom2005 (0008,9460) CS SkipFrameRangeFlag 1 dicom2005 (0010,0000) UL PatientGroupLength 1 dicom98 (0010,0010) PN PatientsName 1 dicom98 (0010,0020) LO PatientID 1 dicom98 (0010,0021) LO IssuerOfPatientID 1 dicom98 (0010,0030) DA PatientsBirthDate 1 dicom98 (0010,0032) TM PatientsBirthTime 1 dicom98 (0010,0040) CS PatientsSex 1 dicom98 (0010,0050) SQ PatientsInsurancePlanCodeSequence 1 dicom98 (0010,0101) SQ PatientsPrimaryLanguageCodeSequence 1 dicom2001 (0010,0102) SQ PatientsPrimaryLanguageCodeModifierSequence 1 dicom2001 (0010,1000) LO OtherPatientIDs 1-n dicom98 (0010,1001) PN OtherPatientNames 1-n dicom98 (0010,1005) PN PatientsBirthName 1 dicom98 (0010,1010) AS PatientsAge 1 dicom98 (0010,1020) DS PatientsSize 1 dicom98 (0010,1030) DS PatientsWeight 1 dicom98 (0010,1040) LO PatientsAddress 1 dicom98 (0010,1060) PN PatientsMothersBirthName 1 dicom98 (0010,1080) LO MilitaryRank 1 dicom98 (0010,1081) LO BranchOfService 1 dicom98 (0010,1090) LO MedicalRecordLocator 1 dicom98 (0010,2000) LO MedicalAlerts 1-n dicom98 (0010,2110) LO ContrastAllergies 1-n dicom98 (0010,2150) LO CountryOfResidence 1 dicom98 (0010,2152) LO RegionOfResidence 1 dicom98 (0010,2154) SH PatientsTelephoneNumbers 1-n dicom98 (0010,2160) SH EthnicGroup 1 dicom98 (0010,2180) SH Occupation 1 dicom98 (0010,21A0) CS SmokingStatus 1 dicom98 (0010,21B0) LT AdditionalPatientHistory 1 dicom98 (0010,21C0) US PregnancyStatus 1 dicom98 (0010,21D0) DA LastMenstrualDate 1 dicom98 (0010,21F0) LO PatientsReligiousPreference 1 dicom98 (0010,4000) LT PatientComments 1 dicom98 (0010,9431) FL ExaminedBodyThickness 1 dicom2005 (0012,0000) UL ClinicalTrialGroupLength 1 dicom2005 (0012,0010) LO ClinicalTrialSponsorName 1 dicom2003 (0012,0020) LO ClinicalTrialProtocolID 1 dicom2003 (0012,0021) LO ClinicalTrialProtocolName 1 dicom2003 (0012,0030) LO ClinicalTrialSiteID 1 dicom2003 (0012,0031) LO ClinicalTrialSiteName 1 dicom2003 (0012,0040) LO ClinicalTrialSubjectID 1 dicom2003 (0012,0042) LO ClinicalTrialSubjectReadingID 1 dicom2003 (0012,0050) LO ClinicalTrialTimePointID 1 dicom2003 (0012,0051) ST ClinicalTrialTimePointDescription 1 dicom2003 (0012,0060) LO ClinicalTrialCoordinatingCenterName 1 dicom2003 (0012,0062) CS PatientIdentifyRemoved 1 dicom2005 (0012,0063) LO DeIdentificationMethod 1-n dicom2005 (0012,0064) SQ DeIdentificationMethodCodeSequence 1 dicom2005 (0018,0000) UL AcquisitionGroupLength 1 dicom98 (0018,0010) LO ContrastBolusAgent 1 dicom98 (0018,0012) SQ ContrastBolusAgentSequence 1 dicom98 (0018,0014) SQ ContrastBolusAdministrationRouteSequence 1 dicom98 (0018,0015) CS BodyPartExamined 1 dicom98 (0018,0020) CS ScanningSequence 1-n dicom98 (0018,0021) CS SequenceVariant 1-n dicom98 (0018,0022) CS ScanOptions 1-n dicom98 (0018,0023) CS MRAcquisitionType 1 dicom98 (0018,0024) SH SequenceName 1 dicom98 (0018,0025) CS AngioFlag 1 dicom98 (0018,0026) SQ InterventionDrugInformationSequence 1 dicom98 (0018,0027) TM InterventionDrugStopTime 1 dicom98 (0018,0028) DS InterventionDrugDose 1 dicom98 (0018,0029) SQ InterventionDrugCodeSequence 1 dicom98 (0018,002A) SQ AdditionalDrugSequence 1 dicom98 # VM of (0018,0031) Radiopharmaceutical was 1-n in DICOM93. Changed in DICOM96 (Supplement 7). (0018,0031) LO Radiopharmaceutical 1 dicom98 (0018,0034) LO InterventionDrugName 1 dicom98 (0018,0035) TM InterventionDrugStartTime 1 dicom98 # was InterventionalTherapySequence prior to CP 159 (0018,0036) SQ InterventionSequence 1 dicom2004 (0018,0038) CS InterventionalStatus 1 dicom98 (0018,003A) ST InterventionDescription 1 dicom2004 (0018,0040) IS CineRate 1 dicom98 (0018,0050) DS SliceThickness 1 dicom98 (0018,0060) DS KVP 1 dicom98 (0018,0070) IS CountsAccumulated 1 dicom98 (0018,0071) CS AcquisitionTerminationCondition 1 dicom98 # was named EffectiveSeriesDuration prior to CP 316 (DICOM 2003) (0018,0072) DS EffectiveDuration 1 dicom98 (0018,0073) CS AcquisitionStartCondition 1 dicom98 (0018,0074) IS AcquisitionStartConditionData 1 dicom98 (0018,0075) IS AcquisitionTerminationConditionData 1 dicom98 (0018,0080) DS RepetitionTime 1 dicom98 (0018,0081) DS EchoTime 1 dicom98 (0018,0082) DS InversionTime 1 dicom98 (0018,0083) DS NumberOfAverages 1 dicom98 (0018,0084) DS ImagingFrequency 1 dicom98 (0018,0085) SH ImagedNucleus 1 dicom98 (0018,0086) IS EchoNumbers 1-n dicom98 (0018,0087) DS MagneticFieldStrength 1 dicom98 (0018,0088) DS SpacingBetweenSlices 1 dicom98 (0018,0089) IS NumberOfPhaseEncodingSteps 1 dicom98 (0018,0090) DS DataCollectionDiameter 1 dicom98 (0018,0091) IS EchoTrainLength 1 dicom98 (0018,0093) DS PercentSampling 1 dicom98 (0018,0094) DS PercentPhaseFieldOfView 1 dicom98 (0018,0095) DS PixelBandwidth 1 dicom98 (0018,1000) LO DeviceSerialNumber 1 dicom98 (0018,1002) UI DeviceUID 1 dicom2005 (0018,1004) LO PlateID 1 dicom98 (0018,1010) LO SecondaryCaptureDeviceID 1 dicom98 (0018,1011) LO HardcopyCreationDeviceID 1 dicom98 (0018,1012) DA DateOfSecondaryCapture 1 dicom98 (0018,1014) TM TimeOfSecondaryCapture 1 dicom98 (0018,1016) LO SecondaryCaptureDeviceManufacturer 1 dicom98 (0018,1017) LO HardcopyDeviceManufacturer 1 dicom98 (0018,1018) LO SecondaryCaptureDeviceManufacturersModelName 1 dicom98 (0018,1019) LO SecondaryCaptureDeviceSoftwareVersions 1-n dicom98 (0018,101A) LO HardcopyDeviceSoftwareVersion 1-n dicom98 (0018,101B) LO HardcopyDeviceManufacturersModelName 1 dicom98 (0018,1020) LO SoftwareVersions 1-n dicom98 (0018,1022) SH VideoImageFormatAcquired 1 dicom98 (0018,1023) LO DigitalImageFormatAcquired 1 dicom98 (0018,1030) LO ProtocolName 1 dicom98 (0018,1040) LO ContrastBolusRoute 1 dicom98 (0018,1041) DS ContrastBolusVolume 1 dicom98 (0018,1042) TM ContrastBolusStartTime 1 dicom98 (0018,1043) TM ContrastBolusStopTime 1 dicom98 (0018,1044) DS ContrastBolusTotalDose 1 dicom98 # VM of (0018,1045) SyringeCounts was 1-n in DICOM93. Changed in DICOM96 (Supplement 7). (0018,1045) IS SyringeCounts 1 dicom98 # name for (0018,1046) was ContrastFlowRates, changed in DICOM 2004 (0018,1046) DS ContrastFlowRate 1-n dicom2004 # name for (0018,1047) was ContrastFlowDurations, changed in DICOM 2004 (0018,1047) DS ContrastFlowDuration 1-n dicom2004 (0018,1048) CS ContrastBolusIngredient 1 dicom98 (0018,1049) DS ContrastBolusIngredientConcentration 1 dicom98 (0018,1050) DS SpatialResolution 1 dicom98 (0018,1060) DS TriggerTime 1 dicom98 (0018,1061) LO TriggerSourceOrType 1 dicom98 (0018,1062) IS NominalInterval 1 dicom98 (0018,1063) DS FrameTime 1 dicom98 (0018,1064) LO FramingType 1 dicom98 (0018,1065) DS FrameTimeVector 1-n dicom98 (0018,1066) DS FrameDelay 1 dicom98 (0018,1067) DS ImageTriggerDelay 1 dicom2000 (0018,1068) DS MultiplexGroupTimeOffset 1 dicom2000 (0018,1069) DS TriggerTimeOffset 1 dicom2000 (0018,106A) CS SynchronizationTrigger 1 dicom2000 (0018,106C) US SynchronizationChannel 2 dicom2000 (0018,106E) UL TriggerSamplePosition 1 dicom2000 # (0018,1070) RadiopharmaceuticalRoute was named RadionucleideRoute VM=1-n in DICOM93. Changed in DICOM96 (Supplement 7). (0018,1070) LO RadiopharmaceuticalRoute 1 dicom98 # (0018,1071) RadiopharmaceuticalVolume was named RadionucleideVolume VM=1-n in DICOM93. Changed in DICOM96 (Supplement 7). (0018,1071) DS RadiopharmaceuticalVolume 1 dicom98 # (0018,1072) RadiopharmaceuticalStartTime was named RadionucleideStartTime VM=1-n in DICOM93. Changed in DICOM96 (Supplement 7). (0018,1072) TM RadiopharmaceuticalStartTime 1 dicom98 # (0018,1073) RadiopharmaceuticalStopTime was named RadionucleideStopTime VM=1-n in DICOM93. Changed in DICOM96 (Supplement 7). (0018,1073) TM RadiopharmaceuticalStopTime 1 dicom98 # (0018,1074) RadionuclideTotalDose was VM=1-n in DICOM93. Changed in DICOM96 (Supplement 7). (0018,1074) DS RadionuclideTotalDose 1 dicom98 (0018,1075) DS RadionuclideHalfLife 1 dicom98 (0018,1076) DS RadionuclidePositronFraction 1 dicom98 (0018,1077) DS RadiopharmaceuticalSpecificActivity 1 dicom98 (0018,1078) DT RadiopharmaceuticalStartDatetime 1 dicom2005 (0018,1079) DT RadiopharmaceuticalStopDatetime 1 dicom2005 (0018,1080) CS BeatRejectionFlag 1 dicom98 (0018,1081) IS LowRRValue 1 dicom98 (0018,1082) IS HighRRValue 1 dicom98 (0018,1083) IS IntervalsAcquired 1 dicom98 (0018,1084) IS IntervalsRejected 1 dicom98 (0018,1085) LO PVCRejection 1 dicom98 (0018,1086) IS SkipBeats 1 dicom98 (0018,1088) IS HeartRate 1 dicom98 (0018,1090) IS CardiacNumberOfImages 1 dicom98 (0018,1094) IS TriggerWindow 1 dicom98 (0018,1100) DS ReconstructionDiameter 1 dicom98 (0018,1110) DS DistanceSourceToDetector 1 dicom98 (0018,1111) DS DistanceSourceToPatient 1 dicom98 (0018,1114) DS EstimatedRadiographicMagnificationFactor 1 dicom98 (0018,1120) DS GantryDetectorTilt 1 dicom98 (0018,1121) DS GantryDetectorSlew 1 dicom98 (0018,1130) DS TableHeight 1 dicom98 (0018,1131) DS TableTraverse 1 dicom98 (0018,1134) CS TableMotion 1 dicom98 (0018,1135) DS TableVerticalIncrement 1-n dicom98 (0018,1136) DS TableLateralIncrement 1-n dicom98 (0018,1137) DS TableLongitudinalIncrement 1-n dicom98 (0018,1138) DS TableAngle 1 dicom98 (0018,113A) CS TableType 1 dicom99 (0018,1140) CS RotationDirection 1 dicom98 (0018,1141) DS AngularPosition 1 dicom98 (0018,1142) DS RadialPosition 1-n dicom98 (0018,1143) DS ScanArc 1 dicom98 (0018,1144) DS AngularStep 1 dicom98 (0018,1145) DS CenterOfRotationOffset 1 dicom98 (0018,1147) CS FieldOfViewShape 1 dicom98 (0018,1149) IS FieldOfViewDimensions 1-2 dicom98 (0018,1150) IS ExposureTime 1 dicom98 (0018,1151) IS XRayTubeCurrent 1 dicom98 (0018,1152) IS Exposure 1 dicom98 (0018,1153) IS ExposureInMicroAs 1 dicom98 (0018,1154) DS AveragePulseWidth 1 dicom98 (0018,1155) CS RadiationSetting 1 dicom98 (0018,1156) CS RectificationType 1 dicom99 (0018,115A) CS RadiationMode 1 dicom98 # Name was ImageAreaDoseProduct. Changed in DICOM 2005 (Supplement 83). (0018,115E) DS ImageAndFluoroscopyAreaDoseProduct 1 dicom2005 (0018,1160) SH FilterType 1 dicom98 (0018,1161) LO TypeOfFilters 1-n dicom98 (0018,1162) DS IntensifierSize 1 dicom98 (0018,1164) DS ImagerPixelSpacing 2 dicom98 # VM changed in CP 228, was 1 before (0018,1166) CS Grid 1-n dicom2001 (0018,1170) IS GeneratorPower 1 dicom98 (0018,1180) SH CollimatorGridName 1 dicom98 (0018,1181) CS CollimatorType 1 dicom98 # VM for (0018,1182) FocalDistance was 1 in DICOM93. Changed in DICOM96 (Supplement 7). (0018,1182) IS FocalDistance 1-2 dicom98 # VM for (0018,1183) XFocusCenter was 1 in DICOM93. Changed in DICOM96 (Supplement 7). (0018,1183) DS XFocusCenter 1-2 dicom98 # VM for (0018,1184) YFocusCenter was 1 in DICOM93. Changed in DICOM96 (Supplement 7). (0018,1184) DS YFocusCenter 1-2 dicom98 (0018,1190) DS FocalSpots 1-n dicom98 (0018,1191) CS AnodeTargetMaterial 1 dicom99 (0018,11A0) DS BodyPartThickness 1 dicom99 (0018,11A2) DS CompressionForce 1 dicom99 (0018,1200) DA DateOfLastCalibration 1-n dicom98 (0018,1201) TM TimeOfLastCalibration 1-n dicom98 (0018,1210) SH ConvolutionKernel 1-n dicom98 (0018,1242) IS ActualFrameDuration 1 dicom98 (0018,1243) IS CountRate 1 dicom98 (0018,1244) US PreferredPlaybackSequencing 1 dicom98 # Name was ReceivingCoil, renamed in Supplement 49 (0018,1250) SH ReceiveCoilName 1 dicom2003 # Name was TransmittingCoil, renamed in Supplement 49 (0018,1251) SH TransmitCoilName 1 dicom2003 (0018,1260) SH PlateType 1 dicom98 (0018,1261) LO PhosphorType 1 dicom98 # VR for (0018,1300) ScanVelocity was IS in DICOM93. Changed in DICOM96 (Supplement 7). (0018,1300) DS ScanVelocity 1 dicom98 (0018,1301) CS WholeBodyTechnique 1-n dicom98 (0018,1302) IS ScanLength 1 dicom98 (0018,1310) US AcquisitionMatrix 4 dicom98 (0018,1312) CS InPlanePhaseEncodingDirection 1 dicom98 (0018,1314) DS FlipAngle 1 dicom98 (0018,1315) CS VariableFlipAngleFlag 1 dicom98 (0018,1316) DS SAR 1 dicom98 (0018,1318) DS dBdt 1 dicom98 (0018,1400) LO AcquisitionDeviceProcessingDescription 1 dicom98 (0018,1401) LO AcquisitionDeviceProcessingCode 1 dicom98 (0018,1402) CS CassetteOrientation 1 dicom98 (0018,1403) CS CassetteSize 1 dicom98 (0018,1404) US ExposuresOnPlate 1 dicom98 (0018,1405) IS RelativeXRayExposure 1 dicom98 # VR of ColumnAngulation was CS in DICOM98. Changed in CP 279. (0018,1450) DS ColumnAngulation 1 dicom2003 (0018,1460) DS TomoLayerHeight 1 dicom98 (0018,1470) DS TomoAngle 1 dicom98 (0018,1480) DS TomoTime 1 dicom98 (0018,1490) CS TomoType 1 dicom99 (0018,1491) CS TomoClass 1 dicom99 (0018,1495) IS NumberOfTomosynthesisSourceImages 1 dicom99 (0018,1500) CS PositionerMotion 1 dicom98 (0018,1508) CS PositionerType 1 dicom99 (0018,1510) DS PositionerPrimaryAngle 1 dicom98 (0018,1511) DS PositionerSecondaryAngle 1 dicom98 (0018,1520) DS PositionerPrimaryAngleIncrement 1-n dicom98 (0018,1521) DS PositionerSecondaryAngleIncrement 1-n dicom98 (0018,1530) DS DetectorPrimaryAngle 1 dicom98 (0018,1531) DS DetectorSecondaryAngle 1 dicom98 # VM for (0018,1600) ShutterShape was 1 in DICOM93. Changed in DICOM96 (Supplement 7). (0018,1600) CS ShutterShape 1-3 dicom98 (0018,1602) IS ShutterLeftVerticalEdge 1 dicom98 (0018,1604) IS ShutterRightVerticalEdge 1 dicom98 (0018,1606) IS ShutterUpperHorizontalEdge 1 dicom98 (0018,1608) IS ShutterLowerHorizontalEdge 1 dicom98 (0018,1610) IS CenterOfCircularShutter 2 dicom98 (0018,1612) IS RadiusOfCircularShutter 1 dicom98 (0018,1620) IS VerticesOfThePolygonalShutter 2-2n dicom98 (0018,1622) US ShutterPresentationValue 1 dicom2000 (0018,1623) US ShutterOverlayGroup 1 dicom2000 (0018,1624) US ShutterPresentationColorCIELabValue 3 dicom2005 (0018,1700) CS CollimatorShape 1-3 dicom98 (0018,1702) IS CollimatorLeftVerticalEdge 1 dicom98 (0018,1704) IS CollimatorRightVerticalEdge 1 dicom98 (0018,1706) IS CollimatorUpperHorizontalEdge 1 dicom98 (0018,1708) IS CollimatorLowerHorizontalEdge 1 dicom98 (0018,1710) IS CenterOfCircularCollimator 2 dicom98 (0018,1712) IS RadiusOfCircularCollimator 1 dicom98 (0018,1720) IS VerticesOfThePolygonalCollimator 2-2n dicom98 (0018,1800) CS AcquisitionTimeSynchronized 1 dicom2000 (0018,1801) SH TimeSource 1 dicom2000 (0018,1802) CS TimeDistributionProtocol 1 dicom2000 (0018,1803) LO NTPSourceAddress 1 dicom2004 (0018,2001) IS PageNumberVector 1-n dicom2001 (0018,2002) SH FrameLabelVector 1-n dicom2001 (0018,2003) DS FramePrimaryAngleVector 1-n dicom2001 (0018,2004) DS FrameSecondaryAngleVector 1-n dicom2001 (0018,2005) DS SliceLocationVector 1-n dicom2001 (0018,2006) SH DisplayWindowLabelVector 1-n dicom2001 (0018,2010) DS NominalScannedPixelSpacing 2 dicom2001 (0018,2020) CS DigitizingDeviceTransportDirection 1 dicom2001 (0018,2030) DS RotationOfScannedFilm 1 dicom2001 (0018,3100) CS IVUSAcquisition 1 dicom2001 (0018,3101) DS IVUSPullbackRate 1 dicom2001 (0018,3102) DS IVUSGatedRate 1 dicom2001 (0018,3103) IS IVUSPullbackStartFrameNumber 1 dicom2001 (0018,3104) IS IVUSPullbackStopFrameNumber 1 dicom2001 (0018,3105) IS LesionNumber 1-n dicom2001 (0018,5000) SH OutputPower 1-n dicom98 (0018,5010) LO TransducerData 3 dicom98 (0018,5012) DS FocusDepth 1 dicom98 (0018,5020) LO ProcessingFunction 1 dicom98 (0018,5021) LO PostprocessingFunction 1 dicom98 (0018,5022) DS MechanicalIndex 1 dicom98 # was ThermalIndex, renamed in CP 320 (dicom2003) (0018,5024) DS BoneThermalIndex 1 dicom98 (0018,5026) DS CranialThermalIndex 1 dicom98 (0018,5027) DS SoftTissueThermalIndex 1 dicom98 (0018,5028) DS SoftTissueFocusThermalIndex 1 dicom98 (0018,5029) DS SoftTissueSurfaceThermalIndex 1 dicom98 (0018,5050) IS DepthOfScanField 1 dicom98 (0018,5100) CS PatientPosition 1 dicom98 (0018,5101) CS ViewPosition 1 dicom98 (0018,5104) SQ ProjectionEponymousNameCodeSequence 1 dicom99 (0018,6000) DS Sensitivity 1 dicom98 (0018,6011) SQ SequenceOfUltrasoundRegions 1 dicom98 (0018,6012) US RegionSpatialFormat 1 dicom98 (0018,6014) US RegionDataType 1 dicom98 (0018,6016) UL RegionFlags 1 dicom98 (0018,6018) UL RegionLocationMinX0 1 dicom98 (0018,601A) UL RegionLocationMinY0 1 dicom98 (0018,601C) UL RegionLocationMaxX1 1 dicom98 (0018,601E) UL RegionLocationMaxY1 1 dicom98 (0018,6020) SL ReferencePixelX0 1 dicom98 (0018,6022) SL ReferencePixelY0 1 dicom98 (0018,6024) US PhysicalUnitsXDirection 1 dicom98 (0018,6026) US PhysicalUnitsYDirection 1 dicom98 (0018,6028) FD ReferencePixelPhysicalValueX 1 dicom98 (0018,602A) FD ReferencePixelPhysicalValueY 1 dicom98 (0018,602C) FD PhysicalDeltaX 1 dicom98 (0018,602E) FD PhysicalDeltaY 1 dicom98 (0018,6030) UL TransducerFrequency 1 dicom98 (0018,6031) CS TransducerType 1 dicom98 (0018,6032) UL PulseRepetitionFrequency 1 dicom98 (0018,6034) FD DopplerCorrectionAngle 1 dicom98 (0018,6036) FD SteeringAngle 1 dicom98 (0018,6039) SL DopplerSampleVolumeXPosition 1 dicom2003 (0018,603B) SL DopplerSampleVolumeYPosition 1 dicom2003 (0018,603D) SL TMLinePositionX0 1 dicom2003 (0018,603F) SL TMLinePositionY0 1 dicom2003 (0018,6041) SL TMLinePositionX1 1 dicom2003 (0018,6043) SL TMLinePositionY1 1 dicom2003 (0018,6044) US PixelComponentOrganization 1 dicom98 (0018,6046) UL PixelComponentMask 1 dicom98 (0018,6048) UL PixelComponentRangeStart 1 dicom98 (0018,604A) UL PixelComponentRangeStop 1 dicom98 (0018,604C) US PixelComponentPhysicalUnits 1 dicom98 (0018,604E) US PixelComponentDataType 1 dicom98 (0018,6050) UL NumberOfTableBreakPoints 1 dicom98 (0018,6052) UL TableOfXBreakPoints 1-n dicom98 (0018,6054) FD TableOfYBreakPoints 1-n dicom98 (0018,6056) UL NumberOfTableEntries 1 dicom98 (0018,6058) UL TableOfPixelValues 1-n dicom98 (0018,605A) FL TableOfParameterValues 1-n dicom98 (0018,6060) FL RWaveTimeVector 1-n dicom2004 (0018,7000) CS DetectorConditionsNominalFlag 1 dicom99 (0018,7001) DS DetectorTemperature 1 dicom99 (0018,7004) CS DetectorType 1 dicom99 (0018,7005) CS DetectorConfiguration 1 dicom99 (0018,7006) LT DetectorDescription 1 dicom99 (0018,7008) LT DetectorMode 1 dicom99 (0018,700A) SH DetectorID 1 dicom99 (0018,700C) DA DateOfLastDetectorCalibration 1 dicom99 (0018,700E) TM TimeOfLastDetectorCalibration 1 dicom99 (0018,7010) IS ExposuresOnDetectorSinceLastCalibration 1 dicom99 (0018,7011) IS ExposuresOnDetectorSinceManufactured 1 dicom99 (0018,7012) DS DetectorTimeSinceLastExposure 1 dicom99 (0018,7014) DS DetectorActiveTime 1 dicom99 (0018,7016) DS DetectorActivationOffsetFromExposure 1 dicom99 (0018,701A) DS DetectorBinning 2 dicom99 (0018,7020) DS DetectorElementPhysicalSize 2 dicom99 (0018,7022) DS DetectorElementSpacing 2 dicom99 (0018,7024) CS DetectorActiveShape 1 dicom99 (0018,7026) DS DetectorActiveDimensions 1-2 dicom99 (0018,7028) DS DetectorActiveOrigin 2 dicom99 (0018,702A) LO DetectorManufacturerName 1 dicom2004 (0018,702B) LO DetectorManufacturersModelName 1 dicom2004 (0018,7030) DS FieldOfViewOrigin 2 dicom99 (0018,7032) DS FieldOfViewRotation 1 dicom99 (0018,7034) CS FieldOfViewHorizontalFlip 1 dicom99 (0018,7040) LT GridAbsorbingMaterial 1 dicom99 (0018,7041) LT GridSpacingMaterial 1 dicom99 (0018,7042) DS GridThickness 1 dicom99 (0018,7044) DS GridPitch 1 dicom99 (0018,7046) IS GridAspectRatio 2 dicom99 (0018,7048) DS GridPeriod 1 dicom99 (0018,704C) DS GridFocalDistance 1 dicom99 # VR of (0018,7050) FilterMaterial was LT 1-n (which is not possible) in dicom99. # Changed in dicom2000 (CP 187). (0018,7050) CS FilterMaterial 1-n dicom2000 (0018,7052) DS FilterThicknessMinimum 1-n dicom99 (0018,7054) DS FilterThicknessMaximum 1-n dicom99 (0018,7060) CS ExposureControlMode 1 dicom99 (0018,7062) LT ExposureControlModeDescription 1 dicom99 (0018,7064) CS ExposureStatus 1 dicom99 (0018,7065) DS PhototimerSetting 1 dicom99 (0018,8150) DS ExposureTimeInMicroS 1 dicom2000 (0018,8151) DS XRayTubeCurrentInMicroA 1 dicom2000 (0018,9004) CS ContentQualification 1 dicom2003 (0018,9005) SH PulseSequenceName 1 dicom2003 (0018,9006) SQ MRImagingModifierSequence 1 dicom2003 (0018,9008) CS EchoPulseSequence 1 dicom2003 (0018,9009) CS InversionRecovery 1 dicom2003 (0018,9010) CS FlowCompensation 1 dicom2003 (0018,9011) CS MultipleSpinEcho 1 dicom2003 (0018,9012) CS MultiPlanarExcitation 1 dicom2003 (0018,9014) CS PhaseContrast 1 dicom2003 (0018,9015) CS TimeOfFlightContrast 1 dicom2003 (0018,9016) CS Spoiling 1 dicom2003 (0018,9017) CS SteadyStatePulseSequence 1 dicom2003 (0018,9018) CS EchoPlanarPulseSequence 1 dicom2003 (0018,9019) FD TagAngleFirstAxis 1 dicom2003 (0018,9020) CS MagnetizationTransfer 1 dicom2003 (0018,9021) CS T2Preparation 1 dicom2003 (0018,9022) CS BloodSignalNulling 1 dicom2003 (0018,9024) CS SaturationRecovery 1 dicom2003 (0018,9025) CS SpectrallySelectedSuppression 1 dicom2003 (0018,9026) CS SpectrallySelectedExcitation 1 dicom2003 (0018,9027) CS SpatialPreSaturation 1 dicom2003 (0018,9028) CS Tagging 1 dicom2003 (0018,9029) CS OversamplingPhase 1 dicom2003 (0018,9030) FD TagSpacingFirstDimension 1 dicom2003 (0018,9032) CS GeometryOfKSpaceTraversal 1 dicom2003 (0018,9033) CS SegmentedKSpaceTraversal 1 dicom2003 (0018,9034) CS RectilinearPhaseEncodeReordering 1 dicom2003 (0018,9035) FD TagThickness 1 dicom2003 (0018,9036) CS PartialFourierDirection 1 dicom2003 (0018,9037) CS CardiacSynchronizationTechnique 1 dicom2003 (0018,9041) LO ReceiveCoilManufacturerName 1 dicom2003 (0018,9042) SQ MRReceiveCoilSequence 1 dicom2003 (0018,9043) CS ReceiveCoilType 1 dicom2003 (0018,9044) CS QuadratureReceiveCoil 1 dicom2003 (0018,9045) SQ MultiCoilDefinitionSequence 1 dicom2003 (0018,9046) LO MultiCoilConfiguration 1 dicom2003 (0018,9047) SH MultiCoilElementName 1 dicom2003 (0018,9048) CS MultiCoilElementUsed 1 dicom2003 (0018,9049) SQ MRTransmitCoilSequence 1 dicom2003 (0018,9050) LO TransmitCoilManufacturerName 1 dicom2003 (0018,9051) CS TransmitCoilType 1 dicom2003 (0018,9052) FD SpectralWidth 1-2 dicom2003 (0018,9053) FD ChemicalShiftReference 1-2 dicom2003 (0018,9054) CS VolumeLocalizationTechnique 1 dicom2003 (0018,9058) US MRAcquisitionFrequencyEncodingSteps 1 dicom2003 (0018,9059) CS Decoupling 1 dicom2003 (0018,9060) CS DecoupledNucleus 1-2 dicom2003 (0018,9061) FD DecouplingFrequency 1-2 dicom2003 (0018,9062) CS DecouplingMethod 1 dicom2003 (0018,9063) FD DecouplingChemicalShiftReference 1-2 dicom2003 (0018,9064) CS KSpaceFiltering 1 dicom2003 (0018,9065) CS TimeDomainFiltering 1-2 dicom2003 (0018,9066) US NumberOfZeroFills 1-2 dicom2003 (0018,9067) CS BaselineCorrection 1 dicom2003 (0018,9069) FD ParallelReductionFactorInPlane 1 dicom2003 (0018,9070) FD CardiacRRIntervalSpecified 1 dicom2003 (0018,9073) FD AcquisitionDuration 1 dicom2003 (0018,9074) DT FrameAcquisitionDatetime 1 dicom2003 (0018,9075) CS DiffusionDirectionality 1 dicom2003 (0018,9076) SQ DiffusionGradientDirectionSequence 1 dicom2003 (0018,9077) CS ParallelAcquisition 1 dicom2003 (0018,9078) CS ParallelAcquisitionTechnique 1 dicom2003 (0018,9079) FD InversionTimes 1-n dicom2003 (0018,9080) ST MetaboliteMapDescription 1 dicom2003 (0018,9081) CS PartialFourier 1 dicom2003 (0018,9082) FD EffectiveEchoTime 1 dicom2003 (0018,9083) SQ MetaboliteMapCodeSequence 1 dicom2004 (0018,9084) SQ ChemicalShiftSequence 1 dicom2003 (0018,9085) CS CardiacSignalSource 1 dicom2003 (0018,9087) FD DiffusionBValue 1 dicom2003 (0018,9089) FD DiffusionGradientOrientation 3 dicom2003 (0018,9090) FD VelocityEncodingDirection 3 dicom2003 (0018,9091) FD VelocityEncodingMinimumValue 1 dicom2003 (0018,9093) US NumberOfKSpaceTrajectories 1 dicom2003 (0018,9094) CS CoverageOfKSpace 1 dicom2003 (0018,9095) UL SpectroscopyAcquisitionPhaseRows 1 dicom2003 (0018,9098) FD TransmitterFrequency 1-2 dicom2003 (0018,9100) CS ResonantNucleus 1-2 dicom2003 (0018,9101) CS FrequencyCorrection 1 dicom2003 (0018,9103) SQ MRSpectroscopyFOVGeometrySequence 1 dicom2003 (0018,9104) FD SlabThickness 1 dicom2003 (0018,9105) FD SlabOrientation 3 dicom2003 (0018,9106) FD MidSlabPosition 3 dicom2003 (0018,9107) SQ MRSpatialSaturationSequence 1 dicom2003 (0018,9112) SQ MRTimingAndRelatedParametersSequence 1 dicom2003 (0018,9114) SQ MREchoSequence 1 dicom2003 (0018,9115) SQ MRModifierSequence 1 dicom2003 (0018,9117) SQ MRDiffusionSequence 1 dicom2003 (0018,9118) SQ CardiacTriggerSequence 1 dicom2003 (0018,9119) SQ MRAveragesSequence 1 dicom2003 (0018,9125) SQ MRFOVGeometrySequence 1 dicom2003 (0018,9126) SQ VolumeLocalizationSequence 1 dicom2003 (0018,9127) UL SpectroscopyAcquisitionDataColumns 1 dicom2003 (0018,9147) CS DiffusionAnisotropyType 1 dicom2003 (0018,9151) DT FrameReferenceDatetime 1 dicom2003 (0018,9152) SQ MRMetaboliteMapSequence 1 dicom2003 (0018,9155) FD ParallelReductionFactorOutOfPlane 1 dicom2003 (0018,9159) UL SpectroscopyAcquisitionOutOfPlanePhaseSteps 1 dicom2003 (0018,9166) CS BulkMotionStatus 1 dicom2003 (0018,9168) FD ParallelReductionFactorSecondInPlane 1 dicom2003 (0018,9169) CS CardiacBeatRejectionTechnique 1 dicom2003 (0018,9170) CS RespiratoryMotionCompensationTechnique 1 dicom2003 (0018,9171) CS RespiratorySignalSource 1 dicom2003 (0018,9172) CS BulkMotionCompensationTechnique 1 dicom2003 (0018,9173) CS BulkMotionSignalSource 1 dicom2003 (0018,9174) CS ApplicableSafetyStandardAgency 1 dicom2003 (0018,9175) LO ApplicableSafetyStandardDescription 1 dicom2003 (0018,9176) SQ OperatingModeSequence 1 dicom2003 (0018,9177) CS OperatingModeType 1 dicom2003 (0018,9178) CS OperationMode 1 dicom2003 (0018,9179) CS SpecificAbsorptionRateDefinition 1 dicom2003 (0018,9180) CS GradientOutputType 1 dicom2003 (0018,9181) FD SpecificAbsorptionRateValue 1 dicom2003 (0018,9182) FD GradientOutput 1 dicom2003 (0018,9183) CS FlowCompensationDirection 1 dicom2003 (0018,9184) FD TaggingDelay 1 dicom2003 (0018,9197) SQ MRVelocityEncodingSequence 1 dicom2003 (0018,9198) CS FirstOrderPhaseCorrection 1 dicom2003 (0018,9199) CS WaterReferencedPhaseCorrection 1 dicom2003 (0018,9200) CS MRSpectroscopyAcquisitionType 1 dicom2003 (0018,9214) CS RespiratoryCyclePosition 1 dicom2003 (0018,9217) FD VelocityEncodingMaximumValue 1 dicom2003 # VR changed from SS to FD in CP 379 (2004) (0018,9218) FD TagSpacingSecondDimension 1 dicom2004 (0018,9219) SS TagAngleSecondAxis 1 dicom2003 (0018,9220) FD FrameAcquisitionDuration 1 dicom2003 (0018,9226) SQ MRImageFrameTypeSequence 1 dicom2003 (0018,9227) SQ MRSpectroscopyFrameTypeSequence 1 dicom2003 (0018,9231) US MRAcquisitionPhaseEncodingStepsInPlane 1 dicom2003 (0018,9232) US MRAcquisitionPhaseEncodingStepsOutOfPlane 1 dicom2003 (0018,9234) UL SpectroscopyAcquisitionPhaseColumns 1 dicom2003 (0018,9236) CS CardiacCyclePosition 1 dicom2003 (0018,9239) SQ SpecificAbsorptionRateSequence 1 dicom2003 (0018,9240) US RFEchoTrainLength 1 dicom2004 (0018,9241) US GradientEchoTrainLength 1 dicom2004 (0018,9295) FD ChemicalShiftsMinimumIntegrationLimitInPpm 1 dicom2004 (0018,9296) FD ChemicalShiftsMaximumIntegrationLimitInPpm 1 dicom2004 (0018,9301) SQ CTAcquisitionTypeSequence 1 dicom2004 (0018,9302) CS AcquisitionType 1 dicom2004 (0018,9303) FD TubeAngle 1 dicom2004 (0018,9304) SQ CTAcquisitionDetailsSequence 1 dicom2004 (0018,9305) FD RevolutionTime 1 dicom2004 (0018,9306) FD SingleCollimationWidth 1 dicom2004 (0018,9307) FD TotalCollimationWidth 1 dicom2004 (0018,9308) SQ CTTableDynamicsSequence 1 dicom2004 (0018,9309) FD TableSpeed 1 dicom2004 (0018,9310) FD TableFeedPerRotation 1 dicom2004 (0018,9311) FD SpiralPitchFactor 1 dicom2004 (0018,9312) SQ CTGeometrySequence 1 dicom2004 (0018,9313) FD DataCollectionCenterPatient 3 dicom2004 (0018,9314) SQ CTReconstructionSequence 1 dicom2004 (0018,9315) CS ReconstructionAlgorithm 1 dicom2004 (0018,9316) CS ConvolutionKernelGroup 1 dicom2004 (0018,9317) FD ReconstructionFieldOfView 2 dicom2004 (0018,9318) FD ReconstructionTargetCenterPatient 3 dicom2004 (0018,9319) FD ReconstructionAngle 1 dicom2004 (0018,9320) SH ImageFilter 1 dicom2004 (0018,9321) SQ CTExposureSequence 1 dicom2004 (0018,9322) FD ReconstructionPixelSpacing 2 dicom2004 (0018,9323) CS ExposureModulationType 1 dicom2004 (0018,9324) FD EstimatedDoseSaving 1 dicom2004 (0018,9325) SQ CTXRayDetailsSequence 1 dicom2004 (0018,9326) SQ CTPositionSequence 1 dicom2004 (0018,9327) FD TablePosition 1 dicom2004 (0018,9328) FD ExposureTimeInms 1 dicom2004 (0018,9329) SQ CTImageFrameTypeSequence 1 dicom2004 (0018,9330) FD XRayTubeCurrentInmA 1 dicom2004 (0018,9332) FD ExposureInmAs 1 dicom2004 (0018,9333) CS ConstantVolumeFlag 1 dicom2004 (0018,9334) CS FluoroscopyFlag 1 dicom2004 (0018,9335) FD DistanceSourceToDataCollectionCenter 1 dicom2004 (0018,9337) US ContrastBolusAgentNumber 1 dicom2004 (0018,9338) SQ ContrastBolusIngredientCodeSequence 1 dicom2004 (0018,9340) SQ ContrastAdministrationProfileSequence 1 dicom2004 (0018,9341) SQ ContrastBolusUsageSequence 1 dicom2004 (0018,9342) CS ContrastBolusAgentAdministered 1 dicom2004 (0018,9343) CS ContrastBolusAgentDetected 1 dicom2004 (0018,9344) CS ContrastBolusAgentPhase 1 dicom2004 (0018,9345) FD CTDIvol 1 dicom2004 (0018,9401) SQ ProjectionPixelCalibrationSequence 1 dicom2005 (0018,9402) FL DistanceSourceToIsocenter 1 dicom2005 (0018,9403) FL DistanceObjectToTableTop 1 dicom2005 (0018,9404) FL ObjectPixelSpacingInCenterOfBeam 2 dicom2005 (0018,9405) SQ PositionerPositionSequence 1 dicom2005 (0018,9406) SQ TablePositionSequence 1 dicom2005 (0018,9407) SQ CollimatorShapeSequence 1 dicom2005 (0018,9412) SQ XA/XRFFrameCharacteristicsSequence 1 dicom2005 (0018,9420) CS XRayReceptorType 1 dicom2005 (0018,9423) LO AcquisitionProtocolName 1 dicom2005 (0018,9424) LT AcquisitionProtocolDescription 1 dicom2005 (0018,9425) CS Contrast/BolusIngredientOpaque 1 dicom2005 (0018,9426) FL DistanceReceptorPlaneToDetectorHousing 1 dicom2005 (0018,9427) CS IntensifierActiveShape 1 dicom2005 (0018,9428) FL IntensifierActiveDimension(s) 1-2 dicom2005 (0018,9429) FL PhysicalDetectorSize 2 dicom2005 (0018,9430) US PositionOfIsocenterProjection 2 dicom2005 (0018,9432) SQ FieldOfViewSequence 1 dicom2005 (0018,9433) LO FieldOfViewDescription 1 dicom2005 (0018,9434) SQ ExposureControlSensingRegionsSequence 1 dicom2005 (0018,9435) CS ExposureControlSensingRegionShape 1 dicom2005 (0018,9436) SS ExposureControlSensingRegionLeftVerticalEdge 1 dicom2005 (0018,9437) SS ExposureControlSensingRegionRightVerticalEdge 1 dicom2005 (0018,9438) SS ExposureControlSensingRegionUpperHorizontalEdge 1 dicom2005 (0018,9439) SS ExposureControlSensingRegionLowerHorizontalEdge 1 dicom2005 (0018,9440) SS CenterOfCircularExposureControlSensingRegion 2 dicom2005 (0018,9441) US RadiusOfCircularExposureControlSensingRegion 1 dicom2005 (0018,9442) SS VerticesOfThePolygonalExposureControlSensingRegion 2-n dicom2005 (0018,9447) FL ColumnAngulationPatient 1 dicom2005 (0018,9449) FL BeamAngle 1 dicom2005 (0018,9451) SQ FrameDetectorParametersSequence 1 dicom2005 (0018,9452) FL CalculatedAnatomyThickness 1 dicom2005 (0018,9455) SQ CalibrationSequence 1 dicom2005 (0018,9456) SQ ObjectThicknessSequence 1 dicom2005 (0018,9457) CS PlaneIdentification 1 dicom2005 (0018,9461) FL FieldOfViewDimensionsInFloat 1-2 dicom2005 (0018,9462) SQ IsocenterReferenceSystemSequence 1 dicom2005 (0018,9463) FL PositionerIsocenterPrimaryAngle 1 dicom2005 (0018,9464) FL PositionerIsocenterSecondaryAngle 1 dicom2005 (0018,9465) FL PositionerIsocenterDetectorRotationAngle 1 dicom2005 (0018,9466) FL TableXPositionToIsocenter 1 dicom2005 (0018,9467) FL TableYPositionToIsocenter 1 dicom2005 (0018,9468) FL TableZPositionToIsocenter 1 dicom2005 (0018,9469) FL TableHorizontalRotationAngle 1 dicom2005 (0018,9470) FL TableHeadTiltAngle 1 dicom2005 (0018,9471) FL TableCradleTiltAngle 1 dicom2005 (0018,9472) SQ FrameDisplayShutterSequence 1 dicom2005 (0018,9473) FL AcquiredImageAreaDoseProduct 1 dicom2005 (0018,9474) CS CArmPositionerTabletopRelationship 1 dicom2005 (0018,9476) SQ XRayGeometrySequence 1 dicom2005 (0018,9477) SQ IrradiationEventIdentificationSequence 1 dicom2005 (0018,A001) SQ ContributingEquipmentSequence 1 dicom2003 (0018,A002) DT ContributionDateTime 1 dicom2003 (0018,A003) ST ContributionDescription 1 dicom2003 (0020,0000) UL ImageGroupLength 1 dicom98 (0020,000D) UI StudyInstanceUID 1 dicom98 (0020,000E) UI SeriesInstanceUID 1 dicom98 (0020,0010) SH StudyID 1 dicom98 (0020,0011) IS SeriesNumber 1 dicom98 (0020,0012) IS AcquisitionNumber 1 dicom98 # InstanceNumber was named ImageNumber, renamed in CP 99 (09/1998) (0020,0013) IS InstanceNumber 1 dicom98 (0020,0019) IS ItemNumber 1 dicom99 (0020,0020) CS PatientOrientation 2 dicom98 (0020,0022) IS OverlayNumber 1 dicom98 (0020,0024) IS CurveNumber 1 dicom98 (0020,0026) IS LookupTableNumber 1 dicom98 (0020,0032) DS ImagePositionPatient 3 dicom98 (0020,0037) DS ImageOrientationPatient 6 dicom98 (0020,0052) UI FrameOfReferenceUID 1 dicom98 (0020,0060) CS Laterality 1 dicom98 (0020,0062) CS ImageLaterality 1 dicom99 (0020,0100) IS TemporalPositionIdentifier 1 dicom98 (0020,0105) IS NumberOfTemporalPositions 1 dicom98 (0020,0110) DS TemporalResolution 1 dicom98 (0020,0200) UI SynchronizationFrameOfReferenceUID 1 dicom2000 (0020,1000) IS SeriesInStudy 1 dicom98 (0020,1002) IS ImagesInAcquisition 1 dicom98 (0020,1004) IS AcquisitionsInStudy 1 dicom98 (0020,1040) LO PositionReferenceIndicator 1 dicom98 (0020,1041) DS SliceLocation 1 dicom98 (0020,1070) IS OtherStudyNumbers 1-n dicom98 (0020,1200) IS NumberOfPatientRelatedStudies 1 dicom98 (0020,1202) IS NumberOfPatientRelatedSeries 1 dicom98 # NumberOfPatientRelatedInstances was named NumberOfPatientRelatedImages, renamed in CP 99 (09/1998) (0020,1204) IS NumberOfPatientRelatedInstances 1 dicom98 (0020,1206) IS NumberOfStudyRelatedSeries 1 dicom98 # NumberOfStudyRelatedInstances was named NumberOfStudyRelatedImages, renamed in CP 99 (09/1998) (0020,1208) IS NumberOfStudyRelatedInstances 1 dicom98 # NumberOfSeriesRelatedInstances was named NumberOfSeriesRelatedImages, renamed in CP 99 (09/1998) (0020,1209) IS NumberOfSeriesRelatedInstances 1 dicom98 (0020,4000) LT ImageComments 1 dicom98 (0020,9056) SH StackID 1 dicom2003 (0020,9057) UL InStackPositionNumber 1 dicom2003 (0020,9071) SQ FrameAnatomySequence 1 dicom2003 (0020,9072) CS FrameLaterality 1 dicom2003 (0020,9111) SQ FrameContentSequence 1 dicom2003 (0020,9113) SQ PlanePositionSequence 1 dicom2003 (0020,9116) SQ PlaneOrientationSequence 1 dicom2003 (0020,9128) UL TemporalPositionIndex 1 dicom2003 (0020,9153) FD TriggerDelayTime 1 dicom2003 (0020,9156) US FrameAcquisitionNumber 1 dicom2003 (0020,9157) UL DimensionIndexValues 1-n dicom2003 (0020,9158) LT FrameComments 1 dicom2003 (0020,9161) UI ConcatenationUID 1 dicom2003 (0020,9162) US InConcatenationNumber 1 dicom2003 (0020,9163) US InConcatenationTotalNumber 1 dicom2003 (0020,9164) UI DimensionOrganizationUID 1 dicom2003 (0020,9165) AT DimensionIndexPointer 1 dicom2003 (0020,9167) AT FunctionalGroupPointer 1 dicom2003 (0020,9213) LO DimensionIndexPrivateCreator 1 dicom2003 (0020,9221) SQ DimensionOrganizationSequence 1 dicom2003 (0020,9222) SQ DimensionIndexSequence 1 dicom2003 (0020,9228) UL ConcatenationFrameOffsetNumber 1 dicom2003 (0020,9238) LO FunctionalGroupPrivateCreator 1 dicom2003 (0020,9421) LO DimensionDescriptionLabel 1 dicom2005 (0020,9450) SQ PatientOrientationInFrameSequence 1 dicom2005 (0020,9453) LO FrameLabel 1 dicom2005 (0022,0000) UL OphtalmologyGroupLength 1 dicom2004 (0022,0001) US LightPathFilterPass-ThroughWavelength 1 dicom2004 (0022,0002) US LightPathFilterPassBand 2 dicom2004 (0022,0003) US ImagePathFilterPass-ThroughWavelength 1 dicom2004 (0022,0004) US ImagePathFilterPassBand 2 dicom2004 (0022,0005) CS PatientEyeMovementCommanded 1 dicom2004 (0022,0006) SQ PatientEyeMovementCommandCodeSequence 1 dicom2004 (0022,0007) FL SphericalLensPower 1 dicom2004 (0022,0008) FL CylinderLensPower 1 dicom2004 (0022,0009) FL CylinderAxis 1 dicom2004 (0022,000A) FL EmmetropicMagnification 1 dicom2004 (0022,000B) FL IntraOcularPressure 1 dicom2004 (0022,000C) FL HorizontalFieldOfView 1 dicom2004 (0022,000D) CS PupilDilated 1 dicom2004 (0022,000E) FL DegreeOfDilation 1 dicom2004 (0022,0010) FL StereoBaselineAngle 1 dicom2004 (0022,0011) FL StereoBaselineDisplacement 1 dicom2004 (0022,0012) FL StereoHorizontalPixelOffset 1 dicom2004 (0022,0013) FL StereoVerticalPixelOffset 1 dicom2004 (0022,0014) FL StereoRotation 1 dicom2004 (0022,0015) SQ AcquisitionDeviceTypeCodeSequence 1 dicom2004 (0022,0016) SQ IlluminationTypeCodeSequence 1 dicom2004 (0022,0017) SQ LightPathFilterTypeStackCodeSequence 1 dicom2004 (0022,0018) SQ ImagePathFilterTypeStackCodeSequence 1 dicom2004 (0022,0019) SQ LensesCodeSequence 1 dicom2004 (0022,001A) SQ ChannelDescriptionCodeSequence 1 dicom2004 (0022,001B) SQ RefractiveStateSequence 1 dicom2004 (0022,001C) SQ MydriaticAgentCodeSequence 1 dicom2004 (0022,001D) SQ RelativeImagePositionCodeSequence 1 dicom2004 (0022,0020) SQ StereoPairsSequence 1 dicom2004 (0022,0021) SQ LeftImageSequence 1 dicom2004 (0022,0022) SQ RightImageSequence 1 dicom2004 (0028,0000) UL ImagePresentationGroupLength 1 dicom98 (0028,0002) US SamplesPerPixel 1 dicom98 (0028,0003) US SamplesPerPixelUsed 1 dicom2004 (0028,0004) CS PhotometricInterpretation 1 dicom98 (0028,0006) US PlanarConfiguration 1 dicom98 (0028,0008) IS NumberOfFrames 1 dicom98 # VM of (0028,0009) FrameIncrementPointer was 1 in DICOM93. Changed in DICOM96 (Supplement 7). (0028,0009) AT FrameIncrementPointer 1-n dicom98 (0028,000A) AT FrameDimensionPointer 1-n dicom2004 (0028,0010) US Rows 1 dicom98 (0028,0011) US Columns 1 dicom98 (0028,0012) US Planes 1 dicom98 (0028,0014) US UltrasoundColorDataPresent 1 dicom98 (0028,0030) DS PixelSpacing 2 dicom98 (0028,0031) DS ZoomFactor 2 dicom98 (0028,0032) DS ZoomCenter 2 dicom98 (0028,0034) IS PixelAspectRatio 2 dicom98 # VM of (0028,0051) CorrectedImage was 1 in DICOM93. Changed in DICOM96 (Supplement 7). (0028,0051) CS CorrectedImage 1-n dicom98 (0028,0100) US BitsAllocated 1 dicom98 (0028,0101) US BitsStored 1 dicom98 (0028,0102) US HighBit 1 dicom98 (0028,0103) US PixelRepresentation 1 dicom98 (0028,0106) xs SmallestImagePixelValue 1 dicom98 (0028,0107) xs LargestImagePixelValue 1 dicom98 (0028,0108) xs SmallestPixelValueInSeries 1 dicom98 (0028,0109) xs LargestPixelValueInSeries 1 dicom98 (0028,0110) xs SmallestImagePixelValueInPlane 1 dicom98 (0028,0111) xs LargestImagePixelValueInPlane 1 dicom98 (0028,0120) xs PixelPaddingValue 1 dicom98 (0028,0300) CS QualityControlImage 1 dicom99 (0028,0301) CS BurnedInAnnotation 1 dicom99 (0028,1040) CS PixelIntensityRelationship 1 dicom98 (0028,1041) SS PixelIntensityRelationshipSign 1 dicom99 (0028,1050) DS WindowCenter 1-n dicom98 (0028,1051) DS WindowWidth 1-n dicom98 (0028,1052) DS RescaleIntercept 1 dicom98 (0028,1053) DS RescaleSlope 1 dicom98 (0028,1054) LO RescaleType 1 dicom98 (0028,1055) LO WindowCenterWidthExplanation 1-n dicom98 (0028,1056) CS VOILUTFunction 1 dicom2005 (0028,1090) CS RecommendedViewingMode 1 dicom98 (0028,1101) xs RedPaletteColorLookupTableDescriptor 3 dicom98 (0028,1102) xs GreenPaletteColorLookupTableDescriptor 3 dicom98 (0028,1103) xs BluePaletteColorLookupTableDescriptor 3 dicom98 (0028,1199) UI PaletteColorLookupTableUID 1 dicom98 # VR for (0028,1201) RedPaletteColorLookupTableData was "US or SS" with VM=1-n in DICOM93. Changed in DICOM96 (Supplement 5). # now it is defined as US 1-n or SS 1-n or OW 1 (0028,1201) OW RedPaletteColorLookupTableData 1 dicom98 # VR for (0028,1202) GreenPaletteColorLookupTableData was "US or SS" with VM=1-n in DICOM93. Changed in DICOM96 (Supplement 5). # now it is defined as US 1-n or SS 1-n or OW 1 (0028,1202) OW GreenPaletteColorLookupTableData 1 dicom98 # VR for (0028,1203) BluePaletteColorLookupTableData was "US or SS" with VM=1-n in DICOM93. Changed in DICOM96 (Supplement 5). # now it is defined as US 1-n or SS 1-n or OW 1 (0028,1203) OW BluePaletteColorLookupTableData 1 dicom98 (0028,1221) OW SegmentedRedPaletteColorLookupTableData 1 dicom98 (0028,1222) OW SegmentedGreenPaletteColorLookupTableData 1 dicom98 (0028,1223) OW SegmentedBluePaletteColorLookupTableData 1 dicom98 (0028,1300) CS ImplantPresent 1 dicom99 (0028,1350) CS PartialView 1 dicom2000 (0028,1351) ST PartialViewDescription 1 dicom2000 (0028,1352) SQ PartialViewCodeSequence 1 dicom2005 (0028,135A) CS SpatialLocationsPreserved 1 dicom2005 (0028,2000) OB ICCProfile 1 dicom2005 (0028,2110) CS LossyImageCompression 1 dicom98 (0028,2112) DS LossyImageCompressionRatio 1-n dicom99 (0028,2114) CS LossyImageCompressionMethod 1-n dicom2004 (0028,3000) SQ ModalityLUTSequence 1 dicom98 (0028,3002) xs LUTDescriptor 3 dicom98 (0028,3003) LO LUTExplanation 1 dicom98 (0028,3004) LO ModalityLUTType 1 dicom98 # VM of (0028,3006) LUTData was US/SS in dicom93. Because US/SS does not allow to encode # LUTs with 64K entries in explicit VR, this was changed in dicom2000 (Supplement 33) # to US/SS/OW. We use a specific pseudo-VR for this case. (0028,3006) lt LUTData 1-n dicom2000 (0028,3010) SQ VOILUTSequence 1 dicom98 (0028,3110) SQ SoftcopyVOILUTSequence 1 dicom2000 (0028,5000) SQ BiPlaneAcquisitionSequence 1 dicom98 (0028,6010) US RepresentativeFrameNumber 1 dicom98 (0028,6020) US FrameNumbersOfInterestFOI 1-n dicom98 (0028,6022) LO FramesOfInterestDescription 1-n dicom98 (0028,6023) CS FrameOfInterestType 1-n dicom2004 (0028,6040) US RWavePointer 1-n dicom98 (0028,6100) SQ MaskSubtractionSequence 1 dicom98 (0028,6101) CS MaskOperation 1 dicom98 (0028,6102) US ApplicableFrameRange 2-2n dicom98 (0028,6110) US MaskFrameNumbers 1-n dicom98 (0028,6112) US ContrastFrameAveraging 1 dicom98 (0028,6114) FL MaskSubPixelShift 2 dicom98 (0028,6120) SS TIDOffset 1 dicom98 (0028,6190) ST MaskOperationExplanation 1 dicom98 (0028,9001) UL DataPointRows 1 dicom2003 (0028,9002) UL DataPointColumns 1 dicom2003 (0028,9003) CS SignalDomainColumns 1-2 dicom2003 (0028,9099) US LargestMonochromePixelValue 1 dicom2003 (0028,9108) CS DataRepresentation 1 dicom2003 (0028,9110) SQ PixelMeasuresSequence 1 dicom2003 (0028,9132) SQ FrameVOILUTSequence 1 dicom2003 (0028,9145) SQ PixelValueTransformationSequence 1 dicom2003 (0028,9235) CS SignalDomainRows 1 dicom2003 (0028,9411) FL DisplayFilterPercentage 1 dicom2005 (0028,9415) SQ FramePixelShiftSequence 1 dicom2005 (0028,9416) US SubtractionItemID 1 dicom2005 (0028,9422) SQ PixelIntensityRelationshipLUTSequence 1 dicom2005 (0028,9443) SQ FramePixelDataPropertiesSequence 1 dicom2005 (0028,9444) CS GeometricalProperties 1 dicom2005 (0028,9445) FL GeometricMaximumDistortion 1 dicom2005 (0028,9446) CS ImageProcessingApplied 1-n dicom2005 (0028,9454) CS MaskSelectionMode 1 dicom2005 (0028,9475) CS LUTFunction 1 dicom2005 (0032,0000) UL StudyGroupLength 1 dicom98 (0032,000A) CS StudyStatusID 1 dicom98 (0032,000C) CS StudyPriorityID 1 dicom98 (0032,0012) LO StudyIDIssuer 1 dicom98 (0032,0032) DA StudyVerifiedDate 1 dicom98 (0032,0033) TM StudyVerifiedTime 1 dicom98 (0032,0034) DA StudyReadDate 1 dicom98 (0032,0035) TM StudyReadTime 1 dicom98 (0032,1000) DA ScheduledStudyStartDate 1 dicom98 (0032,1001) TM ScheduledStudyStartTime 1 dicom98 (0032,1010) DA ScheduledStudyStopDate 1 dicom98 (0032,1011) TM ScheduledStudyStopTime 1 dicom98 (0032,1020) LO ScheduledStudyLocation 1 dicom98 (0032,1021) AE ScheduledStudyLocationAETitles 1-n dicom98 (0032,1030) LO ReasonForStudy 1 dicom98 (0032,1031) SQ RequestingPhysicianIdentificationSequence 1 dicom2003 (0032,1032) PN RequestingPhysician 1 dicom98 (0032,1033) LO RequestingService 1 dicom98 (0032,1040) DA StudyArrivalDate 1 dicom98 (0032,1041) TM StudyArrivalTime 1 dicom98 (0032,1050) DA StudyCompletionDate 1 dicom98 (0032,1051) TM StudyCompletionTime 1 dicom98 (0032,1055) CS StudyComponentStatusID 1 dicom98 (0032,1060) LO RequestedProcedureDescription 1 dicom98 (0032,1064) SQ RequestedProcedureCodeSequence 1 dicom98 (0032,1070) LO RequestedContrastAgent 1 dicom98 (0032,4000) LT StudyComments 1 dicom98 (0038,0000) UL VisitGroupLength 1 dicom98 (0038,0004) SQ ReferencedPatientAliasSequence 1 dicom98 (0038,0008) CS VisitStatusID 1 dicom98 (0038,0010) LO AdmissionID 1 dicom98 (0038,0011) LO IssuerOfAdmissionID 1 dicom98 (0038,0016) LO RouteOfAdmissions 1 dicom98 (0038,001A) DA ScheduledAdmissionDate 1 dicom98 (0038,001B) TM ScheduledAdmissionTime 1 dicom98 (0038,001C) DA ScheduledDischargeDate 1 dicom98 (0038,001D) TM ScheduledDischargeTime 1 dicom98 (0038,001E) LO ScheduledPatientInstitutionResidence 1 dicom98 (0038,0020) DA AdmittingDate 1 dicom98 (0038,0021) TM AdmittingTime 1 dicom98 (0038,0030) DA DischargeDate 1 dicom98 (0038,0032) TM DischargeTime 1 dicom98 (0038,0040) LO DischargeDiagnosisDescription 1 dicom98 (0038,0044) SQ DischargeDiagnosisCodeSequence 1 dicom98 (0038,0050) LO SpecialNeeds 1 dicom98 (0038,0100) SQ PertinentDocumentsSequence 1 dicom2005 (0038,0300) LO CurrentPatientLocation 1 dicom98 (0038,0400) LO PatientsInstitutionResidence 1 dicom98 (0038,0500) LO PatientState 1 dicom98 (0038,0502) SQ PatientClinicalTrialParticipationSequence 1 dicom2005 (0038,4000) LT VisitComments 1 dicom98 (003A,0000) UL WaveformGroupLength 1 dicom2000 (003A,0004) CS WaveformOriginality 1 dicom2000 (003A,0005) US NumberOfWaveformChannels 1 dicom2000 (003A,0010) UL NumberOfWaveformSamples 1 dicom2000 (003A,001A) DS SamplingFrequency 1 dicom2000 (003A,0020) SH MultiplexGroupLabel 1 dicom2000 (003A,0200) SQ ChannelDefinitionSequence 1 dicom2000 (003A,0202) IS WaveformChannelNumber 1 dicom2000 (003A,0203) SH ChannelLabel 1 dicom2000 (003A,0205) CS ChannelStatus 1-n dicom2000 (003A,0208) SQ ChannelSourceSequence 1 dicom2000 (003A,0209) SQ ChannelSourceModifiersSequence 1 dicom2000 (003A,020A) SQ SourceWaveformSequence 1 dicom2000 (003A,020C) LO ChannelDerivationDescription 1 dicom2000 (003A,0210) DS ChannelSensitivity 1 dicom2000 (003A,0211) SQ ChannelSensitivityUnitsSequence 1 dicom2000 (003A,0212) DS ChannelSensitivityCorrectionFactor 1 dicom2000 (003A,0213) DS ChannelBaseline 1 dicom2000 (003A,0214) DS ChannelTimeSkew 1 dicom2000 (003A,0215) DS ChannelSampleSkew 1 dicom2000 (003A,0218) DS ChannelOffset 1 dicom2000 (003A,021A) US WaveformBitsStored 1 dicom2000 (003A,0220) DS FilterLowFrequency 1 dicom2000 (003A,0221) DS FilterHighFrequency 1 dicom2000 (003A,0222) DS NotchFilterFrequency 1 dicom2000 (003A,0223) DS NotchFilterBandwidth 1 dicom2000 (003A,0300) SQ MultiplexedAudioChannelsDescriptionCodeSequence 1 dicom2004 (003A,0301) IS ChannelIdentificationCode 1 dicom2004 (003A,0302) CS ChannelMode 1 dicom2004 (0040,0000) UL ModalityWorklistGroupLength 1 dicom98 (0040,0001) AE ScheduledStationAETitle 1-n dicom98 (0040,0002) DA ScheduledProcedureStepStartDate 1 dicom98 (0040,0003) TM ScheduledProcedureStepStartTime 1 dicom98 (0040,0004) DA ScheduledProcedureStepEndDate 1 dicom98 (0040,0005) TM ScheduledProcedureStepEndTime 1 dicom98 (0040,0006) PN ScheduledPerformingPhysiciansName 1 dicom98 (0040,0007) LO ScheduledProcedureStepDescription 1 dicom98 # attribute renamed in CP 201, name was ScheduledActionItemCodeSequence before (0040,0008) SQ ScheduledProtocolCodeSequence 1 dicom2001 (0040,0009) SH ScheduledProcedureStepID 1 dicom98 (0040,000A) SQ StageCodeSequence 1 dicom2001 (0040,000B) SQ ScheduledPerformingPhysicianIdentificationSequence 1 dicom2003 (0040,0010) SH ScheduledStationName 1-n dicom98 (0040,0011) SH ScheduledProcedureStepLocation 1 dicom98 (0040,0012) LO PreMedication 1 dicom98 (0040,0020) CS ScheduledProcedureStepStatus 1 dicom98 (0040,0100) SQ ScheduledProcedureStepSequence 1 dicom98 # renamed in CP 243, name was ReferencedStandaloneSOPInstanceSequence before (0040,0220) SQ ReferencedNonImageCompositeSOPInstanceSequence 1 dicom2001 (0040,0241) AE PerformedStationAETitle 1 dicom98 (0040,0242) SH PerformedStationName 1 dicom98 (0040,0243) SH PerformedLocation 1 dicom98 (0040,0244) DA PerformedProcedureStepStartDate 1 dicom98 (0040,0245) TM PerformedProcedureStepStartTime 1 dicom98 (0040,0250) DA PerformedProcedureStepEndDate 1 dicom98 (0040,0251) TM PerformedProcedureStepEndTime 1 dicom98 (0040,0252) CS PerformedProcedureStepStatus 1 dicom98 # VR for (0040,0253) PerformedProcedureStepID was CS in DICOM98. Changed in DICOM99. (0040,0253) SH PerformedProcedureStepID 1 dicom99 (0040,0254) LO PerformedProcedureStepDescription 1 dicom98 (0040,0255) LO PerformedProcedureTypeDescription 1 dicom98 # attribute renamed in CP 201, name was PerformedActionItemSequence before (0040,0260) SQ PerformedProtocolCodeSequence 1 dicom2001 (0040,0270) SQ ScheduledStepAttributesSequence 1 dicom98 (0040,0275) SQ RequestAttributesSequence 1 dicom98 (0040,0280) ST CommentsOnThePerformedProcedureStep 1 dicom98 (0040,0281) SQ PerformedProcedureStepDiscontinuationReasonCodeSequence 1 dicom2003 (0040,0293) SQ QuantitySequence 1 dicom98 (0040,0294) DS Quantity 1 dicom98 (0040,0295) SQ MeasuringUnitsSequence 1 dicom98 (0040,0296) SQ BillingItemSequence 1 dicom98 (0040,0300) US TotalTimeOfFluoroscopy 1 dicom98 (0040,0301) US TotalNumberOfExposures 1 dicom98 (0040,0302) US EntranceDose 1 dicom98 (0040,0303) US ExposedArea 1-2 dicom98 (0040,0306) DS DistanceSourceToEntrance 1 dicom98 (0040,030E) SQ ExposureDoseSequence 1 dicom2001 (0040,0310) ST CommentsOnRadiationDose 1 dicom98 (0040,0312) DS XRayOutput 1 dicom99 (0040,0314) DS HalfValueLayer 1 dicom99 (0040,0316) DS OrganDose 1 dicom99 (0040,0318) CS OrganExposed 1 dicom99 (0040,0320) SQ BillingProcedureStepSequence 1 dicom98 (0040,0321) SQ FilmConsumptionSequence 1 dicom98 (0040,0324) SQ BillingSuppliesAndDevicesSequence 1 dicom98 (0040,0340) SQ PerformedSeriesSequence 1 dicom98 (0040,0400) LT CommentsOnTheScheduledProcedureStep 1 dicom98 (0040,0440) SQ ProtocolContextSequence 1 dicom2004 (0040,0441) SQ ContentItemModifierSequence 1 dicom2004 (0040,050A) LO SpecimenAccessionNumber 1 dicom2000 (0040,0550) SQ SpecimenSequence 1 dicom2000 (0040,0551) LO SpecimenIdentifier 1 dicom2000 (0040,0555) SQ AcquisitionContextSequence 1 dicom99 (0040,0556) ST AcquisitionContextDescription 1 dicom99 (0040,059A) SQ SpecimenTypeCodeSequence 1 dicom2000 (0040,06FA) LO SlideIdentifier 1 dicom99 (0040,071A) SQ ImageCenterPointCoordinatesSequence 1 dicom99 (0040,072A) DS XOffsetInSlideCoordinateSystem 1 dicom99 (0040,073A) DS YOffsetInSlideCoordinateSystem 1 dicom99 (0040,074A) DS ZOffsetInSlideCoordinateSystem 1 dicom99 (0040,08D8) SQ PixelSpacingSequence 1 dicom99 (0040,08DA) SQ CoordinateSystemAxisCodeSequence 1 dicom99 (0040,08EA) SQ MeasurementUnitsCodeSequence 1 dicom99 (0040,1001) SH RequestedProcedureID 1 dicom98 (0040,1002) LO ReasonForTheRequestedProcedure 1 dicom98 (0040,1003) SH RequestedProcedurePriority 1 dicom98 (0040,1004) LO PatientTransportArrangements 1 dicom98 (0040,1005) LO RequestedProcedureLocation 1 dicom98 (0040,1006) SH PlacerOrderNumberProcedure 1 dicom98 (0040,1007) SH FillerOrderNumberProcedure 1 dicom98 (0040,1008) LO ConfidentialityCode 1 dicom98 (0040,1009) SH ReportingPriority 1 dicom98 (0040,100A) SQ ReasonForRequestedProcedureCodeSequence 1 dicom2004 (0040,1010) PN NamesOfIntendedRecipientsOfResults 1-n dicom98 (0040,1011) SQ IntendedRecipientsOfResultsIdentificationSequence 1 dicom2003 (0040,1101) SQ PersonIdentificationCodeSequence 1 dicom2003 (0040,1102) ST PersonsAddress 1 dicom2003 (0040,1103) LO PersonsTelephoneNumbers 1-n dicom2003 (0040,1400) LT RequestedProcedureComments 1 dicom98 # Attribute renamed in CP 241, name was IssueDateOfImagingServiceRequest before (0040,2004) DA IssueDateOfImagingServiceRequest 1 dicom2001 # Attribute renamed in CP 241, name was IssueTimeOfImagingServiceRequest before (0040,2005) TM IssueTimeOfImagingServiceRequest 1 dicom2001 (0040,2008) PN OrderEnteredBy 1 dicom98 (0040,2009) SH OrderEnterersLocation 1 dicom98 (0040,2010) SH OrderCallbackPhoneNumber 1 dicom98 (0040,2016) LO PlacerOrderNumberImagingServiceRequest 1 dicom99 (0040,2017) LO FillerOrderNumberImagingServiceRequest 1 dicom99 (0040,2400) LT ImagingServiceRequestComments 1 dicom98 (0040,3001) LO ConfidentialityConstraintOnPatientDataDescription 1 dicom98 (0040,4001) CS GeneralPurposeScheduledProcedureStepStatus 1 dicom2001 (0040,4002) CS GeneralPurposePerformedProcedureStepStatus 1 dicom2001 (0040,4003) CS GeneralPurposeScheduledProcedureStepPriority 1 dicom2001 (0040,4004) SQ ScheduledProcessingApplicationsCodeSequence 1 dicom2001 (0040,4005) DT ScheduledProcedureStepStartDateAndTime 1 dicom2001 (0040,4006) CS MultipleCopiesFlag 1 dicom2001 (0040,4007) SQ PerformedProcessingApplicationsCodeSequence 1 dicom2001 (0040,4009) SQ HumanPerformerCodeSequence 1 dicom2001 (0040,4010) DT ScheduledProcedureStepModificationDateAndTime 1 dicom2004 (0040,4011) DT ExpectedCompletionDateAndTime 1 dicom2001 (0040,4015) SQ ResultingGeneralPurposePerformedProcedureStepsSequence 1 dicom2001 (0040,4016) SQ ReferencedGeneralPurposeScheduledProcedureStepSequence 1 dicom2001 (0040,4018) SQ ScheduledWorkitemCodeSequence 1 dicom2001 (0040,4019) SQ PerformedWorkitemCodeSequence 1 dicom2001 (0040,4020) CS InputAvailabilityFlag 1 dicom2001 (0040,4021) SQ InputInformationSequence 1 dicom2001 (0040,4022) SQ RelevantInformationSequence 1 dicom2001 (0040,4023) UI ReferencedGeneralPurposeScheduledProcedureStepTransactionUID 1 dicom2001 (0040,4025) SQ ScheduledStationNameCodeSequence 1 dicom2001 (0040,4026) SQ ScheduledStationClassCodeSequence 1 dicom2001 (0040,4027) SQ ScheduledStationGeographicLocationCodeSequence 1 dicom2001 (0040,4028) SQ PerformedStationNameCodeSequence 1 dicom2001 (0040,4029) SQ PerformedStationClassCodeSequence 1 dicom2001 (0040,4030) SQ PerformedStationGeographicLocationCodeSequence 1 dicom2001 (0040,4031) SQ RequestedSubsequentWorkitemCodeSequence 1 dicom2001 (0040,4032) SQ NonDICOMOutputCodeSequence 1 dicom2001 (0040,4033) SQ OutputInformationSequence 1 dicom2001 (0040,4034) SQ ScheduledHumanPerformersSequence 1 dicom2001 (0040,4035) SQ ActualHumanPerformersSequence 1 dicom2001 (0040,4036) LO HumanPerformersOrganization 1 dicom2001 (0040,4037) PN HumanPerformersName 1 dicom2001 (0040,8302) DS EntranceDoseInmGy 1 dicom2000 (0040,9094) SQ ReferencedImageRealWorldValueMappingSequence 1 dicom2005 (0040,9096) SQ RealWorldValueMappingSequence 1 dicom2003 (0040,9098) SQ PixelValueMappingCodeSequence 1 dicom2005 # VR corrected from SS to SH in CP 370 (2004) (0040,9210) SH LUTLabel 1 dicom2004 (0040,9211) xs RealWorldValueLastValueMapped 1 dicom2003 (0040,9212) FD RealWorldValueLUTData 1-n dicom2003 (0040,9216) xs RealWorldValueFirstValueMapped 1 dicom2003 (0040,9224) FD RealWorldValueIntercept 1 dicom2003 (0040,9225) FD RealWorldValueSlope 1 dicom2003 (0040,A010) CS RelationshipType 1 dicom2000 (0040,A027) LO VerifyingOrganization 1 dicom2000 (0040,A030) DT VerificationDateTime 1 dicom2000 (0040,A032) DT ObservationDateTime 1 dicom2000 (0040,A040) CS ValueType 1 dicom2000 (0040,A043) SQ ConceptNameCodeSequence 1 dicom99 (0040,A050) CS ContinuityOfContent 1 dicom2000 (0040,A073) SQ VerifyingObserverSequence 1 dicom2000 (0040,A075) PN VerifyingObserverName 1 dicom2000 (0040,A078) SQ AuthorObserverSequence 1 dicom2005 (0040,A07A) SQ ParticipantSequence 1 dicom2005 (0040,A07C) SQ CustodialOrganizationSequence 1 dicom2005 (0040,A080) CS ParticipationType 1 dicom2005 (0040,A082) DT ParticipationDatetime 1 dicom2005 (0040,A084) CS ObserverType 1 dicom2005 (0040,A088) SQ VerifyingObserverIdentificationCodeSequence 1 dicom2000 (0040,A090) SQ EquivalentCDADocumentSequence 1 dicom2005 (0040,A0B0) US ReferencedWaveformChannels 2-2n dicom2000 (0040,A120) DT DateTime 1 dicom2000 (0040,A121) DA Date 1 dicom99 (0040,A122) TM Time 1 dicom99 (0040,A123) PN PersonName 1 dicom99 (0040,A124) UI UID 1 dicom2000 (0040,A130) CS TemporalRangeType 1 dicom2000 (0040,A132) UL ReferencedSamplePositions 1-n dicom2000 (0040,A136) US ReferencedFrameNumbers 1-n dicom99 (0040,A138) DS ReferencedTimeOffsets 1-n dicom2000 (0040,A13A) DT ReferencedDatetime 1-n dicom2000 (0040,A160) UT TextValue 1 dicom99 (0040,A168) SQ ConceptCodeSequence 1 dicom99 (0040,A170) SQ PurposeOfReferenceCodeSequence 1 dicom2001 (0040,A180) US AnnotationGroupNumber 1 dicom2000 (0040,A195) SQ ModifierCodeSequence 1 dicom2000 (0040,A300) SQ MeasuredValueSequence 1 dicom2000 (0040,A301) SQ NumericValueQualifierCodeSequence 1 dicom2003 (0040,A30A) DS NumericValue 1-n dicom99 (0040,A360) SQ PredecessorDocumentsSequence 1 dicom2000 (0040,A370) SQ ReferencedRequestSequence 1 dicom2000 (0040,A372) SQ PerformedProcedureCodeSequence 1 dicom2000 (0040,A375) SQ CurrentRequestedProcedureEvidenceSequence 1 dicom2000 (0040,A385) SQ PertinentOtherEvidenceSequence 1 dicom2000 (0040,A390) SQ HL7StructuredDocumentReferenceSequence 1 dicom2005 (0040,A491) CS CompletionFlag 1 dicom2000 (0040,A492) LO CompletionFlagDescription 1 dicom2000 (0040,A493) CS VerificationFlag 1 dicom2000 (0040,A504) SQ ContentTemplateSequence 1 dicom2000 (0040,A525) SQ IdenticalDocumentsSequence 1 dicom2000 (0040,A730) SQ ContentSequence 1 dicom2000 (0040,B020) SQ AnnotationSequence 1 dicom2000 (0040,DB00) CS TemplateIdentifier 1 dicom2000 (0040,DB73) UL ReferencedContentItemIdentifier 1-n dicom2000 (0040,E001) ST HL7InstanceIdentifier 1 dicom2005 (0040,E004) DT HL7DocumentEffectiveTime 1 dicom2005 (0040,E006) SQ HL7DocumentTypeCodeSequence 1 dicom2005 (0040,E010) ST RetrieveURI 1 dicom2005 (0042,0000) UL EncapsulatedDocumentGroupLength 1 dicom2005 (0042,0010) ST DocumentTitle 1 dicom2005 (0042,0011) OB EncapsulatedDocument 1 dicom2005 (0042,0012) LO MIMETypeOfEncapsulatedDocument 1 dicom2005 (0042,0013) SQ SourceInstanceSequence 1 dicom2005 (0050,0000) UL XRayAngioDeviceGroupLength 1 dicom98 # name for (0050,0004) was CalibrationObject in DICOM96. Name changed to CalibrationImage in DICOM98. (0050,0004) CS CalibrationImage 1 dicom98 (0050,0010) SQ DeviceSequence 1 dicom98 (0050,0014) DS DeviceLength 1 dicom98 (0050,0016) DS DeviceDiameter 1 dicom98 (0050,0017) CS DeviceDiameterUnits 1 dicom98 (0050,0018) DS DeviceVolume 1 dicom98 (0050,0019) DS InterMarkerDistance 1 dicom98 (0050,0020) LO DeviceDescription 1 dicom98 (0054,0000) UL NuclearMedicineGroupLength 1 dicom98 (0054,0010) US EnergyWindowVector 1-n dicom98 (0054,0011) US NumberOfEnergyWindows 1 dicom98 (0054,0012) SQ EnergyWindowInformationSequence 1 dicom98 (0054,0013) SQ EnergyWindowRangeSequence 1 dicom98 (0054,0014) DS EnergyWindowLowerLimit 1 dicom98 (0054,0015) DS EnergyWindowUpperLimit 1 dicom98 (0054,0016) SQ RadiopharmaceuticalInformationSequence 1 dicom98 (0054,0017) IS ResidualSyringeCounts 1 dicom98 (0054,0018) SH EnergyWindowName 1 dicom98 (0054,0020) US DetectorVector 1-n dicom98 (0054,0021) US NumberOfDetectors 1 dicom98 (0054,0022) SQ DetectorInformationSequence 1 dicom98 (0054,0030) US PhaseVector 1-n dicom98 (0054,0031) US NumberOfPhases 1 dicom98 (0054,0032) SQ PhaseInformationSequence 1 dicom98 (0054,0033) US NumberOfFramesInPhase 1 dicom98 (0054,0036) IS PhaseDelay 1 dicom98 (0054,0038) IS PauseBetweenFrames 1 dicom98 (0054,0039) CS PhaseDescription 1 dicom2004 (0054,0050) US RotationVector 1-n dicom98 (0054,0051) US NumberOfRotations 1 dicom98 (0054,0052) SQ RotationInformationSequence 1 dicom98 (0054,0053) US NumberOfFramesInRotation 1 dicom98 (0054,0060) US RRIntervalVector 1-n dicom98 (0054,0061) US NumberOfRRIntervals 1 dicom98 (0054,0062) SQ GatedInformationSequence 1 dicom98 (0054,0063) SQ DataInformationSequence 1 dicom98 (0054,0070) US TimeSlotVector 1-n dicom98 (0054,0071) US NumberOfTimeSlots 1 dicom98 (0054,0072) SQ TimeSlotInformationSequence 1 dicom98 (0054,0073) DS TimeSlotTime 1 dicom98 (0054,0080) US SliceVector 1-n dicom98 (0054,0081) US NumberOfSlices 1 dicom98 (0054,0090) US AngularViewVector 1-n dicom98 (0054,0100) US TimeSliceVector 1-n dicom98 (0054,0101) US NumberOfTimeSlices 1 dicom98 (0054,0200) DS StartAngle 1 dicom98 (0054,0202) CS TypeOfDetectorMotion 1 dicom98 (0054,0210) IS TriggerVector 1-n dicom98 (0054,0211) US NumberOfTriggersInPhase 1 dicom98 (0054,0220) SQ ViewCodeSequence 1 dicom98 # (0054,0222) ViewAngulationModifierCodeSequence is renamed to ViewModifierSequence in Supplement 32. (0054,0222) SQ ViewModifierCodeSequence 1 dicom98 (0054,0300) SQ RadionuclideCodeSequence 1 dicom98 # name for (0054,0302) was RadiopharmaceuticalRouteCodeSequence in DICOM96. Name changed to AdministrationRouteCodeSequence in DICOM98. (0054,0302) SQ AdministrationRouteCodeSequence 1 dicom98 (0054,0304) SQ RadiopharmaceuticalCodeSequence 1 dicom98 (0054,0306) SQ CalibrationDataSequence 1 dicom98 (0054,0308) US EnergyWindowNumber 1 dicom98 (0054,0400) SH ImageID 1 dicom98 (0054,0410) SQ PatientOrientationCodeSequence 1 dicom98 (0054,0412) SQ PatientOrientationModifierCodeSequence 1 dicom98 (0054,0414) SQ PatientGantryRelationshipCodeSequence 1 dicom98 (0054,0500) CS SliceProgressionDirection 1 dicom2004 (0054,1000) CS SeriesType 2 dicom98 (0054,1001) CS Units 1 dicom98 (0054,1002) CS CountsSource 1 dicom98 (0054,1004) CS ReprojectionMethod 1 dicom98 (0054,1100) CS RandomsCorrectionMethod 1 dicom98 (0054,1101) LO AttenuationCorrectionMethod 1 dicom98 (0054,1102) CS DecayCorrection 1 dicom98 (0054,1103) LO ReconstructionMethod 1 dicom98 (0054,1104) LO DetectorLinesOfResponseUsed 1 dicom98 (0054,1105) LO ScatterCorrectionMethod 1 dicom98 (0054,1200) DS AxialAcceptance 1 dicom98 (0054,1201) IS AxialMash 2 dicom98 (0054,1202) IS TransverseMash 1 dicom98 (0054,1203) DS DetectorElementSize 2 dicom98 (0054,1210) DS CoincidenceWindowWidth 1 dicom98 (0054,1220) CS SecondaryCountsType 1-n dicom98 (0054,1300) DS FrameReferenceTime 1 dicom98 (0054,1310) IS PrimaryPromptsCountsAccumulated 1 dicom98 (0054,1311) IS SecondaryCountsAccumulated 1-n dicom98 (0054,1320) DS SliceSensitivityFactor 1 dicom98 (0054,1321) DS DecayFactor 1 dicom98 (0054,1322) DS DoseCalibrationFactor 1 dicom98 (0054,1323) DS ScatterFractionFactor 1 dicom98 (0054,1324) DS DeadTimeFactor 1 dicom98 (0054,1330) US ImageIndex 1 dicom98 (0054,1400) CS CountsIncluded 1-n dicom98 (0054,1401) CS DeadTimeCorrectionFlag 1 dicom98 (0060,0000) UL HistogramGroupLength 1 dicom99 (0060,3000) SQ HistogramSequence 1 dicom99 (0060,3002) US HistogramNumberOfBins 1 dicom99 (0060,3004) xs HistogramFirstBinValue 1 dicom99 (0060,3006) xs HistogramLastBinValue 1 dicom99 (0060,3008) US HistogramBinWidth 1 dicom99 (0060,3010) LO HistogramExplanation 1 dicom99 (0060,3020) UL HistogramData 1-n dicom99 (0070,0000) UL PresentationStateGroupLength 1 dicom2000 (0070,0001) SQ GraphicAnnotationSequence 1 dicom2000 (0070,0002) CS GraphicLayer 1 dicom2000 (0070,0003) CS BoundingBoxAnnotationUnits 1 dicom2000 (0070,0004) CS AnchorPointAnnotationUnits 1 dicom2000 (0070,0005) CS GraphicAnnotationUnits 1 dicom2000 (0070,0006) ST UnformattedTextValue 1 dicom2000 (0070,0008) SQ TextObjectSequence 1 dicom2000 (0070,0009) SQ GraphicObjectSequence 1 dicom2000 (0070,0010) FL BoundingBoxTopLeftHandCorner 2 dicom2000 (0070,0011) FL BoundingBoxBottomRightHandCorner 2 dicom2000 (0070,0012) CS BoundingBoxTextHorizontalJustification 1 dicom2000 (0070,0014) FL AnchorPoint 2 dicom2000 (0070,0015) CS AnchorPointVisibility 1 dicom2000 (0070,0020) US GraphicDimensions 1 dicom2000 (0070,0021) US NumberOfGraphicPoints 1 dicom2000 (0070,0022) FL GraphicData 2-n dicom2000 (0070,0023) CS GraphicType 1 dicom2000 (0070,0024) CS GraphicFilled 1 dicom2000 (0070,0041) CS ImageHorizontalFlip 1 dicom2000 (0070,0042) US ImageRotation 1 dicom2000 (0070,0052) SL DisplayedAreaTopLeftHandCorner 2 dicom2000 (0070,0053) SL DisplayedAreaBottomRightHandCorner 2 dicom2000 (0070,005A) SQ DisplayedAreaSelectionSequence 1 dicom2000 (0070,0060) SQ GraphicLayerSequence 1 dicom2000 (0070,0062) IS GraphicLayerOrder 1 dicom2000 (0070,0066) US GraphicLayerRecommendedDisplayGrayscaleValue 1 dicom2000 (0070,0067) US GraphicLayerRecommendedDisplayRGBValue 3 dicom2000 (0070,0068) LO GraphicLayerDescription 1 dicom2000 # name for (0070,0080) was PresentationLabel. Changed in DICOM 2004. (0070,0080) CS ContentLabel 1 dicom2004 # name for (0070,0081) was PresentationDescription. Changed in DICOM 2004. (0070,0081) LO ContentDescription 1 dicom2004 (0070,0082) DA PresentationCreationDate 1 dicom2000 (0070,0083) TM PresentationCreationTime 1 dicom2000 # name for (0070,0084) was PresentationCreatorsName. Changed in DICOM 2004. (0070,0084) PN ContentCreatorsName 1 dicom2004 (0070,0086) SQ ContentCreatorsIdentificationSequence 1 dicom2005 (0070,0100) CS PresentationSizeMode 1 dicom2000 (0070,0101) DS PresentationPixelSpacing 2 dicom2000 (0070,0102) IS PresentationPixelAspectRatio 2 dicom2000 (0070,0103) FL PresentationPixelMagnificationRatio 1 dicom2000 (0070,0306) CS ShapeType 1 dicom2004 (0070,0308) SQ RegistrationSequence 1 dicom2004 (0070,0309) SQ MatrixRegistrationSequence 1 dicom2004 (0070,030A) SQ MatrixSequence 1 dicom2004 (0070,030C) CS FrameOfReferenceTransformationMatrixType 1 dicom2004 (0070,030D) SQ RegistrationTypeCodeSequence 1 dicom2004 (0070,030F) ST FiducialDescription 1 dicom2004 (0070,0310) SH FiducialIdentifier 1 dicom2004 (0070,0311) SQ FiducialIdentifierCodeSequence 1 dicom2004 (0070,0312) FD ContourUncertaintyRadius 1 dicom2004 (0070,0314) SQ UsedFiducialsSequence 1 dicom2004 (0070,0318) SQ GraphicCoordinatesDataSequence 1 dicom2004 (0070,031A) UI FiducialUID 1 dicom2004 (0070,031C) SQ FiducialSetSequence 1 dicom2004 (0070,031E) SQ FiducialSequence 1 dicom2004 (0070,0401) US GraphicLayerRecommendedDisplayCIELabValue 3 dicom2005 (0070,0402) SQ BlendingSequence 1 dicom2005 (0070,0403) FL RelativeOpacity 1 dicom2005 (0070,0404) SQ ReferencedSpatialRegistrationSequence 1 dicom2005 (0070,0405) CS BlendingPosition 1 dicom2005 (0072,0000) UL HangingProtocolGroupLength 1 dicom2005 (0072,0002) SH HangingProtocolName 1 dicom2005 (0072,0004) LO HangingProtocolDescription 1 dicom2005 (0072,0006) CS HangingProtocolLevel 1 dicom2005 (0072,0008) LO HangingProtocolCreator 1 dicom2005 (0072,000A) DT HangingProtocolCreationDatetime 1 dicom2005 (0072,000C) SQ HangingProtocolDefinitionSequence 1 dicom2005 (0072,000E) SQ HangingProtocolUserIdentificationCodeSequence 1 dicom2005 (0072,0010) LO HangingProtocolUserGroupName 1 dicom2005 (0072,0012) SQ SourceHangingProtocolSequence 1 dicom2005 (0072,0014) US NumberOfPriorsReferenced 1 dicom2005 (0072,0020) SQ ImageSetsSequence 1 dicom2005 (0072,0022) SQ ImageSetSelectorSequence 1 dicom2005 (0072,0024) CS ImageSetSelectorUsageFlag 1 dicom2005 (0072,0026) AT SelectorAttribute 1 dicom2005 (0072,0028) US SelectorValueNumber 1 dicom2005 (0072,0030) SQ TimeBasedImageSetsSequence 1 dicom2005 (0072,0032) US ImageSetNumber 1 dicom2005 (0072,0034) CS ImageSetSelectorCategory 1 dicom2005 (0072,0038) US RelativeTime 2 dicom2005 (0072,003A) CS RelativeTimeUnits 1 dicom2005 (0072,003C) SS AbstractPriorValue 2 dicom2005 (0072,003E) SQ AbstractPriorCodeSequence 1 dicom2005 (0072,0040) LO ImageSetLabel 1 dicom2005 (0072,0050) CS SelectorAttributeVR 1 dicom2005 (0072,0052) AT SelectorSequencePointer 1 dicom2005 (0072,0054) LO SelectorSequencePointerPrivateCreator 1 dicom2005 (0072,0056) LO SelectorAttributePrivateCreator 1 dicom2005 (0072,0060) AT SelectorATValue 1-n dicom2005 (0072,0062) CS SelectorCSValue 1-n dicom2005 (0072,0064) IS SelectorISValue 1-n dicom2005 (0072,0066) LO SelectorLOValue 1-n dicom2005 (0072,0068) LT SelectorLTValue 1-n dicom2005 (0072,006A) PN SelectorPNValue 1-n dicom2005 (0072,006C) SH SelectorSHValue 1-n dicom2005 (0072,006E) ST SelectorSTValue 1-n dicom2005 (0072,0070) UT SelectorUTValue 1-n dicom2005 (0072,0072) DS SelectorDSValue 1-n dicom2005 (0072,0074) FD SelectorFDValue 1-n dicom2005 (0072,0076) FL SelectorFLValue 1-n dicom2005 (0072,0078) UL SelectorULValue 1-n dicom2005 (0072,007A) US SelectorUSValue 1-n dicom2005 (0072,007C) SL SelectorSLValue 1-n dicom2005 (0072,007E) SS SelectorSSValue 1-n dicom2005 (0072,0080) SQ SelectorCodeSequenceValue 1 dicom2005 (0072,0100) US NumberOfScreens 1 dicom2005 (0072,0102) SQ NominalScreenDefinitionSequence 1 dicom2005 (0072,0104) US NumberOfVerticalPixels 1 dicom2005 (0072,0106) US NumberOfHorizontalPixels 1 dicom2005 (0072,0108) FD DisplayEnvironmentSpatialPosition 4 dicom2005 (0072,010A) US ScreenMinimumGrayscaleBitDepth 1 dicom2005 (0072,010C) US ScreenMinimumColorBitDepth 1 dicom2005 (0072,010E) US ApplicationMaximumRepaintTime 1 dicom2005 (0072,0200) SQ DisplaySetsSequence 1 dicom2005 (0072,0202) US DisplaySetNumber 1 dicom2005 (0072,0204) US DisplaySetPresentationGroup 1 dicom2005 (0072,0206) LO DisplaySetPresentationGroupDescription 1 dicom2005 (0072,0208) CS PartialDataDisplayHandling 1 dicom2005 (0072,0210) SQ SynchronizedScrollingSequence 1 dicom2005 (0072,0212) US DisplaySetScrollingGroup 2-n dicom2005 (0072,0214) SQ NavigationIndicatorSequence 1 dicom2005 (0072,0216) US NavigationDisplaySet 1 dicom2005 (0072,0218) US ReferenceDisplaySets 1-n dicom2005 (0072,0300) SQ ImageBoxesSequence 1 dicom2005 (0072,0302) US ImageBoxNumber 1 dicom2005 (0072,0304) CS ImageBoxLayoutType 1 dicom2005 (0072,0306) US ImageBoxTileHorizontalDimension 1 dicom2005 (0072,0308) US ImageBoxTileVerticalDimension 1 dicom2005 (0072,0310) CS ImageBoxScrollDirection 1 dicom2005 (0072,0312) CS ImageBoxSmallScrollType 1 dicom2005 (0072,0314) US ImageBoxSmallScrollAmount 1 dicom2005 (0072,0316) CS ImageBoxLargeScrollType 1 dicom2005 (0072,0318) US ImageBoxLargeScrollAmount 1 dicom2005 (0072,0320) US ImageBoxOverlapPriority 1 dicom2005 (0072,0330) FD CineRelativeToRealTime 1 dicom2005 (0072,0400) SQ FilterOperationsSequence 1 dicom2005 (0072,0402) CS FilterByCategory 1 dicom2005 (0072,0404) CS FilterByAttributePresence 1 dicom2005 (0072,0406) CS FilterByOperator 1 dicom2005 (0072,0500) CS BlendingOperationType 1 dicom2005 (0072,0510) CS ReformattingOperationType 1 dicom2005 (0072,0512) FD ReformattingThickness 1 dicom2005 (0072,0514) FD ReformattingInterval 1 dicom2005 (0072,0516) CS ReformattingOperationInitialViewDirection 1 dicom2005 (0072,0520) CS 3DRenderingType 1-n dicom2005 (0072,0600) SQ SortingOperationsSequence 1 dicom2005 (0072,0602) CS SortByCategory 1 dicom2005 (0072,0604) CS SortingDirection 1 dicom2005 (0072,0700) CS DisplaySetPatientOrientation 2 dicom2005 (0072,0702) CS VOIType 1 dicom2005 (0072,0704) CS PseudoColorType 1 dicom2005 (0072,0706) CS ShowGrayscaleInverted 1 dicom2005 (0072,0710) CS ShowImageTrueSizeFlag 1 dicom2005 (0072,0712) CS ShowGraphicAnnotationFlag 1 dicom2005 (0072,0714) CS ShowPatientDemographicsFlag 1 dicom2005 (0072,0716) CS ShowAcquisitionTechniquesFlag 1 dicom2005 (0088,0000) UL StorageGroupLength 1 dicom98 (0088,0130) SH StorageMediaFileSetID 1 dicom98 (0088,0140) UI StorageMediaFileSetUID 1 dicom98 (0088,0200) SQ IconImageSequence 1 dicom98 (0088,0904) LO TopicTitle 1 dicom98 (0088,0906) ST TopicSubject 1 dicom98 (0088,0910) LO TopicAuthor 1 dicom98 (0088,0912) LO TopicKeyWords 1-32 dicom98 (0100,0000) UL AuthorizationGroupLength 1 dicom2000 (0100,0410) CS SOPInstanceStatus 1 dicom2000 (0100,0420) DT SOPAuthorizationDateAndTime 1 dicom2000 (0100,0424) LT SOPAuthorizationComment 1 dicom2000 (0100,0426) LO AuthorizationEquipmentCertificationNumber 1 dicom2000 (0400,0000) UL DigitalSignatureGroupLength 1 dicom2001 (0400,0005) US MACIDNumber 1 dicom2001 (0400,0010) UI MACCalculationTransferSyntaxUID 1 dicom2001 (0400,0015) CS MACAlgorithm 1 dicom2001 (0400,0020) AT DataElementsSigned 1-n dicom2001 (0400,0100) UI DigitalSignatureUID 1 dicom2001 (0400,0105) DT DigitalSignatureDateTime 1 dicom2001 (0400,0110) CS CertificateType 1 dicom2001 (0400,0115) OB CertificateOfSigner 1 dicom2001 (0400,0120) OB Signature 1 dicom2001 (0400,0305) CS CertifiedTimestampType 1 dicom2001 (0400,0310) OB CertifiedTimestamp 1 dicom2001 (0400,0401) SQ DigitalSignaturePurposeCodeSequence 1 dicom2005 (0400,0402) SQ ReferencedDigitalSignatureSequence 1 dicom2005 (0400,0403) SQ ReferencedSOPInstanceMACSequence 1 dicom2005 (0400,0404) OB MAC 1 dicom2005 (0400,0500) SQ EncryptedAttributesSequence 1 dicom2003 (0400,0510) UI EncryptedContentTransferSyntaxUID 1 dicom2003 (0400,0520) OB EncryptedContent 1 dicom2003 (0400,0550) SQ ModifiedAttributesSequence 1 dicom2003 (2000,0000) UL FilmSessionGroupLength 1 dicom98 (2000,0010) IS NumberOfCopies 1 dicom98 (2000,001E) SQ PrinterConfigurationSequence 1 dicom99 (2000,0020) CS PrintPriority 1 dicom98 (2000,0030) CS MediumType 1 dicom98 (2000,0040) CS FilmDestination 1 dicom98 (2000,0050) LO FilmSessionLabel 1 dicom98 (2000,0060) IS MemoryAllocation 1 dicom98 # MaximumMemoryAllocation is corrected in CP 164, was (2000,0062) in Supp37 which is already in use. (2000,0061) IS MaximumMemoryAllocation 1 dicom99 (2000,0062) CS ColorImagePrintingFlag 1 dicom98 (2000,0063) CS CollationFlag 1 dicom98 (2000,0065) CS AnnotationFlag 1 dicom98 (2000,0067) CS ImageOverlayFlag 1 dicom98 (2000,0069) CS PresentationLUTFlag 1 dicom98 (2000,006A) CS ImageBoxPresentationLUTFlag 1 dicom98 (2000,00A0) US MemoryBitDepth 1 dicom99 (2000,00A1) US PrintingBitDepth 1 dicom99 (2000,00A2) SQ MediaInstalledSequence 1 dicom99 (2000,00A4) SQ OtherMediaAvailableSequence 1 dicom99 (2000,00A8) SQ SupportedImageDisplayFormatsSequence 1 dicom99 (2000,0500) SQ ReferencedFilmBoxSequence 1 dicom98 (2000,0510) SQ ReferencedStoredPrintSequence 1 dicom98 (2010,0000) UL FilmBoxGroupLength 1 dicom98 (2010,0010) ST ImageDisplayFormat 1 dicom98 (2010,0030) CS AnnotationDisplayFormatID 1 dicom98 (2010,0040) CS FilmOrientation 1 dicom98 (2010,0050) CS FilmSizeID 1 dicom98 (2010,0052) CS PrinterResolutionID 1 dicom99 (2010,0054) CS DefaultPrinterResolutionID 1 dicom99 (2010,0060) CS MagnificationType 1 dicom98 (2010,0080) CS SmoothingType 1 dicom98 (2010,00A6) CS DefaultMagnificationType 1 dicom99 (2010,00A7) CS OtherMagnificationTypesAvailable 1-n dicom99 (2010,00A8) CS DefaultSmoothingType 1 dicom99 (2010,00A9) CS OtherSmoothingTypesAvailable 1-n dicom99 (2010,0100) CS BorderDensity 1 dicom98 (2010,0110) CS EmptyImageDensity 1 dicom98 (2010,0120) US MinDensity 1 dicom98 (2010,0130) US MaxDensity 1 dicom98 (2010,0140) CS Trim 1 dicom98 (2010,0150) ST ConfigurationInformation 1 dicom98 (2010,0152) LT ConfigurationInformationDescription 1 dicom99 (2010,0154) IS MaximumCollatedFilms 1 dicom99 (2010,015E) US Illumination 1 dicom98 (2010,0160) US ReflectedAmbientLight 1 dicom98 (2010,0376) DS PrinterPixelSpacing 2 dicom99 (2010,0500) SQ ReferencedFilmSessionSequence 1 dicom98 (2010,0510) SQ ReferencedImageBoxSequence 1 dicom98 (2010,0520) SQ ReferencedBasicAnnotationBoxSequence 1 dicom98 (2020,0000) UL ImageBoxGroupLength 1 dicom98 (2020,0010) US ImagePosition 1 dicom98 (2020,0020) CS Polarity 1 dicom98 (2020,0030) DS RequestedImageSize 1 dicom98 (2020,0040) CS RequestedDecimateCropBehavior 1 dicom99 (2020,0050) CS RequestedResolutionID 1 dicom99 (2020,00A0) CS RequestedImageSizeFlag 1 dicom99 (2020,00A2) CS DecimateCropResult 1 dicom99 # name for (2020,0110) was PreformattedGrayscaleImageSequence in DICOM96. Name changed to BasicGrayscaleImageSequence in DICOM98. (2020,0110) SQ BasicGrayscaleImageSequence 1 dicom98 # name for (2020,0110) was PreformattedColorImageSequence in DICOM96. Name changed to BasicColorImageSequence in DICOM98. (2020,0111) SQ BasicColorImageSequence 1 dicom98 (2030,0000) UL AnnotationGroupLength 1 dicom98 (2030,0010) US AnnotationPosition 1 dicom98 (2030,0020) LO TextString 1 dicom98 (2040,0000) UL OverlayBoxGroupLength 1 dicom98 (2040,0010) SQ ReferencedOverlayPlaneSequence 1 dicom98 (2040,0011) US ReferencedOverlayPlaneGroups 1-99 dicom98 (2040,0020) SQ OverlayPixelDataSequence 1 dicom99 (2040,0060) CS OverlayMagnificationType 1 dicom98 (2040,0070) CS OverlaySmoothingType 1 dicom98 (2040,0072) CS OverlayOrImageMagnification 1 dicom99 (2040,0074) US MagnifyToNumberOfColumns 1 dicom99 (2040,0080) CS OverlayForegroundDensity 1 dicom98 (2040,0082) CS OverlayBackgroundDensity 1 dicom99 (2040,0090) CS OverlayMode 1 dicom98 (2040,0100) CS ThresholdDensity 1 dicom98 (2050,0000) UL PresentationLUTGroupLength 1 dicom98 (2050,0010) SQ PresentationLUTSequence 1 dicom98 (2050,0020) CS PresentationLUTShape 1 dicom98 (2050,0500) SQ ReferencedPresentationLUTSequence 1 dicom98 (2100,0000) UL PrintJobGroupLength 1 dicom98 (2100,0010) SH PrintJobID 1 dicom98 (2100,0020) CS ExecutionStatus 1 dicom98 (2100,0030) CS ExecutionStatusInfo 1 dicom98 (2100,0040) DA CreationDate 1 dicom98 (2100,0050) TM CreationTime 1 dicom98 (2100,0070) AE Originator 1 dicom98 (2100,0140) AE DestinationAE 1 dicom98 (2100,0160) SH OwnerID 1 dicom98 (2100,0170) IS NumberOfFilms 1 dicom98 (2100,0500) SQ ReferencedPrintJobSequence 1 dicom98 (2110,0000) UL PrinterGroupLength 1 dicom98 (2110,0010) CS PrinterStatus 1 dicom98 (2110,0020) CS PrinterStatusInfo 1 dicom98 (2110,0030) LO PrinterName 1 dicom98 (2110,0099) SH PrintQueueID 1 dicom98 (2120,0000) UL QueueGroupLength 1 dicom98 (2120,0010) CS QueueStatus 1 dicom98 (2120,0050) SQ PrintJobDescriptionSequence 1 dicom98 # (2120,0070) is called ReferencedPrintJobSequence in the standard, but this collides with tag (2100,0500) (2120,0070) SQ QueueReferencedPrintJobSequence 1 dicom98 (2130,0000) UL PrintContentGroupLength 1 dicom98 (2130,0010) SQ PrintManagementCapabilitiesSequence 1 dicom98 (2130,0015) SQ PrinterCharacteristicsSequence 1 dicom98 (2130,0030) SQ FilmBoxContentSequence 1 dicom98 (2130,0040) SQ ImageBoxContentSequence 1 dicom98 (2130,0050) SQ AnnotationContentSequence 1 dicom98 (2130,0060) SQ ImageOverlayBoxContentSequence 1 dicom98 (2130,0080) SQ PresentationLUTContentSequence 1 dicom98 (2130,00A0) SQ ProposedStudySequence 1 dicom98 (2130,00C0) SQ OriginalImageSequence 1 dicom98 (2200,0000) UL MediaCreationGroupLength 1 dicom2004 (2200,0001) CS LabelUsingInformationExtractedFromInstances 1 dicom2004 (2200,0002) UT LabelText 1 dicom2004 (2200,0003) CS LabelStyleSelection 1 dicom2004 (2200,0004) LT MediaDisposition 1 dicom2004 (2200,0005) LT BarcodeValue 1 dicom2004 (2200,0006) CS BarcodeSymbology 1 dicom2004 (2200,0007) CS AllowMediaSplitting 1 dicom2004 (2200,0008) CS IncludeNon-DICOMObjects 1 dicom2004 (2200,0009) CS IncludeDisplayApplication 1 dicom2004 (2200,000A) CS PreserveCompositeInstancesAfterMediaCreation 1 dicom2004 (2200,000B) US TotalNumberOfPiecesOfMediaCreated 1 dicom2004 (2200,000C) LO RequestedMediaApplicationProfile 1 dicom2004 (2200,000D) SQ ReferencedStorageMediaSequence 1 dicom2004 (2200,000E) AT FailureAttributes 1-n dicom2004 (2200,000F) CS AllowLossyCompression 1 dicom2004 (2200,0020) CS RequestPriority 1 dicom2004 (3002,0000) UL RTImageGroupLength 1 dicom98 (3002,0002) SH RTImageLabel 1 dicom98 (3002,0003) LO RTImageName 1 dicom98 (3002,0004) ST RTImageDescription 1 dicom98 (3002,000A) CS ReportedValuesOrigin 1 dicom98 (3002,000C) CS RTImagePlane 1 dicom98 (3002,000D) DS XRayImageReceptorTranslation 3 dicom2000 (3002,000E) DS XRayImageReceptorAngle 1 dicom98 (3002,0010) DS RTImageOrientation 6 dicom98 (3002,0011) DS ImagePlanePixelSpacing 2 dicom98 (3002,0012) DS RTImagePosition 2 dicom98 (3002,0020) SH RadiationMachineName 1 dicom98 (3002,0022) DS RadiationMachineSAD 1 dicom98 (3002,0024) DS RadiationMachineSSD 1 dicom98 (3002,0026) DS RTImageSID 1 dicom98 (3002,0028) DS SourceToReferenceObjectDistance 1 dicom98 (3002,0029) IS FractionNumber 1 dicom98 (3002,0030) SQ ExposureSequence 1 dicom98 (3002,0032) DS MetersetExposure 1 dicom98 (3002,0034) DS DiaphragmPosition 4 dicom2001 (3002,0040) SQ FluenceeMapSequence 1 dicom2004 (3002,0041) CS FluenceDataSource 1 dicom2004 (3002,0042) DS FluenceDataScale 1 dicom2004 (3004,0000) UL RTDoseGroupLength 1 dicom98 (3004,0001) CS DVHType 1 dicom98 (3004,0002) CS DoseUnits 1 dicom98 (3004,0004) CS DoseType 1 dicom98 (3004,0006) LO DoseComment 1 dicom98 (3004,0008) DS NormalizationPoint 3 dicom98 (3004,000A) CS DoseSummationType 1 dicom98 (3004,000C) DS GridFrameOffsetVector 2-n dicom98 (3004,000E) DS DoseGridScaling 1 dicom98 (3004,0010) SQ RTDoseROISequence 1 dicom98 (3004,0012) DS DoseValue 1 dicom98 (3004,0014) CS TissueHeterogeneityCorrection 1-3 dicom2004 (3004,0040) DS DVHNormalizationPoint 3 dicom98 (3004,0042) DS DVHNormalizationDoseValue 1 dicom98 (3004,0050) SQ DVHSequence 1 dicom98 (3004,0052) DS DVHDoseScaling 1 dicom98 (3004,0054) CS DVHVolumeUnits 1 dicom98 (3004,0056) IS DVHNumberOfBins 1 dicom98 (3004,0058) DS DVHData 2-2n dicom98 (3004,0060) SQ DVHReferencedROISequence 1 dicom98 (3004,0062) CS DVHROIContributionType 1 dicom98 (3004,0070) DS DVHMinimumDose 1 dicom98 (3004,0072) DS DVHMaximumDose 1 dicom98 (3004,0074) DS DVHMeanDose 1 dicom98 (3006,0000) UL RTStructureSetGroupLength 1 dicom98 (3006,0002) SH StructureSetLabel 1 dicom98 (3006,0004) LO StructureSetName 1 dicom98 (3006,0006) ST StructureSetDescription 1 dicom98 (3006,0008) DA StructureSetDate 1 dicom98 (3006,0009) TM StructureSetTime 1 dicom98 (3006,0010) SQ ReferencedFrameOfReferenceSequence 1 dicom98 (3006,0012) SQ RTReferencedStudySequence 1 dicom98 (3006,0014) SQ RTReferencedSeriesSequence 1 dicom98 (3006,0016) SQ ContourImageSequence 1 dicom98 (3006,0020) SQ StructureSetROISequence 1 dicom98 (3006,0022) IS ROINumber 1 dicom98 (3006,0024) UI ReferencedFrameOfReferenceUID 1 dicom98 (3006,0026) LO ROIName 1 dicom98 (3006,0028) ST ROIDescription 1 dicom98 (3006,002A) IS ROIDisplayColor 3 dicom98 (3006,002C) DS ROIVolume 1 dicom98 (3006,0030) SQ RTRelatedROISequence 1 dicom98 (3006,0033) CS RTROIRelationship 1 dicom98 (3006,0036) CS ROIGenerationAlgorithm 1 dicom98 (3006,0038) LO ROIGenerationDescription 1 dicom98 (3006,0039) SQ ROIContourSequence 1 dicom98 (3006,0040) SQ ContourSequence 1 dicom98 (3006,0042) CS ContourGeometricType 1 dicom98 (3006,0044) DS ContourSlabThickness 1 dicom98 (3006,0045) DS ContourOffsetVector 3 dicom98 (3006,0046) IS NumberOfContourPoints 1 dicom98 (3006,0048) IS ContourNumber 1 dicom2000 (3006,0049) IS AttachedContours 1-n dicom2000 (3006,0050) DS ContourData 3-3n dicom98 (3006,0080) SQ RTROIObservationsSequence 1 dicom98 (3006,0082) IS ObservationNumber 1 dicom98 (3006,0084) IS ReferencedROINumber 1 dicom98 (3006,0085) SH ROIObservationLabel 1 dicom98 (3006,0086) SQ RTROIIdentificationCodeSequence 1 dicom98 (3006,0088) ST ROIObservationDescription 1 dicom98 (3006,00A0) SQ RelatedRTROIObservationsSequence 1 dicom98 (3006,00A4) CS RTROIInterpretedType 1 dicom98 (3006,00A6) PN ROIInterpreter 1 dicom98 (3006,00B0) SQ ROIPhysicalPropertiesSequence 1 dicom98 (3006,00B2) CS ROIPhysicalProperty 1 dicom98 (3006,00B4) DS ROIPhysicalPropertyValue 1 dicom98 (3006,00C0) SQ FrameOfReferenceRelationshipSequence 1 dicom98 (3006,00C2) UI RelatedFrameOfReferenceUID 1 dicom98 (3006,00C4) CS FrameOfReferenceTransformationType 1 dicom98 (3006,00C6) DS FrameOfReferenceTransformationMatrix 16 dicom98 (3006,00C8) LO FrameOfReferenceTransformationComment 1 dicom98 (3008,0000) UL RTTreatmentGroupLength 1 dicom99 (3008,0010) SQ MeasuredDoseReferenceSequence 1 dicom99 (3008,0012) ST MeasuredDoseDescription 1 dicom99 (3008,0014) CS MeasuredDoseType 1 dicom99 (3008,0016) DS MeasuredDoseValue 1 dicom99 (3008,0020) SQ TreatmentSessionBeamSequence 1 dicom99 (3008,0022) IS CurrentFractionNumber 1 dicom99 (3008,0024) DA TreatmentControlPointDate 1 dicom99 (3008,0025) TM TreatmentControlPointTime 1 dicom99 (3008,002A) CS TreatmentTerminationStatus 1 dicom99 (3008,002B) SH TreatmentTerminationCode 1 dicom99 (3008,002C) CS TreatmentVerificationStatus 1 dicom99 (3008,0030) SQ ReferencedTreatmentRecordSequence 1 dicom99 (3008,0032) DS SpecifiedPrimaryMeterset 1 dicom99 (3008,0033) DS SpecifiedSecondaryMeterset 1 dicom99 (3008,0036) DS DeliveredPrimaryMeterset 1 dicom99 (3008,0037) DS DeliveredSecondaryMeterset 1 dicom99 (3008,003A) DS SpecifiedTreatmentTime 1 dicom99 (3008,003B) DS DeliveredTreatmentTime 1 dicom99 (3008,0040) SQ ControlPointDeliverySequence 1 dicom99 (3008,0042) DS SpecifiedMeterset 1 dicom99 (3008,0044) DS DeliveredMeterset 1 dicom99 (3008,0048) DS DoseRateDelivered 1 dicom99 (3008,0050) SQ TreatmentSummaryCalculatedDoseReferenceSequence 1 dicom99 (3008,0052) DS CumulativeDoseToDoseReference 1 dicom99 (3008,0054) DA FirstTreatmentDate 1 dicom99 (3008,0056) DA MostRecentTreatmentDate 1 dicom99 (3008,005A) IS NumberOfFractionsDelivered 1 dicom99 (3008,0060) SQ OverrideSequence 1 dicom99 (3008,0062) AT OverrideParameterPointer 1 dicom99 (3008,0064) IS MeasuredDoseReferenceNumber 1 dicom99 (3008,0066) ST OverrideReason 1 dicom99 (3008,0070) SQ CalculatedDoseReferenceSequence 1 dicom99 (3008,0072) IS CalculatedDoseReferenceNumber 1 dicom99 (3008,0074) ST CalculatedDoseReferenceDescription 1 dicom99 (3008,0076) DS CalculatedDoseReferenceDoseValue 1 dicom99 (3008,0078) DS StartMeterset 1 dicom99 (3008,007A) DS EndMeterset 1 dicom99 (3008,0080) SQ ReferencedMeasuredDoseReferenceSequence 1 dicom99 (3008,0082) IS ReferencedMeasuredDoseReferenceNumber 1 dicom99 (3008,0090) SQ ReferencedCalculatedDoseReferenceSequence 1 dicom99 (3008,0092) IS ReferencedCalculatedDoseReferenceNumber 1 dicom99 (3008,00A0) SQ BeamLimitingDeviceLeafPairsSequence 1 dicom99 (3008,00B0) SQ RecordedWedgeSequence 1 dicom99 (3008,00C0) SQ RecordedCompensatorSequence 1 dicom99 (3008,00D0) SQ RecordedBlockSequence 1 dicom99 (3008,00E0) SQ TreatmentSummaryMeasuredDoseReferenceSequence 1 dicom99 (3008,0100) SQ RecordedSourceSequence 1 dicom99 (3008,0105) LO SourceSerialNumber 1 dicom99 (3008,0110) SQ TreatmentSessionApplicationSetupSequence 1 dicom99 (3008,0116) CS ApplicationSetupCheck 1 dicom99 (3008,0120) SQ RecordedBrachyAccessoryDeviceSequence 1 dicom99 (3008,0122) IS ReferencedBrachyAccessoryDeviceNumber 1 dicom99 (3008,0130) SQ RecordedChannelSequence 1 dicom99 (3008,0132) DS SpecifiedChannelTotalTime 1 dicom99 (3008,0134) DS DeliveredChannelTotalTime 1 dicom99 (3008,0136) IS SpecifiedNumberOfPulses 1 dicom99 (3008,0138) IS DeliveredNumberOfPulses 1 dicom99 (3008,013A) DS SpecifiedPulseRepetitionInterval 1 dicom99 (3008,013C) DS DeliveredPulseRepetitionInterval 1 dicom99 (3008,0140) SQ RecordedSourceApplicatorSequence 1 dicom99 (3008,0142) IS ReferencedSourceApplicatorNumber 1 dicom99 (3008,0150) SQ RecordedChannelShieldSequence 1 dicom99 (3008,0152) IS ReferencedChannelShieldNumber 1 dicom99 (3008,0160) SQ BrachyControlPointDeliveredSequence 1 dicom99 (3008,0162) DA SafePositionExitDate 1 dicom99 (3008,0164) TM SafePositionExitTime 1 dicom99 (3008,0166) DA SafePositionReturnDate 1 dicom99 (3008,0168) TM SafePositionReturnTime 1 dicom99 (3008,0200) CS CurrentTreatmentStatus 1 dicom99 (3008,0202) ST TreatmentStatusComment 1 dicom99 (3008,0220) SQ FractionGroupSummarySequence 1 dicom99 (3008,0223) IS ReferencedFractionNumber 1 dicom99 (3008,0224) CS FractionGroupType 1 dicom99 (3008,0230) CS BeamStopperPosition 1 dicom99 (3008,0240) SQ FractionStatusSummarySequence 1 dicom99 (3008,0250) DA TreatmentDate 1 dicom99 (3008,0251) TM TreatmentTime 1 dicom99 (300A,0000) UL RTPlanGroupLength 1 dicom98 (300A,0002) SH RTPlanLabel 1 dicom98 (300A,0003) LO RTPlanName 1 dicom98 (300A,0004) ST RTPlanDescription 1 dicom98 (300A,0006) DA RTPlanDate 1 dicom98 (300A,0007) TM RTPlanTime 1 dicom98 (300A,0009) LO TreatmentProtocols 1-n dicom98 # Name was TreatmentIntent (dicom98) changed in CPack 33 (dicom2005) (300A,000A) CS PlanIntent 1 dicom2005 (300A,000B) LO TreatmentSites 1-n dicom98 (300A,000C) CS RTPlanGeometry 1 dicom98 (300A,000E) ST PrescriptionDescription 1 dicom98 (300A,0010) SQ DoseReferenceSequence 1 dicom98 (300A,0012) IS DoseReferenceNumber 1 dicom98 (300A,0013) LO DoseReferenceUID 1 dicom2004 (300A,0014) CS DoseReferenceStructureType 1 dicom98 (300A,0015) CS NominalBeamEnergyUnit 1 dicom99 (300A,0016) LO DoseReferenceDescription 1 dicom98 (300A,0018) DS DoseReferencePointCoordinates 3 dicom98 (300A,001A) DS NominalPriorDose 1 dicom98 (300A,0020) CS DoseReferenceType 1 dicom98 (300A,0021) DS ConstraintWeight 1 dicom98 (300A,0022) DS DeliveryWarningDose 1 dicom98 (300A,0023) DS DeliveryMaximumDose 1 dicom98 (300A,0025) DS TargetMinimumDose 1 dicom98 (300A,0026) DS TargetPrescriptionDose 1 dicom98 (300A,0027) DS TargetMaximumDose 1 dicom98 (300A,0028) DS TargetUnderdoseVolumeFraction 1 dicom98 (300A,002A) DS OrganAtRiskFullVolumeDose 1 dicom98 (300A,002B) DS OrganAtRiskLimitDose 1 dicom98 (300A,002C) DS OrganAtRiskMaximumDose 1 dicom98 (300A,002D) DS OrganAtRiskOverdoseVolumeFraction 1 dicom98 (300A,0040) SQ ToleranceTableSequence 1 dicom98 (300A,0042) IS ToleranceTableNumber 1 dicom98 (300A,0043) SH ToleranceTableLabel 1 dicom98 (300A,0044) DS GantryAngleTolerance 1 dicom98 (300A,0046) DS BeamLimitingDeviceAngleTolerance 1 dicom98 (300A,0048) SQ BeamLimitingDeviceToleranceSequence 1 dicom98 (300A,004A) DS BeamLimitingDevicePositionTolerance 1 dicom98 (300A,004C) DS PatientSupportAngleTolerance 1 dicom98 (300A,004E) DS TableTopEccentricAngleTolerance 1 dicom98 (300A,0051) DS TableTopVerticalPositionTolerance 1 dicom98 (300A,0052) DS TableTopLongitudinalPositionTolerance 1 dicom98 (300A,0053) DS TableTopLateralPositionTolerance 1 dicom98 (300A,0055) CS RTPlanRelationship 1 dicom98 (300A,0070) SQ FractionGroupSequence 1 dicom98 (300A,0071) IS FractionGroupNumber 1 dicom98 (300A,0072) LO FractionGroupDescription 1 dicom2004 (300A,0078) IS NumberOfFractionsPlanned 1 dicom98 # Name changed in CP 210, name was NumberOfFractionsPerDay before (300A,0079) IS NumberOfFractionPatternDigitsPerDay 1 dicom2001 (300A,007A) IS RepeatFractionCycleLength 1 dicom98 (300A,007B) LT FractionPattern 1 dicom98 (300A,0080) IS NumberOfBeams 1 dicom98 (300A,0082) DS BeamDoseSpecificationPoint 3 dicom98 (300A,0084) DS BeamDose 1 dicom98 (300A,0086) DS BeamMeterset 1 dicom98 (300A,00A0) IS NumberOfBrachyApplicationSetups 1 dicom98 (300A,00A2) DS BrachyApplicationSetupDoseSpecificationPoint 3 dicom98 (300A,00A4) DS BrachyApplicationSetupDose 1 dicom98 (300A,00B0) SQ BeamSequence 1 dicom98 (300A,00B2) SH TreatmentMachineName 1 dicom98 (300A,00B3) CS PrimaryDosimeterUnit 1 dicom98 (300A,00B4) DS SourceAxisDistance 1 dicom98 (300A,00B6) SQ BeamLimitingDeviceSequence 1 dicom98 (300A,00B8) CS RTBeamLimitingDeviceType 1 dicom98 (300A,00BA) DS SourceToBeamLimitingDeviceDistance 1 dicom98 (300A,00BC) IS NumberOfLeafJawPairs 1 dicom98 (300A,00BE) DS LeafPositionBoundaries 3-n dicom98 (300A,00C0) IS BeamNumber 1 dicom98 (300A,00C2) LO BeamName 1 dicom98 (300A,00C3) ST BeamDescription 1 dicom98 (300A,00C4) CS BeamType 1 dicom98 (300A,00C6) CS RadiationType 1 dicom98 (300A,00C7) CS HighDoseTechniqueType 1 dicom2001 (300A,00C8) IS ReferenceImageNumber 1 dicom98 (300A,00CA) SQ PlannedVerificationImageSequence 1 dicom98 (300A,00CC) LO ImagingDeviceSpecificAcquisitionParameters 1-n dicom98 (300A,00CE) CS TreatmentDeliveryType 1 dicom98 (300A,00D0) IS NumberOfWedges 1 dicom98 (300A,00D1) SQ WedgeSequence 1 dicom98 (300A,00D2) IS WedgeNumber 1 dicom98 (300A,00D3) CS WedgeType 1 dicom98 (300A,00D4) SH WedgeID 1 dicom98 (300A,00D5) IS WedgeAngle 1 dicom98 (300A,00D6) DS WedgeFactor 1 dicom98 (300A,00D8) DS WedgeOrientation 1 dicom98 (300A,00DA) DS SourceToWedgeTrayDistance 1 dicom98 (300A,00DC) SH BolusID 1 dicom2005 (300A,00DD) ST BolusDescription 1 dicom2005 (300A,00E0) IS NumberOfCompensators 1 dicom98 (300A,00E1) SH MaterialID 1 dicom98 (300A,00E2) DS TotalCompensatorTrayFactor 1 dicom98 (300A,00E3) SQ CompensatorSequence 1 dicom98 (300A,00E4) IS CompensatorNumber 1 dicom98 (300A,00E5) SH CompensatorID 1 dicom98 (300A,00E6) DS SourceToCompensatorTrayDistance 1 dicom98 (300A,00E7) IS CompensatorRows 1 dicom98 (300A,00E8) IS CompensatorColumns 1 dicom98 (300A,00E9) DS CompensatorPixelSpacing 2 dicom98 (300A,00EA) DS CompensatorPosition 2 dicom98 (300A,00EB) DS CompensatorTransmissionData 1-n dicom98 (300A,00EC) DS CompensatorThicknessData 1-n dicom98 (300A,00ED) IS NumberOfBoli 1 dicom98 (300A,00EE) CS CompensatorType 1 dicom99 (300A,00F0) IS NumberOfBlocks 1 dicom98 (300A,00F2) DS TotalBlockTrayFactor 1 dicom98 (300A,00F4) SQ BlockSequence 1 dicom98 (300A,00F5) SH BlockTrayID 1 dicom98 (300A,00F6) DS SourceToBlockTrayDistance 1 dicom98 (300A,00F8) CS BlockType 1 dicom98 (300A,00FA) CS BlockDivergence 1 dicom98 (300A,00FB) CS BlockMountingPosition 1 dicom2003 (300A,00FC) IS BlockNumber 1 dicom98 (300A,00FE) LO BlockName 1 dicom98 (300A,0100) DS BlockThickness 1 dicom98 (300A,0102) DS BlockTransmission 1 dicom98 (300A,0104) IS BlockNumberOfPoints 1 dicom98 (300A,0106) DS BlockData 2-2n dicom98 (300A,0107) SQ ApplicatorSequence 1 dicom98 (300A,0108) SH ApplicatorID 1 dicom98 (300A,0109) CS ApplicatorType 1 dicom98 (300A,010A) LO ApplicatorDescription 1 dicom98 (300A,010C) DS CumulativeDoseReferenceCoefficient 1 dicom98 (300A,010E) DS FinalCumulativeMetersetWeight 1 dicom98 (300A,0110) IS NumberOfControlPoints 1 dicom98 (300A,0111) SQ ControlPointSequence 1 dicom98 (300A,0112) IS ControlPointIndex 1 dicom98 (300A,0114) DS NominalBeamEnergy 1 dicom98 (300A,0115) DS DoseRateSet 1 dicom98 (300A,0116) SQ WedgePositionSequence 1 dicom98 (300A,0118) CS WedgePosition 1 dicom98 (300A,011A) SQ BeamLimitingDevicePositionSequence 1 dicom98 (300A,011C) DS LeafJawPositions 2-2n dicom98 (300A,011E) DS GantryAngle 1 dicom98 (300A,011F) CS GantryRotationDirection 1 dicom98 (300A,0120) DS BeamLimitingDeviceAngle 1 dicom98 (300A,0121) CS BeamLimitingDeviceRotationDirection 1 dicom98 (300A,0122) DS PatientSupportAngle 1 dicom98 (300A,0123) CS PatientSupportRotationDirection 1 dicom98 (300A,0124) DS TableTopEccentricAxisDistance 1 dicom98 (300A,0125) DS TableTopEccentricAngle 1 dicom98 (300A,0126) CS TableTopEccentricRotationDirection 1 dicom98 (300A,0128) DS TableTopVerticalPosition 1 dicom98 (300A,0129) DS TableTopLongitudinalPosition 1 dicom98 (300A,012A) DS TableTopLateralPosition 1 dicom98 (300A,012C) DS IsocenterPosition 3 dicom98 (300A,012E) DS SurfaceEntryPoint 3 dicom98 (300A,0130) DS SourceToSurfaceDistance 1 dicom98 (300A,0134) DS CumulativeMetersetWeight 1 dicom98 (300A,0180) SQ PatientSetupSequence 1 dicom98 (300A,0182) IS PatientSetupNumber 1 dicom98 (300A,0183) LO PatientSetupLabel 1 dicom2005 (300A,0184) LO PatientAdditionalPosition 1 dicom98 (300A,0190) SQ FixationDeviceSequence 1 dicom98 (300A,0192) CS FixationDeviceType 1 dicom98 (300A,0194) SH FixationDeviceLabel 1 dicom98 (300A,0196) ST FixationDeviceDescription 1 dicom98 (300A,0198) SH FixationDevicePosition 1 dicom98 (300A,0199) FL FixationDevicePitchAngle 1 dicom2005 (300A,019A) FL FixationDeviceRollAngle 1 dicom2005 (300A,01A0) SQ ShieldingDeviceSequence 1 dicom98 (300A,01A2) CS ShieldingDeviceType 1 dicom98 (300A,01A4) SH ShieldingDeviceLabel 1 dicom98 (300A,01A6) ST ShieldingDeviceDescription 1 dicom98 (300A,01A8) SH ShieldingDevicePosition 1 dicom98 (300A,01B0) CS SetupTechnique 1 dicom98 (300A,01B2) ST SetupTechniqueDescription 1 dicom98 (300A,01B4) SQ SetupDeviceSequence 1 dicom98 (300A,01B6) CS SetupDeviceType 1 dicom98 (300A,01B8) SH SetupDeviceLabel 1 dicom98 (300A,01BA) ST SetupDeviceDescription 1 dicom98 (300A,01BC) DS SetupDeviceParameter 1 dicom98 (300A,01D0) ST SetupReferenceDescription 1 dicom98 (300A,01D2) DS TableTopVerticalSetupDisplacement 1 dicom98 (300A,01D4) DS TableTopLongitudinalSetupDisplacement 1 dicom98 (300A,01D6) DS TableTopLateralSetupDisplacement 1 dicom98 (300A,0200) CS BrachyTreatmentTechnique 1 dicom98 (300A,0202) CS BrachyTreatmentType 1 dicom98 (300A,0206) SQ TreatmentMachineSequence 1 dicom98 (300A,0210) SQ SourceSequence 1 dicom98 (300A,0212) IS SourceNumber 1 dicom98 (300A,0214) CS SourceType 1 dicom98 (300A,0216) LO SourceManufacturer 1 dicom98 (300A,0218) DS ActiveSourceDiameter 1 dicom98 (300A,021A) DS ActiveSourceLength 1 dicom98 (300A,0222) DS SourceEncapsulationNominalThickness 1 dicom98 (300A,0224) DS SourceEncapsulationNominalTransmission 1 dicom98 (300A,0226) LO SourceIsotopeName 1 dicom98 (300A,0228) DS SourceIsotopeHalfLife 1 dicom98 (300A,022A) DS ReferenceAirKermaRate 1 dicom98 (300A,022C) DA AirKermaRateReferenceDate 1 dicom98 (300A,022E) TM AirKermaRateReferenceTime 1 dicom98 (300A,0230) SQ ApplicationSetupSequence 1 dicom98 (300A,0232) CS ApplicationSetupType 1 dicom98 (300A,0234) IS ApplicationSetupNumber 1 dicom98 (300A,0236) LO ApplicationSetupName 1 dicom98 (300A,0238) LO ApplicationSetupManufacturer 1 dicom98 (300A,0240) IS TemplateNumber 1 dicom98 (300A,0242) SH TemplateType 1 dicom98 (300A,0244) LO TemplateName 1 dicom98 (300A,0250) DS TotalReferenceAirKerma 1 dicom98 (300A,0260) SQ BrachyAccessoryDeviceSequence 1 dicom98 (300A,0262) IS BrachyAccessoryDeviceNumber 1 dicom98 (300A,0263) SH BrachyAccessoryDeviceID 1 dicom98 (300A,0264) CS BrachyAccessoryDeviceType 1 dicom98 (300A,0266) LO BrachyAccessoryDeviceName 1 dicom98 (300A,026A) DS BrachyAccessoryDeviceNominalThickness 1 dicom98 (300A,026C) DS BrachyAccessoryDeviceNominalTransmission 1 dicom98 (300A,0280) SQ ChannelSequence 1 dicom98 (300A,0282) IS ChannelNumber 1 dicom98 (300A,0284) DS ChannelLength 1 dicom98 (300A,0286) DS ChannelTotalTime 1 dicom98 (300A,0288) CS SourceMovementType 1 dicom98 (300A,028A) IS NumberOfPulses 1 dicom98 (300A,028C) DS PulseRepetitionInterval 1 dicom98 (300A,0290) IS SourceApplicatorNumber 1 dicom98 (300A,0291) SH SourceApplicatorID 1 dicom98 (300A,0292) CS SourceApplicatorType 1 dicom98 (300A,0294) LO SourceApplicatorName 1 dicom98 (300A,0296) DS SourceApplicatorLength 1 dicom98 (300A,0298) LO SourceApplicatorManufacturer 1 dicom98 (300A,029C) DS SourceApplicatorWallNominalThickness 1 dicom98 (300A,029E) DS SourceApplicatorWallNominalTransmission 1 dicom98 (300A,02A0) DS SourceApplicatorStepSize 1 dicom98 (300A,02A2) IS TransferTubeNumber 1 dicom98 (300A,02A4) DS TransferTubeLength 1 dicom98 (300A,02B0) SQ ChannelShieldSequence 1 dicom98 (300A,02B2) IS ChannelShieldNumber 1 dicom98 (300A,02B3) SH ChannelShieldID 1 dicom98 (300A,02B4) LO ChannelShieldName 1 dicom98 (300A,02B8) DS ChannelShieldNominalThickness 1 dicom98 (300A,02BA) DS ChannelShieldNominalTransmission 1 dicom98 (300A,02C8) DS FinalCumulativeTimeWeight 1 dicom98 (300A,02D0) SQ BrachyControlPointSequence 1 dicom98 (300A,02D2) DS ControlPointRelativePosition 1 dicom98 (300A,02D4) DS ControlPoint3DPosition 3 dicom98 (300A,02D6) DS CumulativeTimeWeight 1 dicom98 (300A,02E0) CS CompensatorDivergence 1 dicom2003 (300A,02E1) CS CompensatorMountingPosition 1 dicom2003 (300A,02E2) DS SourceToCompensatorDistance 1-n dicom2003 (300A,0401) SQ ReferencedSetupImageSequence 1 dicom2005 (300A,0402) ST SetupImageComment 1 dicom2005 (300C,0000) UL RTRelationshipGroupLength 1 dicom98 (300C,0002) SQ ReferencedRTPlanSequence 1 dicom98 (300C,0004) SQ ReferencedBeamSequence 1 dicom98 (300C,0006) IS ReferencedBeamNumber 1 dicom98 (300C,0007) IS ReferencedReferenceImageNumber 1 dicom98 (300C,0008) DS StartCumulativeMetersetWeight 1 dicom98 (300C,0009) DS EndCumulativeMetersetWeight 1 dicom98 (300C,000A) SQ ReferencedBrachyApplicationSetupSequence 1 dicom98 (300C,000C) IS ReferencedBrachyApplicationSetupNumber 1 dicom98 (300C,000E) IS ReferencedSourceNumber 1 dicom98 (300C,0020) SQ ReferencedFractionGroupSequence 1 dicom98 (300C,0022) IS ReferencedFractionGroupNumber 1 dicom98 (300C,0040) SQ ReferencedVerificationImageSequence 1 dicom98 (300C,0042) SQ ReferencedReferenceImageSequence 1 dicom98 (300C,0050) SQ ReferencedDoseReferenceSequence 1 dicom98 (300C,0051) IS ReferencedDoseReferenceNumber 1 dicom98 (300C,0055) SQ BrachyReferencedDoseReferenceSequence 1 dicom98 (300C,0060) SQ ReferencedStructureSetSequence 1 dicom98 (300C,006A) IS ReferencedPatientSetupNumber 1 dicom98 (300C,0080) SQ ReferencedDoseSequence 1 dicom98 (300C,00A0) IS ReferencedToleranceTableNumber 1 dicom98 (300C,00B0) SQ ReferencedBolusSequence 1 dicom98 (300C,00C0) IS ReferencedWedgeNumber 1 dicom98 (300C,00D0) IS ReferencedCompensatorNumber 1 dicom98 (300C,00E0) IS ReferencedBlockNumber 1 dicom98 (300C,00F0) IS ReferencedControlPointIndex 1 dicom98 (300C,00F2) SQ ReferencedControlPointSequence 1 dicom2005 (300C,00F4) IS ReferencedStartControlPointIndex 1 dicom2005 (300C,00F6) IS ReferencedStopControlPointIndex 1 dicom2005 (300E,0000) UL RTApprovalGroupLength 1 dicom98 (300E,0002) CS ApprovalStatus 1 dicom98 (300E,0004) DA ReviewDate 1 dicom98 (300E,0005) TM ReviewTime 1 dicom98 (300E,0008) PN ReviewerName 1 dicom98 (4008,0000) UL ResultsGroupLength 1 dicom98 (4008,0040) SH ResultsID 1 dicom98 (4008,0042) LO ResultsIDIssuer 1 dicom98 (4008,0050) SQ ReferencedInterpretationSequence 1 dicom98 (4008,0100) DA InterpretationRecordedDate 1 dicom98 (4008,0101) TM InterpretationRecordedTime 1 dicom98 (4008,0102) PN InterpretationRecorder 1 dicom98 (4008,0103) LO ReferenceToRecordedSound 1 dicom98 (4008,0108) DA InterpretationTranscriptionDate 1 dicom98 (4008,0109) TM InterpretationTranscriptionTime 1 dicom98 (4008,010A) PN InterpretationTranscriber 1 dicom98 (4008,010B) ST InterpretationText 1 dicom98 (4008,010C) PN InterpretationAuthor 1 dicom98 (4008,0111) SQ InterpretationApproverSequence 1 dicom98 (4008,0112) DA InterpretationApprovalDate 1 dicom98 (4008,0113) TM InterpretationApprovalTime 1 dicom98 (4008,0114) PN PhysicianApprovingInterpretation 1 dicom98 (4008,0115) LT InterpretationDiagnosisDescription 1 dicom98 (4008,0117) SQ InterpretationDiagnosisCodeSequence 1 dicom98 (4008,0118) SQ ResultsDistributionListSequence 1 dicom98 (4008,0119) PN DistributionName 1 dicom98 (4008,011A) LO DistributionAddress 1 dicom98 (4008,0200) SH InterpretationID 1 dicom98 (4008,0202) LO InterpretationIDIssuer 1 dicom98 (4008,0210) CS InterpretationTypeID 1 dicom98 (4008,0212) CS InterpretationStatusID 1 dicom98 (4008,0300) ST Impressions 1 dicom98 (4008,4000) ST ResultsComments 1 dicom98 (4FFE,0000) UL MACParametersGroupLength 1 dicom2001 (4FFE,0001) SQ MACParametersSequence 1 dicom2001 (5000-50ff,0000) UL CurveGroupLength 1 dicom98 (5000-50ff,0005) US CurveDimensions 1 dicom98 (5000-50ff,0010) US NumberOfPoints 1 dicom98 (5000-50ff,0020) CS TypeOfData 1 dicom98 (5000-50ff,0022) LO CurveDescription 1 dicom98 (5000-50ff,0030) SH AxisUnits 1-n dicom98 (5000-50ff,0040) SH AxisLabels 1-n dicom98 (5000-50ff,0103) US DataValueRepresentation 1 dicom98 (5000-50ff,0104) US MinimumCoordinateValue 1-n dicom98 (5000-50ff,0105) US MaximumCoordinateValue 1-n dicom98 (5000-50ff,0106) SH CurveRange 1-n dicom98 # VM for (5000-50ff,0110) CurveDataDescriptor was 1 in DICOM93. Changed in DICOM96. (5000-50ff,0110) US CurveDataDescriptor 1-n dicom98 # VM for (5000-50ff,0112) CoordinateStartValue was 1 in DICOM98. Changed in CP 293 (2001). (5000-50ff,0112) US CoordinateStartValue 1-n dicom2003 # VM for (5000-50ff,0114) CoordinateStepValue was 1 in DICOM98. Changed in CP 293 (2001). (5000-50ff,0114) US CoordinateStepValue 1-n dicom2003 (5000-50ff,1001) CS CurveActivationLayer 1 dicom2000 (5000-50ff,2000) US AudioType 1 dicom98 (5000-50ff,2002) US AudioSampleFormat 1 dicom98 (5000-50ff,2004) US NumberOfChannels 1 dicom98 (5000-50ff,2006) UL NumberOfSamples 1 dicom98 (5000-50ff,2008) UL SampleRate 1 dicom98 (5000-50ff,200A) UL TotalTime 1 dicom98 (5000-50ff,200C) ox AudioSampleData 1 dicom98 (5000-50ff,200E) LT AudioComments 1 dicom98 (5000-50ff,2500) LO CurveLabel 1 dicom98 # (5000-50ff,2600) is called ReferencedOverlaySequence in the standard, but this collides with tag (0008,1130) (5000-50ff,2600) SQ CurveReferencedOverlaySequence 1 dicom98 # (5000-50ff,2600) is called ReferencedOverlaySequence in the standard, but this collides with tag (0008,1130) (5000-50ff,2610) US ReferencedOverlayGroup 1 dicom98 (5000-50ff,3000) ox CurveData 1 dicom98 (5200,9229) SQ SharedFunctionalGroupsSequence 1 dicom2003 (5200,9230) SQ PerFrameFunctionalGroupsSequence 1 dicom2003 (5400,0000) UL WaveformDataGroupLength 1 dicom2000 (5400,0100) SQ WaveformSequence 1 dicom2000 (5400,0110) ox ChannelMinimumValue 1 dicom2000 (5400,0112) ox ChannelMaximumValue 1 dicom2000 (5400,1004) US WaveformBitsAllocated 1 dicom2000 (5400,1006) CS WaveformSampleInterpretation 1 dicom2000 (5400,100A) ox WaveformPaddingValue 1 dicom2000 (5400,1010) ox WaveformData 1 dicom2000 (5600,0010) OF FirstOrderPhaseCorrectionAngle 1 dicom2003 (5600,0020) OF SpectroscopyData 1 dicom2003 (6000-60ff,0000) UL OverlayGroupLength 1 dicom98 (6000-60ff,0010) US OverlayRows 1 dicom98 (6000-60ff,0011) US OverlayColumns 1 dicom98 (6000-60ff,0012) US OverlayPlanes 1 dicom98 (6000-60ff,0015) IS NumberOfFramesInOverlay 1 dicom98 (6000-60ff,0022) LO OverlayDescription 1 dicom98 (6000-60ff,0040) CS OverlayType 1 dicom98 (6000-60ff,0045) LO OverlaySubtype 1 dicom98 (6000-60ff,0050) SS OverlayOrigin 2 dicom98 (6000-60ff,0051) US ImageFrameOrigin 1 dicom98 (6000-60ff,0052) US OverlayPlaneOrigin 1 dicom98 (6000-60ff,0100) US OverlayBitsAllocated 1 dicom98 (6000-60ff,0102) US OverlayBitPosition 1 dicom98 (6000-60ff,1001) CS OverlayActivationLayer 1 dicom2000 (6000-60ff,1301) IS ROIArea 1 dicom98 (6000-60ff,1302) DS ROIMean 1 dicom98 (6000-60ff,1303) DS ROIStandardDeviation 1 dicom98 (6000-60ff,1500) LO OverlayLabel 1 dicom98 # VM of (6000-60ff,3000) OverlayData was OW in dicom93. Changed to OB/OW in dicom2000 (Supplement 33). (6000-60ff,3000) ox OverlayData 1 dicom2000 (7FE0,0000) UL PixelDataGroupLength 1 dicom98 (7FE0,0010) ox PixelData 1 dicom98 (FFFA,FFFA) SQ DigitalSignaturesSequence 1 dicom2001 (FFFC,FFFC) OB DataSetTrailingPadding 1 dicom98 (FFFE,E000) na Item 1 dicom98 (FFFE,E00D) na ItemDelimitationItem 1 dicom98 (FFFE,E0DD) na SequenceDelimitationItem 1 dicom98 # #--------------------------------------------------------------------------- # # Private Creator Data Elements # (0009-o-ffff,0000) UL PrivateGroupLength 1 PRIVATE (0009-o-ffff,0001) UL PrivateGroupLengthToEnd 1 PRIVATE (0009-o-ffff,0010-u-00ff) LO PrivateCreator 1 PRIVATE (0001-o-0007,0000) UL IllegalGroupLength 1 ILLEGAL (0001-o-0007,0001) UL IllegalGroupLengthToEnd 1 ILLEGAL (0001-o-0007,0010-u-00ff) LO IllegalPrivateCreator 1 ILLEGAL # #--------------------------------------------------------------------------- # # A "catch all" for group length elements # (0000-u-ffff,0000) UL GenericGroupLength 1 GENERIC (0000-u-ffff,0001) UL GenericGroupLengthToEnd 1 GENERIC # #--------------------------------------------------------------------------- # # Retired data elements from previous editions of the DICOM standard # # cannot find reference to (0000,1007), maybe it stems from an early pre-1993 DICOM draft. # (0000,1007) AT RETIRED_ModificationList 1-n DICOM93 (0008,0042) CS RETIRED_NuclearMedicineSeriesType 1 DICOM93 (0008,2110) CS RETIRED_LossyImageCompression 1 DICOM93 (0008,2200) CS RETIRED_TransducerPosition 1 DICOM93 (0008,2204) CS RETIRED_TransducerOrientation 1 DICOM93 (0008,2208) CS RETIRED_AnatomicStructure 1 DICOM93 (0018,0030) LO RETIRED_Radionuclide 1-n DICOM93 (0018,0032) DS RETIRED_EnergyWindowCenterline 1 DICOM93 (0018,0033) DS RETIRED_EnergyWindowTotalWidth 1-n DICOM93 (0018,1146) DS RETIRED_RotationOffset 1-n DICOM93 # retired in CP 207 (2001) (0018,0037) CS RETIRED_TherapyType 1 dicom98 # retired in CP 159 (2004) (0018,0039) CS RETIRED_TherapyDescription 1 dicom2004 # retired in CP 422 (2004) (0018,5210) DS RETIRED_Image Transformation Matrix 6 dicom2004 # retired in CP 422 (2004) (0018,5212) DS RETIRED_Image Translation Vector 3 dicom2004 # retired in CP 303 (2001) (0018,6038) UL RETIRED_DopplerSampleVolumeXPosition 1 dicom2003 # retired in CP 303 (2001) (0018,603A) UL RETIRED_DopplerSampleVolumeYPosition 1 dicom2003 # retired in CP 303 (2001) (0018,603C) UL RETIRED_TMLinePositionX0 1 dicom2003 # retired in CP 303 (2001) (0018,603E) UL RETIRED_TMLinePositionY0 1 dicom2003 # retired in CP 303 (2001) (0018,6040) UL RETIRED_TMLinePositionX1 1 dicom2003 # retired in CP 303 (2001) (0018,6042) UL RETIRED_TMLinePositionY1 1 dicom2003 (0018,9096) FD RETIRED_ParallelReductionFactorInPlane 1 dicom2003 # Attribute (0018,9195) renamed and retired in CP 386 (03/2004), was ChemicalShiftsMinimumIntegrationLimit before (0018,9195) FD RETIRED_ChemicalShiftsMinimumIntegrationLimitInHz 1 dicom2003 # Attribute (0018,9196) renamed and retired in CP 386 (03/2004), was ChemicalShiftsMaximumIntegrationLimit before (0018,9196) FD RETIRED_ChemicalShiftsMaximumIntegrationLimitInHz 1 dicom2003 (0020,0014) IS RETIRED_IsotopeNumber 1 DICOM93 (0020,0015) IS RETIRED_PhaseNumber 1 DICOM93 (0020,0016) IS RETIRED_IntervalNumber 1 DICOM93 (0020,0017) IS RETIRED_TimeSlotNumber 1 DICOM93 (0020,0018) IS RETIRED_AngleNumber 1 DICOM93 # retired in CP 207 (2001) (0028,6030) US RETIRED_MaskPointers 1-n dicom98 # retired in CP 207 (2001) (0040,0307) DS RETIRED_DistanceSourceToSupport 1 dicom99 # retired in CP 207 (2001) (0040,0330) SQ RETIRED_ReferencedProcedureStepSequence 1 dicom98 # Attribute (0040,2001) retired in CP 409 (03/2004) (0040,2001) LO RETIRED_ReasonForTheImagingServiceRequest 1 dicom98 # retired in CP 163 (1999) (0040,2006) SH RETIRED_PlacerOrderNumberImagingServiceRequest 1 dicom98 # retired in CP 163 (1999) (0040,2007) SH RETIRED_FillerOrderNumberImagingServiceRequest 1 dicom98 # retired in CP 275 (2001) (0040,DB06) DT RETIRED_TemplateVersion 1 dicom2003 # retired in CP 275 (2001) (0040,DB07) DT RETIRED_TemplateLocalVersion 1 dicom2003 # retired in CP 275 (2001) (0040,DB0B) CS RETIRED_TemplateExtensionFlag 1 dicom2003 # retired in CP 275 (2001) (0040,DB0C) UI RETIRED_TemplateExtensionOrganizationUID 1 dicom2003 # retired in CP 275 (2001) (0040,DB0D) UI RETIRED_TemplateExtensionCreatorUID 1 dicom2003 # (2020,0130) ReferencedOverlayBoxSequence was retired in Supplement 35 (1999) (2020,0130) SQ RETIRED_ReferencedImageOverlayBoxSequence 1 dicom98 # (2020,0140) ReferencedVOILUTSequence was retired in Supplement 35 (1999) (2020,0140) SQ RETIRED_ReferencedVOILUTBoxSequence 1 dicom98 # Attribute (2040,0500) is retired by Correction Proposal 53. It is a duplicate of (2010,0510). (2040,0500) SQ RETIRED_ReferencedImageBoxSequence 1 DICOM93 (6000-60ff,1100) US RETIRED_OverlayDescriptorGray 1 DICOM93 (6000-60ff,1101) US RETIRED_OverlayDescriptorRed 1 DICOM93 (6000-60ff,1102) US RETIRED_OverlayDescriptorGreen 1 DICOM93 (6000-60ff,1103) US RETIRED_OverlayDescriptorBlue 1 DICOM93 (6000-60ff,1200) US RETIRED_OverlayGray 1-n DICOM93 (6000-60ff,1201) US RETIRED_OverlayRed 1-n DICOM93 (6000-60ff,1202) US RETIRED_OverlayGreen 1-n DICOM93 (6000-60ff,1203) US RETIRED_OverlayBlue 1-n DICOM93 # #--------------------------------------------------------------------------- # # Retired data elements from ACR/NEMA 2 (1988) # (0000,0001) UL ACR_NEMA_CommandGroupLengthToEnd 1 ACR/NEMA2 (0000,0010) CS ACR_NEMA_CommandRecognitionCode 1 ACR/NEMA2 (0000,0200) LO ACR_NEMA_Initiator 1 ACR/NEMA2 (0000,0300) LO ACR_NEMA_Receiver 1 ACR/NEMA2 (0000,0400) LO ACR_NEMA_FindLocation 1 ACR/NEMA2 (0000,0850) US ACR_NEMA_NumberOfMatches 1 ACR/NEMA2 (0000,0860) US ACR_NEMA_ResponseSequenceNumber 1 ACR/NEMA2 (0000,4000) LO ACR_NEMA_DialogReceiver 1 ACR/NEMA2 (0000,4010) LO ACR_NEMA_TerminalType 1 ACR/NEMA2 (0000,5010) LO ACR_NEMA_MessageSetID 1 ACR/NEMA2 (0000,5020) LO ACR_NEMA_EndMessageSet 1 ACR/NEMA2 (0000,5110) LO ACR_NEMA_DisplayFormat 1 ACR/NEMA2 (0000,5120) LO ACR_NEMA_PagePositionID 1 ACR/NEMA2 (0000,5130) LO ACR_NEMA_TextFormatID 1 ACR/NEMA2 (0000,5140) CS ACR_NEMA_NormalReverse 1 ACR/NEMA2 (0000,5150) CS ACR_NEMA_AddGrayScale 1 ACR/NEMA2 (0000,5160) CS ACR_NEMA_Borders 1 ACR/NEMA2 (0000,5170) IS ACR_NEMA_Copies 1 ACR/NEMA2 (0000,5180) LO ACR_NEMA_MagnificationType 1 ACR/NEMA2 (0000,5190) LO ACR_NEMA_Erase 1-n ACR/NEMA2 (0000,51A0) CS ACR_NEMA_Print 1 ACR/NEMA2 (0000,51B0) US ACR_NEMA_Overlays 1-n ACR/NEMA2 (0008,0001) UL ACR_NEMA_IdentifyingGroupLengthToEnd 1 ACR/NEMA2 (0008,0010) LO ACR_NEMA_RecognitionCode 1 ACR/NEMA2 (0008,0040) US ACR_NEMA_OldDataSetType 1 ACR/NEMA2 (0008,0041) LO ACR_NEMA_DataSetSubtype 1 ACR/NEMA2 (0008,1000) LO ACR_NEMA_NetworkID 1 ACR/NEMA2 (0008,4000) LT ACR_NEMA_IdentifyingComments 1-n ACR/NEMA2 (0010,1050) LT ACR_NEMA_InsurancePlanIdentification 1-n ACR/NEMA2 (0018,1240) IS ACR_NEMA_UpperLowerPixelValues 1-n ACR/NEMA2 (0018,4000) LT ACR_NEMA_AcquisitionComments 1-n ACR/NEMA2 (0018,5030) DS ACR_NEMA_DynamicRange 1 ACR/NEMA2 (0018,5040) DS ACR_NEMA_TotalGain 1 ACR/NEMA2 (0020,0030) DS ACR_NEMA_ImagePosition 3 ACR/NEMA2 (0020,0035) DS ACR_NEMA_ImageOrientation 6 ACR/NEMA2 (0020,0050) DS ACR_NEMA_Location 1 ACR/NEMA2 (0020,0070) LO ACR_NEMA_ImageGeometryType 1 ACR/NEMA2 (0020,0080) LO ACR_NEMA_MaskingImage 1-n ACR/NEMA2 (0020,1001) IS ACR_NEMA_AcquisitionsInSeries 1 ACR/NEMA2 (0020,1003) IS ACR_NEMA_ImagesInSeries 1 ACR/NEMA2 (0020,1005) IS ACR_NEMA_ImagesInStudy 1 ACR/NEMA2 (0020,1020) LO ACR_NEMA_Reference 1-n ACR/NEMA2 (0020,3100-31FF) LO ACR_NEMA_SourceImageID 1-n ACR/NEMA2 (0020,3401) LO ACR_NEMA_ModifyingDeviceID 1 ACR/NEMA2 (0020,3402) LO ACR_NEMA_ModifiedImageID 1 ACR/NEMA2 (0020,3403) DA ACR_NEMA_ModifiedImageDate 1 ACR/NEMA2 (0020,3404) LO ACR_NEMA_ModifyingDeviceManufacturer 1 ACR/NEMA2 (0020,3405) TM ACR_NEMA_ModifiedImageTime 1 ACR/NEMA2 (0020,3406) LO ACR_NEMA_ModifiedImageDescription 1 ACR/NEMA2 (0020,5000) AT ACR_NEMA_OriginalImageIdentification 1-n ACR/NEMA2 (0020,5002) LO ACR_NEMA_OriginalImageIdentificationNomenclature 1-n ACR/NEMA2 (0028,0005) US ACR_NEMA_ImageDimensions 1 ACR/NEMA2 (0028,0040) CS ACR_NEMA_ImageFormat 1 ACR/NEMA2 (0028,0050) LO ACR_NEMA_ManipulatedImage 1-n ACR/NEMA2 (0028,0060) CS ACR_NEMA_CompressionCode 1 ACR/NEMA2 (0028,0104) xs ACR_NEMA_SmallestValidPixelValue 1 ACR/NEMA2 (0028,0105) xs ACR_NEMA_LargestValidPixelValue 1 ACR/NEMA2 (0028,0200) US ACR_NEMA_ImageLocation 1 ACR/NEMA2 (0028,1080) CS ACR_NEMA_GrayScale 1 ACR/NEMA2 (0028,1100) xs ACR_NEMA_GrayLookupTableDescriptor 3 ACR/NEMA2 (0028,1200) xs ACR_NEMA_GrayLookupTableData 1-n ACR/NEMA2 (0028,4000) LT ACR_NEMA_ImagePresentationComments 1-n ACR/NEMA2 (4000,0000) UL ACR_NEMA_TextGroupLength 1 ACR/NEMA2 (4000,0010) LT ACR_NEMA_TextArbitrary 1-n ACR/NEMA2 (4000,4000) LT ACR_NEMA_TextComments 1-n ACR/NEMA2 (6000-60ff,0110) CS ACR_NEMA_OverlayFormat 1 ACR/NEMA2 (6000-60ff,0200) US ACR_NEMA_OverlayLocation 1 ACR/NEMA2 (6000-60ff,4000) LT ACR_NEMA_OverlayComments 1-n ACR/NEMA2 # #--------------------------------------------------------------------------- # # Retired data elements from the ACR/NEMA 2 compression enhancements # (0028,005F) CS ACR_NEMA_2C_CompressionRecognitionCode 1 ACR/NEMA2C (0028,0061) SH ACR_NEMA_2C_CompressionOriginator 1 ACR/NEMA2C (0028,0062) SH ACR_NEMA_2C_CompressionLabel 1 ACR/NEMA2C (0028,0063) SH ACR_NEMA_2C_CompressionDescription 1 ACR/NEMA2C (0028,0065) CS ACR_NEMA_2C_CompressionSequence 1-n ACR/NEMA2C (0028,0066) AT ACR_NEMA_2C_CompressionStepPointers 1-n ACR/NEMA2C (0028,0068) US ACR_NEMA_2C_RepeatInterval 1 ACR/NEMA2C (0028,0069) US ACR_NEMA_2C_BitsGrouped 1 ACR/NEMA2C (0028,0070) US ACR_NEMA_2C_PerimeterTable 1-n ACR/NEMA2C (0028,0071) xs ACR_NEMA_2C_PerimeterValue 1 ACR/NEMA2C (0028,0080) US ACR_NEMA_2C_PredictorRows 1 ACR/NEMA2C (0028,0081) US ACR_NEMA_2C_PredictorColumns 1 ACR/NEMA2C (0028,0082) US ACR_NEMA_2C_PredictorConstants 1-n ACR/NEMA2C (0028,0090) CS ACR_NEMA_2C_BlockedPixels 1 ACR/NEMA2C (0028,0091) US ACR_NEMA_2C_BlockRows 1 ACR/NEMA2C (0028,0092) US ACR_NEMA_2C_BlockColumns 1 ACR/NEMA2C (0028,0093) US ACR_NEMA_2C_RowOverlap 1 ACR/NEMA2C (0028,0094) US ACR_NEMA_2C_ColumnOverlap 1 ACR/NEMA2C (0028,0400) CS ACR_NEMA_2C_TransformLabel 1 ACR/NEMA2C (0028,0401) CS ACR_NEMA_2C_TransformVersionNumber 1 ACR/NEMA2C (0028,0402) US ACR_NEMA_2C_NumberOfTransformSteps 1 ACR/NEMA2C (0028,0403) CS ACR_NEMA_2C_SequenceOfCompressedData 1-n ACR/NEMA2C (0028,0404) AT ACR_NEMA_2C_DetailsOfCoefficients 1-n ACR/NEMA2C (0028,0410) US ACR_NEMA_2C_RowsForNthOrderCoefficients 1 ACR/NEMA2C (0028,0411) US ACR_NEMA_2C_ColumnsForNthOrderCoefficients 1 ACR/NEMA2C (0028,0412) CS ACR_NEMA_2C_CoefficientCoding 1-n ACR/NEMA2C (0028,0413) AT ACR_NEMA_2C_CoefficientCodingPointers 1-n ACR/NEMA2C (0028,0700) CS ACR_NEMA_2C_DCTLabel 1 ACR/NEMA2C (0028,0701) CS ACR_NEMA_2C_DataBlockDescription 1-n ACR/NEMA2C (0028,0702) AT ACR_NEMA_2C_DataBlock 1-n ACR/NEMA2C (0028,0710) US ACR_NEMA_2C_NormalizationFactorFormat 1 ACR/NEMA2C (0028,0720) US ACR_NEMA_2C_ZonalMapNumberFormat 1 ACR/NEMA2C (0028,0721) AT ACR_NEMA_2C_ZonalMapLocation 1-n ACR/NEMA2C (0028,0722) US ACR_NEMA_2C_ZonalMapFormat 1 ACR/NEMA2C (0028,0730) US ACR_NEMA_2C_AdaptiveMapFormat 1 ACR/NEMA2C (0028,0740) US ACR_NEMA_2C_CodeNumberFormat 1 ACR/NEMA2C (0028,0800) CS ACR_NEMA_2C_CodeLabel 1-n ACR/NEMA2C (0028,0802) US ACR_NEMA_2C_NumberOfTables 1 ACR/NEMA2C (0028,0803) AT ACR_NEMA_2C_CodeTableLocation 1-n ACR/NEMA2C (0028,0804) US ACR_NEMA_2C_BitsForCodeWord 1 ACR/NEMA2C (0028,0808) AT ACR_NEMA_2C_ImageDataLocation 1-n ACR/NEMA2C (1000,0000) UL ACR_NEMA_2C_CodeTableGroupLength 1 ACR/NEMA2C (1000,0010) US ACR_NEMA_2C_EscapeTriplet 3 ACR/NEMA2C (1000,0011) US ACR_NEMA_2C_RunLengthTriplet 3 ACR/NEMA2C (1000,0012) US ACR_NEMA_2C_HuffmanTableSize 1 ACR/NEMA2C (1000,0013) US ACR_NEMA_2C_HuffmanTableTriplet 3 ACR/NEMA2C (1000,0014) US ACR_NEMA_2C_ShiftTableSize 1 ACR/NEMA2C (1000,0015) US ACR_NEMA_2C_ShiftTableTriplet 3 ACR/NEMA2C (1010,0000) UL ACR_NEMA_2C_ZonalMapGroupLength 1 ACR/NEMA2C (1010,0004) US ACR_NEMA_2C_ZonalMap 1-n ACR/NEMA2C (6000-60ff,0060) CS ACR_NEMA_2C_OverlayCompressionCode 1 ACR/NEMA2C (6000-60ff,0061) SH ACR_NEMA_2C_OverlayCompressionOriginator 1 ACR/NEMA2C (6000-60ff,0062) SH ACR_NEMA_2C_OverlayCompressionLabel 1 ACR/NEMA2C (6000-60ff,0063) SH ACR_NEMA_2C_OverlayCompressionDescription 1 ACR/NEMA2C (6000-60ff,0066) AT ACR_NEMA_2C_OverlayCompressionStepPointers 1-n ACR/NEMA2C (6000-60ff,0068) US ACR_NEMA_2C_OverlayRepeatInterval 1 ACR/NEMA2C (6000-60ff,0069) US ACR_NEMA_2C_OverlayBitsGrouped 1 ACR/NEMA2C (6000-60ff,0800) CS ACR_NEMA_2C_OverlayCodeLabel 1-n ACR/NEMA2C (6000-60ff,0802) US ACR_NEMA_2C_OverlayNumberOfTables 1 ACR/NEMA2C (6000-60ff,0803) AT ACR_NEMA_2C_OverlayCodeTableLocation 1-n ACR/NEMA2C (6000-60ff,0804) US ACR_NEMA_2C_OverlayBitsForCodeWord 1 ACR/NEMA2C (7F00-7fff,0000) UL ACR_NEMA_2C_VariablePixelDataGroupLength 1 ACR/NEMA2C (7F00-7fff,0010) ox ACR_NEMA_2C_VariablePixelData 1 ACR/NEMA2C (7F00-7fff,0011) AT ACR_NEMA_2C_VariableNextDataGroup 1 ACR/NEMA2C (7F00-7fff,0020) OW ACR_NEMA_2C_VariableCoefficientsSDVN 1-n ACR/NEMA2C (7F00-7fff,0030) OW ACR_NEMA_2C_VariableCoefficientsSDHN 1-n ACR/NEMA2C (7F00-7fff,0040) OW ACR_NEMA_2C_VariableCoefficientsSDDN 1-n ACR/NEMA2C (7FE0,0020) OW ACR_NEMA_2C_CoefficientsSDVN 1-n ACR/NEMA2C (7FE0,0030) OW ACR_NEMA_2C_CoefficientsSDHN 1-n ACR/NEMA2C (7FE0,0040) OW ACR_NEMA_2C_CoefficientsSDDN 1-n ACR/NEMA2C # # EOF # xmedcon-0.14.1/libs/dicom/dict-discovery.dic0000644000175000017510000003274710657155103015631 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: dict-discovery.dic # # # # DICOM DICT: Medical Image Conversion Utility # # # # purpose : dicom dictionary for GE Discovery files # # dependent : Private tags based on: # #http://www.gehealthcare.com/usen/interoperability/dicom/docs/5161694_100r2.pdf # author : Josh Wilson # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: dict-discovery.dic,v 1.0 2007/07/12 # # Comments have a '#' at the beginning of the line. # # Tag VR Name VM Version # # This first part if Private PET tags (0009,1002) LO PatientID 2 GEMS (0009,1005) DT PatientDateTime 1 GEMS (0009,1006) SL Type 1 GEMS (0009,100A) UI ScanID 1 GEMS (0009,100D) DT ScanDateTime 1 GEMS (0009,100E) DT ScanReady 1 GEMS (0009,1013) UI ForIdentifier 1 GEMS (0009,1014) LO LandmarkName 1 GEMS (0009,1015) SH LandmarkAbbrev 1 GEMS (0009,1016) SL PatientPosition 1 GEMS (0009,1017) SL ScanPerspective 1 GEMS (0009,1018) SL ScanType 1 GEMS (0009,1019) SL ScanMode 1 GEMS (0009,101A) SL StartCondition 1 GEMS (0009,101B) SL StartCondData 1 GEMS (0009,101C) SL SelStopCond 1 GEMS (0009,101D) SL SelStopCondData 1 GEMS (0009,101E) SL CollectDeadtime 1 GEMS (0009,101F) SL CollectSingles 1 GEMS (0009,1020) SL CollectCountrate 1 GEMS (0009,1021) SL CountratePeriod 1 GEMS (0009,1022) SL DelayedEvents 1 GEMS (0009,1023) SL DelayedBias 1 GEMS (0009,1024) SL WordSize 1 GEMS (0009,1025) SL AxialAcceptance 1 GEMS (0009,1026) SL AxialAngle3d 1 GEMS (0009,1027) SL ThetaCompression 1 GEMS (0009,1028) SL AxialCompression 1 GEMS (0009,1029) FL GantryTiltAngle 1 GEMS (0009,102A) SL Collimation 1 GEMS (0009,102B) SL ScanFov 1 GEMS (0009,102C) SL AxialFov 1 GEMS (0009,102D) SL EventSeparation 1 GEMS (0009,102E) SL MaskWidth 1 GEMS (0009,102F) SL BinningMode 1 GEMS (0009,1030) SL TrigRejMethod 1 GEMS (0009,1031) SL NumberForReject 1 GEMS (0009,1032) SL LowerRejectLimit 1 GEMS (0009,1033) SL UpperRejectLimit 1 GEMS (0009,1034) SL TriggersAcquired 1 GEMS (0009,1035) SL TriggersRejected 1 GEMS (0009,1036) LO TracerName 1 GEMS (0009,1037) LO BatchDescription 1 GEMS (0009,1038) FL TracerActivity 1 GEMS (0009,1039) DT MeasDatetime 1 GEMS (0009,103A) FL PreInjVolume 1 GEMS (0009,103B) DT AdminDatetime 1 GEMS (0009,103C) FL PostInjActivity 1 GEMS (0009,103D) DT PostInjDatetime 1 GEMS (0009,103E) SH RadionuclideName 1 GEMS (0009,103F) FL HalfLife 1 GEMS (0009,1040) FL PositronFraction 1 GEMS (0009,1041) SL Source1Holder 1 GEMS (0009,1042) FL Source1Activity 1 GEMS (0009,1043) DT Source1MeasDt 1 GEMS (0009,1044) SH Source1Radnuclide 1 GEMS (0009,1045) FL Source1HalfLife 1 GEMS (0009,1046) SL Source2Holder 1 GEMS (0009,1047) FL Source2Activity 1 GEMS (0009,1048) DT Source2MeasDt 1 GEMS (0009,1049) SH Source2Radnuclide 1 GEMS (0009,104A) FL Source2HalfLife 1 GEMS (0009,104B) SL SourceSpeed 1 GEMS (0009,104C) FL SourceLocation 1 GEMS (0009,104D) SL EmissionPresent 1 GEMS (0009,104E) SL LowerAxialAcc 1 GEMS (0009,104F) SL UpperAxialAcc 1 GEMS (0009,1050) SL LowerCoincLimit 1 GEMS (0009,1051) SL UpperCoincLimit 1 GEMS (0009,1052) SL CoincDelayOffset 1 GEMS (0009,1053) SL CoincOutputMode 1 GEMS (0009,1054) SL UpperEnergyLimit 1 GEMS (0009,1055) SL LowerEnergyLimit 1 GEMS (0009,1056) UI NormalCalId 1 GEMS (0009,1057) UI Normal2dCalId 1 GEMS (0009,1058) UI BlankCalId 1 GEMS (0009,1059) UI WcCalId 1 GEMS (0009,105A) SL Derived 1 GEMS (0009,105B) LO ContrastAgent 1 GEMS (0009,10CB) FL VqcXAxisTrans 1 GEMS (0009,10CC) FL VqcXAxisTilt 1 GEMS (0009,10CD) FL VqcYAxisTrans 1 GEMS (0009,10CE) FL VqcYAxisSwivel 1 GEMS (0009,10CF) FL VqcZAxisTrans 1 GEMS (0009,10D0) FL VqcZAxisRoll 1 GEMS (0009,10D1) LO CtacConvScale 1 GEMS (0009,10D2) UI ImageSetId 1 GEMS (0009,10D3) SL ConstrastRoute 1 GEMS (0009,10D6) FL ImageOneLoc 1 GEMS (0009,10D7) FL ImageIndexLoc 1 GEMS (0009,10DD) US NumOfRrInterval 1 GEMS (0009,10DE) US NumOfTimeSlots 1 GEMS (0009,10DF) US NumOfSlices 1 GEMS (0009,10E0) US NumOfTimeSlices 1 GEMS (0009,10E2) SL RestStress 1 GEMS (0009,105C) UI FrameId 1 GEMS (0009,105D) UI ScanId 1 GEMS (0009,105E) UI ExamId 1 GEMS (0009,105F) LO PatientId 1 GEMS (0009,1060) SH CompatibleVersion 1 GEMS (0009,1061) SH SoftwareVersion 1 GEMS (0009,1062) ST WhereIsFrame 1 GEMS (0009,1063) SL FrameSize 1 GEMS (0009,1064) SL FileExists 1 GEMS (0009,1065) SL PatientEntry 1 GEMS (0009,1066) FL TableHeight 1 GEMS (0009,1067) FL TableZPosition 1 GEMS (0009,1068) DT LandmarkDatetime 1 GEMS (0009,1069) SL SliceCount 1 GEMS (0009,106A) FL StartLocation 1 GEMS (0009,106B) SL AcqDelay 1 GEMS (0009,106C) DT AcqStart 1 GEMS (0009,106D) SL AcqDuration 1 GEMS (0009,106E) SL AcqBinDur 1 GEMS (0009,106F) SL AcqBinStart 1 GEMS (0009,1070) SL ActualStopCond 1 GEMS (0009,1071) FD TotalPrompts 1 GEMS (0009,1072) FD TotalDelays 1 GEMS (0009,1073) SL FrameValid 1 GEMS (0009,1074) SL ValidityInfo 1 GEMS (0009,1075) SL Archived 1 GEMS (0009,1076) SL Compression 1 GEMS (0009,1077) SL UncompressedSize 1 GEMS (0009,1078) SL AccumBinDur 1 GEMS (0009,10D8) SL FrameNumber 1 GEMS (0009,10D9) SL ListFileExists 1 GEMS (0009,10DA) ST WhereIsListFrame 1 GEMS (0009,10E1) SL UnlistedScan 1 GEMS (0009,10E3) FL PhasePercentage 1 GEMS (0009,10E8) SL AcqBinNum 1 GEMS (0009,10E9) FL AcqBinDurPercent 1 GEMS (0009,1079) SH CompatibleVersion 1 GEMS (0009,107A) SH SoftwareVersion 1 GEMS (0009,107B) DT IsDatetime 1 GEMS (0009,107C) SL IsSource 1 GEMS (0009,107D) SL IsContents 1 GEMS (0009,107E) SL IsType 1 GEMS (0009,107F) DS IsReference 3 GEMS (0009,1080) SL MultiPatient 1 GEMS (0009,1081) SL NumberOfNormals 1 GEMS (0009,1082) UI ColorMapId 1 GEMS (0009,1083) SL WindowLevelType 1 GEMS (0009,1084) FL Rotate 1 GEMS (0009,1085) SL Flip 1 GEMS (0009,1086) FL Zoom 1 GEMS (0009,1087) SL PanX 1 GEMS (0009,1088) SL PanY 1 GEMS (0009,1089) FL WindowLevelMin 1 GEMS (0009,108A) FL WindowLevelMax 1 GEMS (0009,108B) SL ReconMethod 1 GEMS (0009,108C) SL Attenuation 1 GEMS (0009,108D) FL AttenCoefficient 1 GEMS (0009,108E) SL BpFilter 1 GEMS (0009,108F) FL BpFilterCutoff 1 GEMS (0009,1090) SL BpFilterOrder 1 GEMS (0009,1091) FL BpCenterL 1 GEMS (0009,1092) FL BpCenterP 1 GEMS (0009,1093) SL AttenSmooth 1 GEMS (0009,1094) SL AttenSmoothParam 1 GEMS (0009,1095) SL AngleSmoothParam 1 GEMS (0009,1096) UI WellcountercalId 1 GEMS (0009,1097) UI TransScanId 1 GEMS (0009,1098) UI NormCalId 1 GEMS (0009,1099) UI BlnkCalId 1 GEMS (0009,109A) FL CacEdgeThreshold 1 GEMS (0009,109B) FL CacSkullOffset 1 GEMS (0009,109C) UI EmissSubId 1 GEMS (0009,109D) SL RadialFilter3d 1 GEMS (0009,109E) FL RadialCutoff3d 1 GEMS (0009,109F) SL AxialFilter3d 1 GEMS (0009,10A0) FL AxialCutoff3d 1 GEMS (0009,10A1) FL AxialStart 1 GEMS (0009,10A2) FL AxialSpacing 1 GEMS (0009,10A3) SL AxialAnglesUsed 1 GEMS (0009,10B2) SL IrNumIterations 1 GEMS (0009,10B3) SL IrNumSubsets 1 GEMS (0009,10B4) FL IrReconFov 1 GEMS (0009,10B5) SL IrCorrModel 1 GEMS (0009,10B6) SL IrLoopFilter 1 GEMS (0009,10B7) FL IrPreFiltParm 1 GEMS (0009,10B8) SL IrLoopFiltParm 1 GEMS (0009,10B9) FL ResponseFiltParm 1 GEMS (0009,10BA) SL PostFilter 1 GEMS (0009,10BB) FL PostFiltParm 1 GEMS (0009,10BC) SL IrRegularize 1 GEMS (0009,10BD) FL RegularizeParm 1 GEMS (0009,10BE) SL AcBpFilter 1 GEMS (0009,10BF) FL AcBpFiltCutOff 1 GEMS (0009,10C0) SL AcBpFiltOrder 1 GEMS (0009,10C1) SL AcImgSmooth 1 GEMS (0009,10C2) FL AcImgSmoothParm 1 GEMS (0009,10C3) SL ScatterMethod 1 GEMS (0009,10C4) SL ScatterNumIter 1 GEMS (0009,10C5) FL ScatterParm 1 GEMS (0009,10D4) LO CtacConvScale 1 GEMS (0009,10D5) FL LoopFilterParm 1 GEMS (0009,10A4) SH CompatibleVersion 1 GEMS (0009,10A5) SH SoftwareVersion 1 GEMS (0009,10A6) SL SliceNumber 1 GEMS (0009,10A7) FL TotalCounts 1 GEMS (0009,10A8) OB OtherAtts 1 GEMS (0009,10A9) SL OtherAttsSize 1 GEMS (0009,10AA) SL Archived 1 GEMS (0009,10AB) FL BpCenterX 1 GEMS (0009,10AC) FL BpCenterY 1 GEMS (0009,10AD) UI TransFrameId 1 GEMS (0009,10AE) UI TpluseFrameId 1 GEMS (0009,10B1) FL ProfileSpacing 1 GEMS (0009,10C6) FL SegQcParm 1 GEMS (0009,10C7) SL Overlap 1 GEMS (0009,10C8) UI OvlpFrmId 1 GEMS (0009,10C9) UI OvlpTransFrmId 1 GEMS (0009,10CA) UI OvlpTpulseFrmId 1 GEMS (0009,10DB) SL IrZFilterFlag 1 GEMS (0009,10DC) FL IrZFilterRatio 1 GEMS (0009,10E5) FL LeftShift 1 GEMS (0009,10E6) FL PosteriorShift 1 GEMS (0009,10E7) FL SuperiorShift 1 GEMS (0009,10E8) SL AcqBinNum 1 GEMS (0009,10E9) FL AcqBinDurPercent 1 GEMS (0017,1001) UI CorrectionCalId 1 GEMS (0017,1002) SH CompatibleVersion 1 GEMS (0017,1003) SH SoftwareVersion 1 GEMS (0017,1004) DT CalDatetime 1 GEMS (0017,1005) LO CalDescription 1 GEMS (0017,1006) SL CalType 1 GEMS (0017,1007) ST WhereIsCorr 1 GEMS (0017,1008) SL CorrFileSize 1 GEMS (0017,1009) LO ScanId 1 GEMS (0017,100A) DT ScanDatetime 1 GEMS (0017,100B) LO Norm2dCalId 1 GEMS (0017,100C) SH HospIdentifier 1 GEMS (0017,100D) SL Archived 1 GEMS (0019,1004) DT CalDateTime 1 GEMS # Beyond here are Private CT Tags (0009,1001) LO FullFidelity 1 GEMS (0009,1004) SH ProductID 1 GEMS (0019,1002) SL NumberOfCellsIInDetector 1 GEMS (0019,1003) DS CellNumberAtTheta 1 GEMS (0019,100F) DS HorizFrameOfRef 1 GEMS (0019,1011) SS SeriesContrast 1 GEMS (0019,1018) LO FirstScanRas 1 GEMS (0019,101A) LO LastScanRas 1 GEMS (0019,1023) DS TableSpeed 1 GEMS (0019,1024) DS MidScanTime 1 GEMS (0019,1025) SS MidScanFlag 1 GEMS (0019,1026) SL DegreesOfAzimuth 1 GEMS (0019,1027) DS GantryPeriod 1 GEMS (0019,102C) SL NumberOfTriggers 1 GEMS (0019,102E) DS AngleOfFirstView 1 GEMS (0019,102F) DS TriggerFrequency 1 GEMS (0019,1039) SS ScanFOVType 1 GEMS (0019,1042) SS SegmentNumber 1 GEMS (0019,1043) SS TotalSegmentsRequested 1 GEMS (0019,1047) SS ViewCompressionFactor 1 GEMS (0019,1052) SS ReconPostProcFlag 1 GEMS (0019,106A) SS DependentOnNumViewsProcessed 1 GEMS (0021,1003) SS SeriesFromWhichPrescribed 1 GEMS (0021,1035) SS SeriesPrescribedFrom 1 GEMS (0021,1036) SS ImagePrescribedFrom 1 GEMS (0021,1091) SS BiopsyPosition 1 GEMS (0021,1092) FL BiopsyTLocation 1 GEMS (0021,1093) FL BiopsyRefLocation 1 GEMS (0023,1070) FD StartTimeSecsInFirstAxial 1 GEMS (0027,1010) SS ScoutType 1 GEMS (0027,101C) SL VmaMamp 1 GEMS (0027,101E) SL VmaMod 1 GEMS (0027,101F) SL VmaClip 1 GEMS (0027,1020) SS SmartScanOnOffFlag 1 GEMS (0027,1035) SS PlaneType 1 GEMS (0027,1042) FL CenterRCoordOfPlaneImage 1 GEMS (0027,1043) FL CenterACoordOfPlaneImage 1 GEMS (0027,1044) FL CenterSCoordOfPlaneImage 1 GEMS (0027,1045) FL NormalRCoord 1 GEMS (0027,1046) FL NormalACoord 1 GEMS (0027,1047) FL NormalSCoord 1 GEMS (0027,1050) FL TableStartLocation 1 GEMS (0027,1051) FL TableEndLocation 1 GEMS (0043,1064) LO ReconFilter 1 GEMS (0043,1010) US WindowValue 1 GEMS (0043,1012) SS X-RayChain 3 GEMS (0043,1016) SS NumberOfOverranges 5 GEMS (0043,101E) DS DeltaStartTime 1 GEMS (0043,101F) SL MaxOverrangesInAView 1 GEMS (0043,1021) SS CorrectedAfterGlowTerms 1 GEMS (0043,1025) SS ReferenceChannels 6 GEMS (0043,1026) US NoViewsRefChansBlocked 6 GEMS (0043,1027) SH ScanPitchRatio 1 GEMS (0043,1028) OB UniqueImageIden 1 GEMS (0043,102B) SS PrivateScanOptions 4 GEMS (0043,1031) DS RACordOfTargetReconCenter 2 GEMS (0043,1040) FL TriggerOnPosition 4 GEMS (0043,1041) FL DegreeOfRotation 4 GEMS (0043,1042) SL DASTriggerSource 4 GEMS (0043,1043) SL DASFpaGain 4 GEMS (0043,1044) SL DASOutputSource 4 GEMS (0043,1045) SL DASAdInput 4 GEMS (0043,1046) SL DASCalMode 4 GEMS (0043,104D) FL StartScanToX-RayOnDelay 4 GEMS (0043,104E) FL DurationOfX-RayOn 4 GEMS (0045,1001) SS NumberOfMacroRowsInDetector 1 GEMS (0045,1002) FL MacroWidthAtISOCenter 1 GEMS (0045,1003) SS DASType 1 GEMS (0045,1004) SS DASGain 1 GEMS (0045,1005) SS DASTemprature 1 GEMS (0045,1006) CS TableDirection 1 GEMS (0045,1007) FL ZSmoothingFactor 1 GEMS (0045,1008) SS ViewWeightingMode 1 GEMS (0045,1009) SS SigmaRowNumber 1 GEMS (0045,100A) FL MinimumDASValue 1 GEMS (0045,100B) FL MaximumOffsetValue 1 GEMS (0045,100C) SS NumberOfViewsShifted 1 GEMS (0045,100D) SS ZTrackingFlag 1 GEMS (0045,100E) FL MeanZError 1 GEMS (0045,100F) FL ZTrackingError 1 GEMS (0045,1010) SS StartView2A 1 GEMS (0045,1011) SS NumberOfViews2A 1 GEMS (0045,1012) SS StartView1A 1 GEMS (0045,1013) SS SigmaMode 1 GEMS (0045,1014) SS NumberOfViews1A 1 GEMS (0045,1015) SS StartView2B 1 GEMS (0045,1016) SS NumberViews2B 1 GEMS (0045,1017) SS StartView1B 1 GEMS (0045,1018) SS NumberOfViews1B 1 GEMS (0045,1021) SS IterboneFlag 1 GEMS (0045,1022) SS PerisstalticFlag 1 GEMS (0045,1030) CS Cardiacreconalgorithm 1 GEMS (0045,1031) CS Avgheartrateforimage 1 GEMS (0045,1032) FL Temporalresolution 1 GEMS (0045,1033) CS Pctrpeakdelay 1 GEMS (0045,1036) CS Ekgfullmastartphase 1 GEMS (0045,1037) CS Ekgfullmaendphase 1 GEMS (0045,1038) CS Kgmodulationmaxma 1 GEMS (0045,1039) CS Ekgmodulationminma 1 GEMS (0045,103B) LO Noisereductionimagefilterdesc 1 GEMS (0049,1001) SQ CTCardiacSequence 1 GEMS (0049,1002) CS Heartrateatconfirm 1 GEMS (0049,1003) FL Avgheartratepriortoconfirm 1 GEMS (0049,1004) CS Minheartratepriortoconfirm 1 GEMS (0049,1005) CS Maxheartratepriortoconfirm 1 GEMS (0049,1006) FL Stddevheartratepriortoconfirm 1 GEMS (0049,1007) US Numheartratesamplespriortoconfirm 1 GEMS (0049,1008) CS Autoheartratedetectpredict 1 GEMS (0049,1009) CS Systemoptimizedheartrate 1 GEMS (0049,100A) ST Ekgmonitortype 1 GEMS (0049,100B) CS Numreconsectors 1 GEMS (0049,100C) FL Rpeaktimestamps 256 GEMS # xmedcon-0.14.1/libs/dicom/Makefile.in0000644000175000017510000005314012637622762014265 00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @DO_DICM_TRUE@noinst_PROGRAMS = $(am__EXEEXT_1) subdir = libs/dicom DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp \ $(noinst_HEADERS) COPYING.LIB ChangeLog README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/source/m-depend.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libdicom_la_LIBADD = am_libdicom_la_OBJECTS = log.lo basic.lo dictionary.lo single.lo \ bit.lo transform.lo image.lo zoom.lo process.lo decomp.lo libdicom_la_OBJECTS = $(am_libdicom_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = @DO_DICM_TRUE@am_libdicom_la_rpath = am__EXEEXT_1 = parse$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) parse_SOURCES = parse.c parse_OBJECTS = parse.$(OBJEXT) parse_LDADD = $(LDADD) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/source depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libdicom_la_SOURCES) parse.c DIST_SOURCES = $(libdicom_la_SOURCES) parse.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DECOMPRESS = @DECOMPRESS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_ACR = @ENABLE_ACR@ ENABLE_ANLZ = @ENABLE_ANLZ@ ENABLE_CONC = @ENABLE_CONC@ ENABLE_DICM = @ENABLE_DICM@ ENABLE_ECAT = @ENABLE_ECAT@ ENABLE_GIF = @ENABLE_GIF@ ENABLE_INTF = @ENABLE_INTF@ ENABLE_INW = @ENABLE_INW@ ENABLE_NIFTI = @ENABLE_NIFTI@ ENABLE_PNG = @ENABLE_PNG@ ENABLE_TPC = @ENABLE_TPC@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIBMDCETC = @GLIBMDCETC@ GLIBSUPPORTED = @GLIBSUPPORTED@ GREP = @GREP@ GTKONE = @GTKONE@ GTKSUPPORTED = @GTKSUPPORTED@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NIFTI_CFLAGS = @NIFTI_CFLAGS@ NIFTI_LDFLAGS = @NIFTI_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PNG_CFLAGS = @PNG_CFLAGS@ PNG_LDFLAGS = @PNG_LDFLAGS@ PNG_LIBS = @PNG_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TPC_CFLAGS = @TPC_CFLAGS@ TPC_LDFLAGS = @TPC_LDFLAGS@ VERSION = @VERSION@ XMDCETC = @XMDCETC@ XMEDCON_DATE = @XMEDCON_DATE@ XMEDCON_GLIB_CFLAGS = @XMEDCON_GLIB_CFLAGS@ XMEDCON_GLIB_LIBS = @XMEDCON_GLIB_LIBS@ XMEDCON_GTK_CFLAGS = @XMEDCON_GTK_CFLAGS@ XMEDCON_GTK_LIBS = @XMEDCON_GTK_LIBS@ XMEDCON_LIBVERS = @XMEDCON_LIBVERS@ XMEDCON_MAJOR = @XMEDCON_MAJOR@ XMEDCON_MICRO = @XMEDCON_MICRO@ XMEDCON_MINOR = @XMEDCON_MINOR@ XMEDCON_PRGR = @XMEDCON_PRGR@ XMEDCON_VERSION = @XMEDCON_VERSION@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LDFLAGS = @ZLIB_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_sizeof_int = @ac_cv_sizeof_int@ ac_cv_sizeof_long = @ac_cv_sizeof_long@ ac_cv_sizeof_long_long = @ac_cv_sizeof_long_long@ ac_cv_sizeof_short = @ac_cv_sizeof_short@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mdc_cv_bigendian = @mdc_cv_bigendian@ mdc_cv_enable_lnglng = @mdc_cv_enable_lnglng@ mdc_cv_glibsupport = @mdc_cv_glibsupport@ mdc_cv_gui = @mdc_cv_gui@ mdc_cv_include_acr = @mdc_cv_include_acr@ mdc_cv_include_anlz = @mdc_cv_include_anlz@ mdc_cv_include_conc = @mdc_cv_include_conc@ mdc_cv_include_dicm = @mdc_cv_include_dicm@ mdc_cv_include_ecat = @mdc_cv_include_ecat@ mdc_cv_include_gif = @mdc_cv_include_gif@ mdc_cv_include_intf = @mdc_cv_include_intf@ mdc_cv_include_inw = @mdc_cv_include_inw@ mdc_cv_include_nifti = @mdc_cv_include_nifti@ mdc_cv_include_png = @mdc_cv_include_png@ mdc_cv_include_tpc = @mdc_cv_include_tpc@ mdc_cv_ljpg = @mdc_cv_ljpg@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = gnu DICTDATA = dictionary.data DICTSQ = dictionary.SQ DICTSRC = dicom.dic DICTSTD = dict-dicom.dic DICTXTR = dict-gemsi.dic dict-vision.dic dict-discovery.dic PARSE = parse @DO_LJPG_TRUE@LJPG_DIR = ../ljpg @DO_LJPG_TRUE@LJPG_INC = -I$(LJPG_DIR) @DO_LJPG_TRUE@LJPG_DEF = -DMDC_SUPPORT_LJPG @DO_DICM_TRUE@noinst_LTLIBRARIES = libdicom.la libdicom_la_SOURCES = \ log.c \ basic.c \ dictionary.c \ single.c \ bit.c \ transform.c \ image.c \ zoom.c \ process.c \ decomp.c noinst_HEADERS = dicom.h AM_CPPFLAGS = $(LJPG_INC) AM_CFLAGS = $(LJPG_DEF) CLEANFILES = $(DICTSRC) $(DICTDATA) $(DICTSQ) $(PARSE) EXTRA_DIST = $(DICTSTD) $(DICTXTR) $(PARSE).c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libs/dicom/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu libs/dicom/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libdicom.la: $(libdicom_la_OBJECTS) $(libdicom_la_DEPENDENCIES) $(EXTRA_libdicom_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) $(am_libdicom_la_rpath) $(libdicom_la_OBJECTS) $(libdicom_la_LIBADD) $(LIBS) clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list parse$(EXEEXT): $(parse_OBJECTS) $(parse_DEPENDENCIES) $(EXTRA_parse_DEPENDENCIES) @rm -f parse$(EXEEXT) $(AM_V_CCLD)$(LINK) $(parse_OBJECTS) $(parse_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bit.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decomp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dictionary.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/process.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/single.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transform.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zoom.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLTLIBRARIES clean-noinstPROGRAMS \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am dodicts: $(CC) -o $(PARSE) $(PARSE).c ./$(PARSE) < $(DICTSRC) > $(DICTDATA) fgrep SQ $(DICTSRC) | ./$(PARSE) > $(DICTSQ) rm -f $(PARSE) rmdicts: rm -f $(DICTDATA) $(DICTSQ) $(PARSE) $(DICTSRC): $(DICTSTD) $(DICTXTR) cat $(DICTSTD) $(DICTXTR) | grep -v "^#" > $(DICTSRC) $(DICTDATA): $(PARSE) $(DICTSRC) ./$(PARSE) < $(DICTSRC) > $(DICTDATA) $(DICTSQ): $(PARSE) $(DICTSRC) fgrep SQ $(DICTSRC) | ./$(PARSE) > $(DICTSQ) basic.c: $(DICTSQ) dictionary.c: $(DICTDATA) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xmedcon-0.14.1/libs/Makefile.in0000644000175000017510000004775512637622762013211 00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = libs DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ChangeLog README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/source/m-depend.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = ljpg dicom nifti tpc DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DECOMPRESS = @DECOMPRESS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_ACR = @ENABLE_ACR@ ENABLE_ANLZ = @ENABLE_ANLZ@ ENABLE_CONC = @ENABLE_CONC@ ENABLE_DICM = @ENABLE_DICM@ ENABLE_ECAT = @ENABLE_ECAT@ ENABLE_GIF = @ENABLE_GIF@ ENABLE_INTF = @ENABLE_INTF@ ENABLE_INW = @ENABLE_INW@ ENABLE_NIFTI = @ENABLE_NIFTI@ ENABLE_PNG = @ENABLE_PNG@ ENABLE_TPC = @ENABLE_TPC@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIBMDCETC = @GLIBMDCETC@ GLIBSUPPORTED = @GLIBSUPPORTED@ GREP = @GREP@ GTKONE = @GTKONE@ GTKSUPPORTED = @GTKSUPPORTED@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NIFTI_CFLAGS = @NIFTI_CFLAGS@ NIFTI_LDFLAGS = @NIFTI_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PNG_CFLAGS = @PNG_CFLAGS@ PNG_LDFLAGS = @PNG_LDFLAGS@ PNG_LIBS = @PNG_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TPC_CFLAGS = @TPC_CFLAGS@ TPC_LDFLAGS = @TPC_LDFLAGS@ VERSION = @VERSION@ XMDCETC = @XMDCETC@ XMEDCON_DATE = @XMEDCON_DATE@ XMEDCON_GLIB_CFLAGS = @XMEDCON_GLIB_CFLAGS@ XMEDCON_GLIB_LIBS = @XMEDCON_GLIB_LIBS@ XMEDCON_GTK_CFLAGS = @XMEDCON_GTK_CFLAGS@ XMEDCON_GTK_LIBS = @XMEDCON_GTK_LIBS@ XMEDCON_LIBVERS = @XMEDCON_LIBVERS@ XMEDCON_MAJOR = @XMEDCON_MAJOR@ XMEDCON_MICRO = @XMEDCON_MICRO@ XMEDCON_MINOR = @XMEDCON_MINOR@ XMEDCON_PRGR = @XMEDCON_PRGR@ XMEDCON_VERSION = @XMEDCON_VERSION@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LDFLAGS = @ZLIB_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_sizeof_int = @ac_cv_sizeof_int@ ac_cv_sizeof_long = @ac_cv_sizeof_long@ ac_cv_sizeof_long_long = @ac_cv_sizeof_long_long@ ac_cv_sizeof_short = @ac_cv_sizeof_short@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mdc_cv_bigendian = @mdc_cv_bigendian@ mdc_cv_enable_lnglng = @mdc_cv_enable_lnglng@ mdc_cv_glibsupport = @mdc_cv_glibsupport@ mdc_cv_gui = @mdc_cv_gui@ mdc_cv_include_acr = @mdc_cv_include_acr@ mdc_cv_include_anlz = @mdc_cv_include_anlz@ mdc_cv_include_conc = @mdc_cv_include_conc@ mdc_cv_include_dicm = @mdc_cv_include_dicm@ mdc_cv_include_ecat = @mdc_cv_include_ecat@ mdc_cv_include_gif = @mdc_cv_include_gif@ mdc_cv_include_intf = @mdc_cv_include_intf@ mdc_cv_include_inw = @mdc_cv_include_inw@ mdc_cv_include_nifti = @mdc_cv_include_nifti@ mdc_cv_include_png = @mdc_cv_include_png@ mdc_cv_include_tpc = @mdc_cv_include_tpc@ mdc_cv_ljpg = @mdc_cv_ljpg@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @DO_LJPG_TRUE@DIR_LJPG = ljpg @DO_DICM_TRUE@DIR_DICM = dicom @DO_NIFTI_INTERNAL_TRUE@@DO_NIFTI_TRUE@DIR_NIFTI = nifti @DO_TPC_INTERNAL_TRUE@@DO_TPC_TRUE@DIR_TPC = tpc SUBDIRS = $(DIR_LJPG) $(DIR_DICM) $(DIR_NIFTI) $(DIR_TPC) all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libs/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu libs/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xmedcon-0.14.1/acinclude.m40000644000175000017510000000346712156175250012363 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: acinclude.m4 # # # # UTILITY text: Medical Image Conversion Utility # # # # purpose : m4 macro's for configure script # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # dnl Define some (X)MedCon macro's dnl MDC_CHECK_GLIBSUPPORT(GLIBSUPPORT) dnl check GLIB package AC_DEFUN([MDC_CHECK_GLIBSUPPORT],[ AC_MSG_CHECKING([for glib support]) if test x$1 = xyes; then if test x$ac_cv_prog_glib = xno ; then GLIBSUPPORTED=0 GLIBMDCETC="" mdc_cv_glibsupport=no else GLIBSUPPORTED=1 if test x${prefix} != xNONE ; then GLIBMDCETC=${prefix}/etc else GLIBMDCETC=${ac_default_prefix}/etc fi fi fi if test x$mdc_cv_glibsupport = xno; then GLIBSUPPORTED=0 GLIBMDCETC="" echo "no" else echo "yes" fi ]) dnl MDC_CHECK_GUI(GTKSUPPORTED) AC_DEFUN([MDC_CHECK_GUI],[ AC_MSG_CHECKING([for GUI support]) if test $1 -eq 1; then if test x${prefix} != xNONE ; then XMDCETC=${prefix}/etc else XMDCETC=${ac_default_prefix}/etc fi mdc_cv_gui=yes echo "yes" else XMDCETC="" mdc_cv_gui=no echo "no" fi ]) dnl Get answer to set variable AC_DEFUN([ReadAnswer],[ read answ if test x$answ = xn -o x$answ = xno -o x$answ = xN -o x$answ = xNO; then echo "no" else echo "yes" fi ]) xmedcon-0.14.1/ltconfig0000755000175000017510000027432607176601715011737 00000000000000#! /bin/sh # ltconfig - Create a system-specific libtool. # Copyright (C) 1996-1999 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # A lot of this script is taken from autoconf-2.10. # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} echo=echo if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell. exec "$SHELL" "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null`} case X$UNAME in *-DOS) PATH_SEPARATOR=';' ;; *) PATH_SEPARATOR=':' ;; esac fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if (echo_test_string="`eval $cmd`") 2>/dev/null && echo_test_string="`eval $cmd`" && (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then break fi done fi if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for dir in $PATH /usr/ucb; do if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then echo="$dir/echo" break fi done IFS="$save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then # This shell has a builtin print -r that does the trick. echo='print -r' elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running ltconfig again with it. ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}" export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} else # Try using printf. echo='printf "%s\n"' if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then # Cool, printf works : elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL" export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL echo="$CONFIG_SHELL $0 --fallback-echo" elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then echo="$CONFIG_SHELL $0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then break fi prev="$cmd" done if test "$prev" != 'sed 50q "$0"'; then echo_test_string=`eval $prev` export echo_test_string exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"} else # Oops. We lost completely, so just stick with echo. echo=echo fi fi fi fi fi # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='sed -e s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # The name of this program. progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` # Constants: PROGRAM=ltconfig PACKAGE=libtool VERSION=1.3.4 TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)" ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' rm="rm -f" help="Try \`$progname --help' for more information." # Global variables: default_ofile=libtool can_build_shared=yes enable_shared=yes # All known linkers require a `.a' archive for static linking (except M$VC, # which needs '.lib'). enable_static=yes enable_fast_install=yes enable_dlopen=unknown enable_win32_dll=no ltmain= silent= srcdir= ac_config_guess= ac_config_sub= host= nonopt= ofile="$default_ofile" verify_host=yes with_gcc=no with_gnu_ld=no need_locks=yes ac_ext=c objext=o libext=a exeext= cache_file= old_AR="$AR" old_CC="$CC" old_CFLAGS="$CFLAGS" old_CPPFLAGS="$CPPFLAGS" old_LDFLAGS="$LDFLAGS" old_LD="$LD" old_LN_S="$LN_S" old_LIBS="$LIBS" old_NM="$NM" old_RANLIB="$RANLIB" old_DLLTOOL="$DLLTOOL" old_OBJDUMP="$OBJDUMP" old_AS="$AS" # Parse the command line options. args= prev= for option do case "$option" in -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then eval "$prev=\$option" prev= continue fi case "$option" in --help) cat <&2 echo "$help" 1>&2 exit 1 ;; *) if test -z "$ltmain"; then ltmain="$option" elif test -z "$host"; then # This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 # if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then # echo "$progname: warning \`$option' is not a valid host type" 1>&2 # fi host="$option" else echo "$progname: too many arguments" 1>&2 echo "$help" 1>&2 exit 1 fi ;; esac done if test -z "$ltmain"; then echo "$progname: you must specify a LTMAIN file" 1>&2 echo "$help" 1>&2 exit 1 fi if test ! -f "$ltmain"; then echo "$progname: \`$ltmain' does not exist" 1>&2 echo "$help" 1>&2 exit 1 fi # Quote any args containing shell metacharacters. ltconfig_args= for arg do case "$arg" in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ltconfig_args="$ltconfig_args '$arg'" ;; *) ltconfig_args="$ltconfig_args $arg" ;; esac done # A relevant subset of AC_INIT. # File descriptor usage: # 0 standard input # 1 file creation # 2 errors and warnings # 3 some systems may open it to /dev/tty # 4 used on the Kubota Titan # 5 compiler messages saved in config.log # 6 checking for... messages and results if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>>./config.log # NLS nuisances. # Only set LANG and LC_ALL to C if already set. # These must not be set unconditionally because not all systems understand # e.g. LANG=C (notably SCO). if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi if test -n "$cache_file" && test -r "$cache_file"; then echo "loading cache $cache_file within ltconfig" . $cache_file fi if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi if test -z "$srcdir"; then # Assume the source directory is the same one as the path to LTMAIN. srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'` test "$srcdir" = "$ltmain" && srcdir=. fi trap "$rm conftest*; exit 1" 1 2 15 if test "$verify_host" = yes; then # Check for config.guess and config.sub. ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/config.guess; then ac_aux_dir=$ac_dir break fi done if test -z "$ac_aux_dir"; then echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 echo "$help" 1>&2 exit 1 fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub # Make sure we can run config.sub. if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then : else echo "$progname: cannot run $ac_config_sub" 1>&2 echo "$help" 1>&2 exit 1 fi echo $ac_n "checking host system type""... $ac_c" 1>&6 host_alias=$host case "$host_alias" in "") if host_alias=`$SHELL $ac_config_guess`; then : else echo "$progname: cannot guess host type; you must specify one" 1>&2 echo "$help" 1>&2 exit 1 fi ;; esac host=`$SHELL $ac_config_sub $host_alias` echo "$ac_t$host" 1>&6 # Make sure the host verified. test -z "$host" && exit 1 elif test -z "$host"; then echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 echo "$help" 1>&2 exit 1 else host_alias=$host fi # Transform linux* to *-*-linux-gnu*, to support old configure scripts. case "$host_os" in linux-gnu*) ;; linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` esac host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` case "$host_os" in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Determine commands to create old-style static archives. old_archive_cmds='$AR cru $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= # Set a sane default for `AR'. test -z "$AR" && AR=ar # Set a sane default for `OBJDUMP'. test -z "$OBJDUMP" && OBJDUMP=objdump # If RANLIB is not set, then run the test. if test "${RANLIB+set}" != "set"; then result=no echo $ac_n "checking for ranlib... $ac_c" 1>&6 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then RANLIB="ranlib" result="ranlib" break fi done IFS="$save_ifs" echo "$ac_t$result" 1>&6 fi if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" fi # Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin. test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$AS" && AS=as # Check to see if we are using GCC. if test "$with_gcc" != yes || test -z "$CC"; then # If CC is not set, then try to find GCC or a usable CC. if test -z "$CC"; then echo $ac_n "checking for gcc... $ac_c" 1>&6 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then CC="gcc" break fi done IFS="$save_ifs" if test -n "$CC"; then echo "$ac_t$CC" 1>&6 else echo "$ac_t"no 1>&6 fi fi # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". if test -z "$CC"; then echo $ac_n "checking for cc... $ac_c" 1>&6 IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" cc_rejected=no for dir in $PATH; do test -z "$dir" && dir=. if test -f $dir/cc || test -f $dir/cc$ac_exeext; then if test "$dir/cc" = "/usr/ucb/cc"; then cc_rejected=yes continue fi CC="cc" break fi done IFS="$save_ifs" if test $cc_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $CC shift if test $# -gt 0; then # We chose a different compiler from the bogus one. # However, it has the same name, so the bogon will be chosen # first if we set CC to just the name; use the full file name. shift set dummy "$dir/cc" "$@" shift CC="$@" fi fi if test -n "$CC"; then echo "$ac_t$CC" 1>&6 else echo "$ac_t"no 1>&6 fi if test -z "$CC"; then echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 exit 1 fi fi # Now see if the compiler is really GCC. with_gcc=no echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 echo "$progname:581: checking whether we are using GNU C" >&5 $rm conftest.c cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then with_gcc=yes fi $rm conftest.c echo "$ac_t$with_gcc" 1>&6 fi # Allow CC to be a program name with arguments. set dummy $CC compiler="$2" echo $ac_n "checking for object suffix... $ac_c" 1>&6 $rm conftest* echo 'int i = 1;' > conftest.c echo "$progname:603: checking for object suffix" >& 5 if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then # Append any warnings to the config.log. cat conftest.err 1>&5 for ac_file in conftest.*; do case $ac_file in *.c) ;; *) objext=`echo $ac_file | sed -e s/conftest.//` ;; esac done else cat conftest.err 1>&5 echo "$progname: failed program was:" >&5 cat conftest.c >&5 fi $rm conftest* echo "$ac_t$objext" 1>&6 echo $ac_n "checking for executable suffix... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_exeext="no" $rm conftest* echo 'main () { return 0; }' > conftest.c echo "$progname:629: checking for executable suffix" >& 5 if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then # Append any warnings to the config.log. cat conftest.err 1>&5 for ac_file in conftest.*; do case $ac_file in *.c | *.err | *.$objext ) ;; *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;; esac done else cat conftest.err 1>&5 echo "$progname: failed program was:" >&5 cat conftest.c >&5 fi $rm conftest* fi if test "X$ac_cv_exeext" = Xno; then exeext="" else exeext="$ac_cv_exeext" fi echo "$ac_t$ac_cv_exeext" 1>&6 echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 pic_flag= special_shlib_compile_flags= wl= link_static_flag= no_builtin_flag= if test "$with_gcc" = yes; then wl='-Wl,' link_static_flag='-static' case "$host_os" in beos* | irix5* | irix6* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; aix*) # Below there is a dirty hack to force normal static linking with -ldl # The problem is because libdl dynamically linked with both libc and # libC (AIX C++ library), which obviously doesn't included in libraries # list by gcc. This cause undefined symbols with -static flags. # This hack allows C programs to be linked with "-static -ldl", but # we not sure about C++ programs. link_static_flag="$link_static_flag ${wl}-lC" ;; cygwin* | mingw* | os2*) # We can build DLLs from non-PIC. ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. pic_flag='-m68020 -resident32 -malways-restore-a4' ;; sysv4*MP*) if test -d /usr/nec; then pic_flag=-Kconform_pic fi ;; *) pic_flag='-fPIC' ;; esac else # PORTME Check for PIC flags for the system compiler. case "$host_os" in aix3* | aix4*) # All AIX code is PIC. link_static_flag='-bnso -bI:/lib/syscalls.exp' ;; hpux9* | hpux10* | hpux11*) # Is there a better link_static_flag that works with the bundled CC? wl='-Wl,' link_static_flag="${wl}-a ${wl}archive" pic_flag='+Z' ;; irix5* | irix6*) wl='-Wl,' link_static_flag='-non_shared' # PIC (with -KPIC) is the default. ;; cygwin* | mingw* | os2*) # We can build DLLs from non-PIC. ;; osf3* | osf4* | osf5*) # All OSF/1 code is PIC. wl='-Wl,' link_static_flag='-non_shared' ;; sco3.2v5*) pic_flag='-Kpic' link_static_flag='-dn' special_shlib_compile_flags='-belf' ;; solaris*) pic_flag='-KPIC' link_static_flag='-Bstatic' wl='-Wl,' ;; sunos4*) pic_flag='-PIC' link_static_flag='-Bstatic' wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) pic_flag='-KPIC' link_static_flag='-Bstatic' wl='-Wl,' ;; uts4*) pic_flag='-pic' link_static_flag='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then pic_flag='-Kconform_pic' link_static_flag='-Bstatic' fi ;; *) can_build_shared=no ;; esac fi if test -n "$pic_flag"; then echo "$ac_t$pic_flag" 1>&6 # Check to make sure the pic_flag actually works. echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 $rm conftest* echo "int some_variable = 0;" > conftest.c save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $pic_flag -DPIC" echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5 if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then # Append any warnings to the config.log. cat conftest.err 1>&5 case "$host_os" in hpux9* | hpux10* | hpux11*) # On HP-UX, both CC and GCC only warn that PIC is supported... then they # create non-PIC objects. So, if there were any warnings, we assume that # PIC is not supported. if test -s conftest.err; then echo "$ac_t"no 1>&6 can_build_shared=no pic_flag= else echo "$ac_t"yes 1>&6 pic_flag=" $pic_flag" fi ;; *) echo "$ac_t"yes 1>&6 pic_flag=" $pic_flag" ;; esac else # Append any errors to the config.log. cat conftest.err 1>&5 can_build_shared=no pic_flag= echo "$ac_t"no 1>&6 fi CFLAGS="$save_CFLAGS" $rm conftest* else echo "$ac_t"none 1>&6 fi # Check to see if options -o and -c are simultaneously supported by compiler echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6 $rm -r conftest 2>/dev/null mkdir conftest cd conftest $rm conftest* echo "int some_variable = 0;" > conftest.c mkdir out # According to Tom Tromey, Ian Lance Taylor reported there are C compilers # that will create temporary files in the current directory regardless of # the output directory. Thus, making CWD read-only will cause this test # to fail, enabling locking or at least warning the user not to do parallel # builds. chmod -w . save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -o out/conftest2.o" echo "$progname:829: checking if $compiler supports -c -o file.o" >&5 if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s out/conftest.err; then echo "$ac_t"no 1>&6 compiler_c_o=no else echo "$ac_t"yes 1>&6 compiler_c_o=yes fi else # Append any errors to the config.log. cat out/conftest.err 1>&5 compiler_c_o=no echo "$ac_t"no 1>&6 fi CFLAGS="$save_CFLAGS" chmod u+w . $rm conftest* out/* rmdir out cd .. rmdir conftest $rm -r conftest 2>/dev/null if test x"$compiler_c_o" = x"yes"; then # Check to see if we can write to a .lo echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6 $rm conftest* echo "int some_variable = 0;" > conftest.c save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -c -o conftest.lo" echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5 if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then echo "$ac_t"no 1>&6 compiler_o_lo=no else echo "$ac_t"yes 1>&6 compiler_o_lo=yes fi else # Append any errors to the config.log. cat conftest.err 1>&5 compiler_o_lo=no echo "$ac_t"no 1>&6 fi CFLAGS="$save_CFLAGS" $rm conftest* else compiler_o_lo=no fi # Check to see if we can do hard links to lock some files if needed hard_links="nottested" if test "$compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no echo "$ac_t$hard_links" 1>&6 $rm conftest* if test "$hard_links" = no; then echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2 need_locks=warn fi else need_locks=no fi if test "$with_gcc" = yes; then # Check to see if options -fno-rtti -fno-exceptions are supported by compiler echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6 $rm conftest* echo "int some_variable = 0;" > conftest.c save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c" echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then echo "$ac_t"no 1>&6 compiler_rtti_exceptions=no else echo "$ac_t"yes 1>&6 compiler_rtti_exceptions=yes fi else # Append any errors to the config.log. cat conftest.err 1>&5 compiler_rtti_exceptions=no echo "$ac_t"no 1>&6 fi CFLAGS="$save_CFLAGS" $rm conftest* if test "$compiler_rtti_exceptions" = "yes"; then no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' else no_builtin_flag=' -fno-builtin' fi fi # Check for any special shared library compilation flags. if test -n "$special_shlib_compile_flags"; then echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : else echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 can_build_shared=no fi fi echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 $rm conftest* echo 'main(){return(0);}' > conftest.c save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $link_static_flag" echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5 if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then echo "$ac_t$link_static_flag" 1>&6 else echo "$ac_t"none 1>&6 link_static_flag= fi LDFLAGS="$save_LDFLAGS" $rm conftest* if test -z "$LN_S"; then # Check to see if we can use ln -s, or we need hard links. echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 $rm conftest.dat if ln -s X conftest.dat 2>/dev/null; then $rm conftest.dat LN_S="ln -s" else LN_S=ln fi if test "$LN_S" = "ln -s"; then echo "$ac_t"yes 1>&6 else echo "$ac_t"no 1>&6 fi fi # Make sure LD is an absolute path. if test -z "$LD"; then ac_prog=ld if test "$with_gcc" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 echo "$progname:991: checking for ld used by GCC" >&5 ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we are not using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld... $ac_c" 1>&6 echo "$progname:1015: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 echo "$progname:1018: checking for non-GNU ld" >&5 fi if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break else test "$with_gnu_ld" != yes && break fi fi done IFS="$ac_save_ifs" fi if test -n "$LD"; then echo "$ac_t$LD" 1>&6 else echo "$ac_t"no 1>&6 fi if test -z "$LD"; then echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 exit 1 fi fi # Check to see if it really is or is not GNU ld. echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 # I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then with_gnu_ld=yes else with_gnu_ld=no fi echo "$ac_t$with_gnu_ld" 1>&6 # See if the linker supports building shared libraries. echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 allow_undefined_flag= no_undefined_flag= need_lib_prefix=unknown need_version=unknown # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments archive_cmds= archive_expsym_cmds= old_archive_from_new_cmds= export_dynamic_flag_spec= whole_archive_flag_spec= thread_safe_flag_spec= hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported runpath_var= always_export_symbols=no export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an egrep regular expression of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms="_GLOBAL_OFFSET_TABLE_" # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. case "$host_os" in cygwin* | mingw*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$with_gcc" != yes; then with_gnu_ld=no fi ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # See if GNU ld supports shared libraries. case "$host_os" in aix3* | aix4*) # On AIX, the GNU linker is very broken ld_shlibs=no cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF ;; amigaos*) archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=yes # Extract the symbol export list from an `--export-all' def file, # then regenerate the def file from the symbol export list, so that # the compiled dll only exports the symbol export list. export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~ sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]* ; *//" < $objdir/$soname-def > $export_symbols' archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~ _lt_hint=1; for symbol in `cat $export_symbols`; do echo " \$symbol @ \$_lt_hint ; " >> $objdir/$soname-def; _lt_hint=`expr 1 + \$_lt_hint`; done~ test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts' old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib' # can we support soname and/or expsyms with a.out? -oliva fi ;; solaris* | sysv5*) if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = yes; then runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' case $host_os in cygwin* | mingw*) # dlltool doesn't understand --whole-archive et. al. whole_archive_flag_spec= ;; *) # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi ;; esac fi else # PORTME fill in a description of your system's linker (not GNU ld) case "$host_os" in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$with_gcc" = yes && test -z "$link_static_flag"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4*) hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib' hardcode_libdir_separator=':' if test "$with_gcc" = yes; then collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi shared_flag='-shared' else shared_flag='${wl}-bM:SRE' hardcode_direct=yes fi allow_undefined_flag=' ${wl}-berok' archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}' archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}' case "$host_os" in aix4.[01]|aix4.[01].*) # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on always_export_symbols=yes ;; esac ;; amigaos*) archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; cygwin* | mingw*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib /OUT:$oldlib$oldobjs' fix_srcfile_path='`cygpath -w $srcfile`' ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9* | hpux10* | hpux11*) case "$host_os" in hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;; *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;; esac hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_minus_L=yes # Not in the search PATH, but as the default # location of the library. export_dynamic_flag_spec='${wl}-E' ;; irix5* | irix6*) if test "$with_gcc" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF fi hardcode_libdir_flag_spec='${wl}-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; openbsd*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def' old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' ;; osf3*) if test "$with_gcc" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # As osf3* with the addition of the -msym flag if test "$with_gcc" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; sco3.2v5*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ;; solaris*) no_undefined_flag=' -z text' # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case "$host_os" in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv5*) no_undefined_flag=' -z text' # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' hardcode_libdir_flag_spec= hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4.2uw2*) archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts' hardcode_direct=yes hardcode_minus_L=no hardcode_shlibpath_var=no hardcode_runpath_var=yes runpath_var=LD_RUN_PATH ;; unixware7*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac fi echo "$ac_t$ld_shlibs" 1>&6 test "$ld_shlibs" = no && can_build_shared=no if test -z "$NM"; then echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 case "$NM" in [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path. *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then NM="$ac_dir/nm -B" break elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then NM="$ac_dir/nm -p" break else NM=${NM="$ac_dir/nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags fi fi done IFS="$ac_save_ifs" test -z "$NM" && NM=nm ;; esac echo "$ac_t$NM" 1>&6 fi # Check for command to grab the raw symbol name followed by C symbol from nm. echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Transform the above into a raw symbol and a C symbol. symxfrm='\1 \2\3 \3' # Transform an extracted symbol line into a proper C declaration global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" # Define system-specific variables. case "$host_os" in aix*) symcode='[BCDT]' ;; cygwin* | mingw*) symcode='[ABCDGISTW]' ;; hpux*) # Its linker distinguishes data from code symbols global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" ;; irix*) symcode='[BCDEGRST]' ;; solaris*) symcode='[BDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then symcode='[ABCDGISTW]' fi # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do # Write the raw and C identifiers. global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no $rm conftest* cat > conftest.c <&5 if { (eval echo $progname:1636: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then # Now try to grab the symbols. nlist=conftest.nm if { echo "$progname:1639: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if egrep ' nm_test_var$' "$nlist" >/dev/null; then if egrep ' nm_test_func$' "$nlist" >/dev/null; then cat < conftest.c #ifdef __cplusplus extern "C" { #endif EOF # Now generate the symbol file. eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c' cat <> conftest.c #if defined (__STDC__) && __STDC__ # define lt_ptr_t void * #else # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr_t address; } lt_preloaded_symbols[] = { EOF sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c cat <<\EOF >> conftest.c {0, (lt_ptr_t) 0} }; #ifdef __cplusplus } #endif EOF # Now try linking the two files. mv conftest.$objext conftstm.$objext save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="conftstm.$objext" CFLAGS="$CFLAGS$no_builtin_flag" if { (eval echo $progname:1691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then pipe_works=yes else echo "$progname: failed program was:" >&5 cat conftest.c >&5 fi LIBS="$save_LIBS" else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.c >&5 fi $rm conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else global_symbol_pipe= fi done if test "$pipe_works" = yes; then echo "${ac_t}ok" 1>&6 else echo "${ac_t}failed" 1>&6 fi if test -z "$global_symbol_pipe"; then global_symbol_to_cdecl= fi # Check hardcoding attributes. echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ test -n "$runpath_var"; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$hardcode_shlibpath_var" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi echo "$ac_t$hardcode_action" 1>&6 reload_flag= reload_cmds='$LD$reload_flag -o $output$reload_objs' echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 # PORTME Some linkers may need a different reload flag. reload_flag='-r' echo "$ac_t$reload_flag" 1>&6 test -n "$reload_flag" && reload_flag=" $reload_flag" # PORTME Fill in your ld.so characteristics library_names_spec= libname_spec='lib$name' soname_spec= postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" file_magic_cmd= file_magic_test_file= deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [regex]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given egrep regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 case "$host_os" in aix3*) version_type=linux library_names_spec='${libname}${release}.so$versuffix $libname.a' shlibpath_var=LIBPATH # AIX has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}.so$major' ;; aix4*) version_type=linux # AIX has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. # We preserve .a as extension for shared libraries though AIX4.2 # and later linker supports .so library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a' shlibpath_var=LIBPATH deplibs_check_method=pass_all ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' ;; beos*) library_names_spec='${libname}.so' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH deplibs_check_method=pass_all lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; bsdi4*) version_type=linux need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' file_magic_cmd=/usr/bin/file file_magic_test_file=/shlib/libc.so sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw*) version_type=windows need_version=no need_lib_prefix=no if test "$with_gcc" = yes; then library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a' else library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' fi dynamic_linker='Win32 ld.exe' deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' file_magic_cmd='${OBJDUMP} -f' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; freebsd1*) dynamic_linker=no ;; freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case "$version_type" in freebsd-elf*) deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' file_magic_cmd=/usr/bin/file file_magic_test_file=`echo /usr/lib/libc.so*` library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' need_version=no need_lib_prefix=no ;; freebsd-*) deplibs_check_method=unknown library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case "$host_os" in freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes ;; *) # from 3.2 on shlibpath_overrides_runpath=no ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' soname_spec='${libname}${release}.sl$major' # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; irix5* | irix6*) version_type=irix need_lib_prefix=no need_version=no soname_spec='${libname}${release}.so.$major' library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so' case "$host_os" in irix5*) libsuff= shlibsuff= # this will be overridden with pass_all, but let us keep it just in case deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" ;; *) case "$LD" in # libtool.m4 will add one of these switches to LD *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" file_magic_cmd=/usr/bin/file file_magic_test_file=`echo /lib${libsuff}/libc.so*` deplibs_check_method='pass_all' ;; # No shared lib support for Linux oldld, aout, or coff. linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) dynamic_linker=no ;; # This must be Linux ELF. linux-gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' file_magic_cmd=/usr/bin/file file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` if test -f /lib/ld.so.1; then dynamic_linker='GNU ld.so' else # Only the GNU ld.so supports shared libraries on MkLinux. case "$host_cpu" in powerpc*) dynamic_linker=no ;; *) dynamic_linker='Linux ld.so' ;; esac fi ;; netbsd*) version_type=sunos if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' soname_spec='${libname}${release}.so$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH ;; openbsd*) version_type=sunos if test "$with_gnu_ld" = yes; then need_lib_prefix=no need_version=no fi library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' need_lib_prefix=no library_names_spec='$libname.dll $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_version=no soname_spec='${libname}${release}.so' library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' shlibpath_var=LD_LIBRARY_PATH # this will be overridden with pass_all, but let us keep it just in case deplibs_check_method='file_magic COFF format alpha shared library' file_magic_cmd=/usr/bin/file file_magic_test_file=/shlib/libc.so deplibs_check_method='pass_all' sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; sco3.2v5*) version_type=osf soname_spec='${libname}${release}.so$major' library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib" file_magic_cmd=/usr/bin/file file_magic_test_file=/lib/libc.so ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH case "$host_vendor" in ncr) deplibs_check_method='pass_all' ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' file_magic_cmd=/usr/bin/file file_magic_test_file=`echo /usr/lib/libc.so*` ;; esac ;; uts4*) version_type=linux library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' soname_spec='$libname.so.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; *) dynamic_linker=no ;; esac echo "$ac_t$dynamic_linker" 1>&6 test "$dynamic_linker" = no && can_build_shared=no # Report the final consequences. echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 # Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in # configure.in, otherwise build static only libraries. case "$host_os" in cygwin* | mingw* | os2*) if test x$can_build_shared = xyes; then test x$enable_win32_dll = xno && can_build_shared=no echo "checking if package supports dlls... $can_build_shared" 1>&6 fi ;; esac if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then case "$deplibs_check_method" in "file_magic "*) file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | egrep "$file_magic_regex" > /dev/null; then : else cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org EOF fi ;; esac fi echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case "$host_os" in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix4*) test "$enable_shared" = yes && enable_static=no ;; esac echo "$ac_t$enable_shared" 1>&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes echo "checking whether to build static libraries... $enable_static" 1>&6 if test "$hardcode_action" = relink; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi echo $ac_n "checking for objdir... $ac_c" 1>&6 rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. objdir=_libs fi rmdir .libs 2>/dev/null echo "$ac_t$objdir" 1>&6 if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then lt_cv_dlopen=no lt_cv_dlopen_libs= echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 echo "$progname:2212: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dlopen""... $ac_c" 1>&6 echo "$progname:2252: checking for dlopen" >&5 if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_dlopen) || defined (__stub___dlopen) choke me #else dlopen(); #endif ; return 0; } EOF if { (eval echo $progname:2282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_dlopen=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_dlopen=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="dlopen" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 echo "$progname:2299: checking for dld_link in -ldld" >&5 ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldld $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for shl_load""... $ac_c" 1>&6 echo "$progname:2339: checking for shl_load" >&5 if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shl_load) || defined (__stub___shl_load) choke me #else shl_load(); #endif ; return 0; } EOF if { (eval echo $progname:2369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shl_load=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_shl_load=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="shl_load" else echo "$ac_t""no" 1>&6 echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 echo "$progname:2387: checking for shl_load in -ldld" >&5 ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldld $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else echo "$ac_t""no" 1>&6 fi fi fi fi fi fi if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes fi case "$lt_cv_dlopen" in dlopen) for ac_hdr in dlfcn.h; do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo "$progname:2452: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int fnord = 0; EOF ac_try="$ac_compile >/dev/null 2>conftest.out" { (eval echo $progname:2462: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 else echo "$ac_t""no" 1>&6 fi done if test "x$ac_cv_header_dlfcn_h" = xyes; then CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" fi eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" LIBS="$lt_cv_dlopen_libs $LIBS" echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 echo "$progname:2490: checking whether a program can dlopen itself" >&5 if test "${lt_cv_dlopen_self+set}" = set; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then lt_cv_dlopen_self=cross else cat > conftest.c < #endif #include #ifdef RTLD_GLOBAL # define LTDL_GLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LTDL_GLOBAL DL_GLOBAL # else # define LTDL_GLOBAL 0 # endif #endif /* We may have to define LTDL_LAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LTDL_LAZY_OR_NOW # ifdef RTLD_LAZY # define LTDL_LAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LTDL_LAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LTDL_LAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LTDL_LAZY_OR_NOW DL_NOW # else # define LTDL_LAZY_OR_NOW 0 # endif # endif # endif # endif #endif fnord() { int i=42;} main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } EOF if { (eval echo $progname:2544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then lt_cv_dlopen_self=yes else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* lt_cv_dlopen_self=no fi rm -fr conftest* fi fi echo "$ac_t""$lt_cv_dlopen_self" 1>&6 if test "$lt_cv_dlopen_self" = yes; then LDFLAGS="$LDFLAGS $link_static_flag" echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 echo "$progname:2563: checking whether a statically linked program can dlopen itself" >&5 if test "${lt_cv_dlopen_self_static+set}" = set; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then lt_cv_dlopen_self_static=cross else cat > conftest.c < #endif #include #ifdef RTLD_GLOBAL # define LTDL_GLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LTDL_GLOBAL DL_GLOBAL # else # define LTDL_GLOBAL 0 # endif #endif /* We may have to define LTDL_LAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LTDL_LAZY_OR_NOW # ifdef RTLD_LAZY # define LTDL_LAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LTDL_LAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LTDL_LAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LTDL_LAZY_OR_NOW DL_NOW # else # define LTDL_LAZY_OR_NOW 0 # endif # endif # endif # endif #endif fnord() { int i=42;} main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } EOF if { (eval echo $progname:2617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then lt_cv_dlopen_self_static=yes else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* lt_cv_dlopen_self_static=no fi rm -fr conftest* fi fi echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 fi ;; esac case "$lt_cv_dlopen_self" in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case "$lt_cv_dlopen_self_static" in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi # Copy echo and quote the copy, instead of the original, because it is # used later. ltecho="$echo" if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then ltecho="$CONFIG_SHELL \$0 --fallback-echo" fi LTSHELL="$SHELL" LTCONFIG_VERSION="$VERSION" # Only quote variables if we're using ltmain.sh. case "$ltmain" in *.sh) # Now quote all the things that may contain metacharacters. for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \ old_LD old_LDFLAGS old_LIBS \ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \ AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \ reload_flag reload_cmds wl \ pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ thread_safe_flag_spec whole_archive_flag_spec libname_spec \ library_names_spec soname_spec \ RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \ file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ hardcode_libdir_flag_spec hardcode_libdir_separator \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do case "$var" in reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ postinstall_cmds | postuninstall_cmds | \ finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; *) eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" ;; esac done case "$ltecho" in *'\$0 --fallback-echo"') ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` ;; esac trap "$rm \"$ofile\"; exit 1" 1 2 15 echo "creating $ofile" $rm "$ofile" cat < "$ofile" #! $SHELL # `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. # # Copyright (C) 1996-1999 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="sed -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi ### BEGIN LIBTOOL CONFIG EOF cfgfile="$ofile" ;; *) # Double-quote the variables that need it (for aesthetics). for var in old_CC old_CFLAGS old_CPPFLAGS \ old_LD old_LDFLAGS old_LIBS \ old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do eval "$var=\\\"\$var\\\"" done # Just create a config file. cfgfile="$ofile.cfg" trap "$rm \"$cfgfile\"; exit 1" 1 2 15 echo "creating $cfgfile" $rm "$cfgfile" cat < "$cfgfile" # `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) EOF ;; esac cat <> "$cfgfile" # Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # # CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ # LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\ # NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ # DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\ # $0$ltconfig_args # # Compiler and other test output produced by $progname, useful for # debugging $progname, is in ./config.log if it exists. # The version of $progname that generated this script. LTCONFIG_VERSION=$LTCONFIG_VERSION # Shell to use when invoking shell scripts. SHELL=$LTSHELL # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host # An echo program that does not interpret backslashes. echo=$ltecho # The archiver. AR=$AR # The default C compiler. CC=$CC # The linker used to build libraries. LD=$LD # Whether we need hard or soft links. LN_S=$LN_S # A BSD-compatible nm program. NM=$NM # Used on cygwin: DLL creation program. DLLTOOL="$DLLTOOL" # Used on cygwin: object dumper. OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir # How to create reloadable object files. reload_flag=$reload_flag reload_cmds=$reload_cmds # How to pass a linker flag through the compiler. wl=$wl # Object file suffix (normally "o"). objext="$objext" # Old archive suffix (normally "a"). libext="$libext" # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. pic_flag=$pic_flag # Does compiler simultaneously support -c and -o options? compiler_c_o=$compiler_c_o # Can we write directly to a .lo ? compiler_o_lo=$compiler_o_lo # Must we lock files when doing compilation ? need_locks=$need_locks # Do we need the lib prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Whether dlopen is supported. dlopen=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. link_static_flag=$link_static_flag # Compiler flag to turn off builtin functions. no_builtin_flag=$no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$whole_archive_flag_spec # Compiler flag to generate thread-safe objects. thread_safe_flag_spec=$thread_safe_flag_spec # Library versioning type. version_type=$version_type # Format of library name prefix. libname_spec=$libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME. library_names_spec=$library_names_spec # The coded name of the library, if different from the real name. soname_spec=$soname_spec # Commands used to build and install an old-style archive. RANLIB=$RANLIB old_archive_cmds=$old_archive_cmds old_postinstall_cmds=$old_postinstall_cmds old_postuninstall_cmds=$old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$old_archive_from_new_cmds # Commands used to build and install a shared archive. archive_cmds=$archive_cmds archive_expsym_cmds=$archive_expsym_cmds postinstall_cmds=$postinstall_cmds postuninstall_cmds=$postuninstall_cmds # Method to check whether dependent libraries are shared objects. deplibs_check_method=$deplibs_check_method # Command to use when deplibs_check_method == file_magic. file_magic_cmd=$file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$allow_undefined_flag # Flag that forces no undefined symbols. no_undefined_flag=$no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$finish_cmds # Same as above, but a single script fragment to be evaled but not shown. finish_eval=$finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$global_symbol_pipe # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$global_symbol_to_cdecl # This is the shared library runtime path variable. runpath_var=$runpath_var # This is the shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$hardcode_libdir_separator # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Compile-time system search path for libraries sys_lib_search_path_spec=$sys_lib_search_path_spec # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. fix_srcfile_path="$fix_srcfile_path" # Set to yes if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$exclude_expsyms # Symbols that must always be exported. include_expsyms=$include_expsyms EOF case "$ltmain" in *.sh) echo '### END LIBTOOL CONFIG' >> "$ofile" echo >> "$ofile" case "$host_os" in aix3*) cat <<\EOF >> "$ofile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi EOF ;; esac # Append the ltmain.sh script. sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? chmod +x "$ofile" ;; *) # Compile the libtool program. echo "FIXME: would compile $ltmain" ;; esac test -n "$cache_file" || exit 0 # AC_CACHE_SAVE trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. # If it contains results you don't want to keep, you may remove or edit it. # # By default, configure uses ./config.cache as the cache file, # creating it if it does not exist already. You can give configure # the --cache-file=FILE option to use a different cache file; that is # what configure does when it calls configure scripts in # subdirectories, so they share the cache. # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache exit 0 # Local Variables: # mode:shell-script # sh-indentation:2 # End: xmedcon-0.14.1/source/0000755000175000017510000000000012637632716011551 500000000000000xmedcon-0.14.1/source/m-stack.h0000644000175000017510000000454512636253502013200 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-stack.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-stack.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-stack.h,v 1.14 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_STACK_H__ #define __M_STACK_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_STACK_NONE MDC_NO /* don't stack files */ #define MDC_STACK_SLICES 1 /* stack single slice images files */ #define MDC_STACK_FRAMES 2 /* stack multi slice time frame files */ /**************************************************************************** F U N C T I O N S ****************************************************************************/ float MdcGetNormSliceSpacing(IMG_DATA *id1, IMG_DATA *id2); char *MdcStackSlices(void); char *MdcStackFrames(void); char *MdcStackFiles(Int8 stack); #endif xmedcon-0.14.1/source/Makefile.am0000644000175000017510000001200612357073470013517 00000000000000## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## filename: Makefile.am ## ## ## ## UTIL Make : Medical Image Conversion Utility ## ## ## ## purpose : source subdir Makefile template (automake) ## ## ## ## project : (X)MedCon by Erik Nolf ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## $Id: Makefile.am,v 1.59 2014/07/08 22:56:56 enlf Exp $ AUTOMAKE_OPTIONS = gnu LIBVERSION = 2:1:0 if DO_GUI XMEDCON = xmedcon endif bin_PROGRAMS = medcon $(XMEDCON) medcon_SOURCES = medcon.c medcon_LDADD = libmdc.la medcon_LDFLAGS = $(XMEDCON_GLIB_LIBS) $(XMEDCON_GTK_LIBS) -lm xmedcon_SOURCES = \ xcolmap.c \ xcolmap.h \ xcolgbc.c \ xcolgbc.h \ xdefs.c \ xdefs.h \ xicons.c \ xicons.h \ xerror.c \ xerror.h \ xextract.c \ xextract.h \ xfancy.c \ xfancy.h \ xfiles.c \ xfiles.h \ xfilesel.c \ xfilesel.h \ xhelp.c \ xhelp.h \ ximages.c \ ximages.h \ xinfo.c \ xinfo.h \ xlabels.c \ xlabels.h \ xmedcon.c \ xmedcon.h \ xmnuftry.c \ xmnuftry.h \ xoptions.c \ xoptions.h \ xpages.c \ xpages.h \ xprogbar.c \ xprogbar.h \ xreader.c \ xreader.h \ xrender.c \ xrender.h \ xreset.c \ xreset.h \ xresize.c \ xresize.h \ xreslice.c \ xreslice.h \ xtransf.c \ xtransf.h \ xutils.c \ xutils.h \ xviewer.c \ xviewer.h \ xvifi.c \ xvifi.h \ xwriter.c \ xwriter.h \ xzoom.c \ xzoom.h if PLATFORM_WIN32 APPICON_OBJ = appicon.o $(APPICON_OBJ): $(APPICON_OBJ:.o=.rc) windres -i $(APPICON_OBJ:.o=.rc) -o $(APPICON_OBJ) xmedcon_LDADD = $(APPICON_OBJ) libmdc.la xmedcon_LDFLAGS = -mwindows $(GDK_PIXBUF_LIBS) -lm else xmedcon_LDADD = libmdc.la xmedcon_LDFLAGS = $(GDK_PIXBUF_LIBS) -lm endif ALL_FRMTS_SOURCES = \ m-acr.c \ m-gif.c \ m-inw.c \ m-anlz.c \ m-conc.c \ m-matrix.c \ m-ecat64.c \ m-ecat72.c \ m-intf.c \ m-dicm.c \ m-png.c \ m-nifti.c ZLIB_LIB = @ZLIB_LDFLAGS@ if DO_ACR ACR_OBJ = m-acr.lo endif if DO_GIF GIF_OBJ = m-gif.lo endif if DO_INW INW_OBJ = m-inw.lo endif if DO_ANLZ ANLZ_OBJ = m-anlz.lo endif if DO_CONC CONC_OBJ = m-conc.lo endif if DO_ECAT ECAT_OBJ = m-matrix.lo m-ecat64.lo m-ecat72.lo endif if DO_INTF INTF_OBJ = m-intf.lo endif if DO_DICM DICM_OBJ = m-dicm.lo DICM_DIR = ../libs/dicom DICM_INC = -I$(DICM_DIR) DICM_LIB = $(DICM_DIR)/libdicom.la endif if DO_PNG PNG_OBJ = m-png.lo PNG_LIB = @PNG_LDFLAGS@ PNG_INC = @PNG_CFLAGS@ endif if DO_NIFTI NIFTI_OBJ = m-nifti.lo NIFTI_LIB = @NIFTI_LDFLAGS@ NIFTI_INC = @NIFTI_CFLAGS@ endif if DO_TPC TPC_LIB = @TPC_LDFLAGS@ TPC_INC = @TPC_CFLAGS@ endif if DO_LJPG LJPG_DIR = ../libs/ljpg LJPG_LIB = $(LJPG_DIR)/libljpg.la endif ENABLED_FRMTS_OBJS = \ $(ACR_OBJ) \ $(GIF_OBJ) \ $(INW_OBJ) \ $(ANLZ_OBJ) \ $(CONC_OBJ) \ $(ECAT_OBJ) \ $(INTF_OBJ) \ $(DICM_OBJ) \ $(PNG_OBJ) \ $(NIFTI_OBJ) lib_LTLIBRARIES = libmdc.la if PLATFORM_WIN32 no_undefined = -no-undefined endif if OS_WIN32 install-libtool-import-lib: if test -f .libs/libmdc.dll.a ; then $(INSTALL) .libs/libmdc.dll.a $(DESTDIR)$(libdir) ; fi uninstall-libtool-import-lib: if test -f $(DESTDIR)$(libdir)/libmdc.dll.a ; then rm $(DESTDIR)$(libdir)/libmdc.dll.a ; fi else install-libtool-import-lib: uninstall-libtool-import-lib: endif libmdc_la_SOURCES = \ m-init.c \ m-vifi.c \ m-color.c \ m-debug.c \ m-error.c \ m-fancy.c \ m-files.c \ m-split.c \ m-stack.c \ m-transf.c \ m-getopt.c \ m-algori.c \ m-global.c \ m-pixels.c \ m-rslice.c \ m-xtract.c \ m-progress.c \ m-qmedian.c \ m-structs.c \ m-raw.c libmdc_la_LDFLAGS = $(no_undefined) -version-info $(LIBVERSION) -lm libmdc_la_LIBADD = $(ENABLED_FRMTS_OBJS) \ $(DICM_LIB) $(LJPG_LIB) \ $(ZLIB_LIB) $(PNG_LIB) $(NIFTI_LIB) \ $(TPC_LIB) $(XMEDCON_GLIB_LIBS) $(XMEDCON_GTK_LIBS) libmdc_la_DEPENDENCIES = $(ENABLED_FRMTS_OBJS) EXTRA_libmdc_la_SOURCES = $(ALL_FRMTS_SOURCES) include_HEADERS = \ medcon.h \ m-init.h \ m-defs.h \ m-vifi.h \ m-color.h \ m-debug.h \ m-error.h \ m-fancy.h \ m-files.h \ m-split.h \ m-stack.h \ m-transf.h \ m-getopt.h \ m-algori.h \ m-global.h \ m-pixels.h \ m-rslice.h \ m-xtract.h \ m-progress.h \ m-qmedian.h \ m-structs.h \ m-raw.h \ m-acr.h \ m-gif.h \ m-inw.h \ m-anlz.h \ m-conc.h \ m-matrix.h \ m-ecat64.h \ m-ecat72.h \ m-intf.h \ m-dicm.h \ m-png.h \ m-nifti.h configheadersdir = $(prefix)/include configheaders_DATA = m-depend.h m-config.h AM_CPPFLAGS = $(DICM_INC) $(PNG_INC) $(NIFTI_INC) $(TPC_INC) \ $(GDK_PIXBUF_CFLAGS) $(XMEDCON_GLIB_CFLAGS) \ $(XMEDCON_GTK_CFLAGS) $(ZLIB_CFLAGS) AM_CFLAGS = EXTRA_DIST = appicon.rc install-data-local: install-libtool-import-lib uninstall-local: uninstall-libtool-import-lib xmedcon-0.14.1/source/m-vifi.c0000644000175000017510000003035312636253502013017 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-vifi.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : routines which allow to change the FILEINFO information * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcMakePatAnonymous() - Make patient anonymous * * MdcGivePatInformation() - Give patient information * * MdcEditFI() - Edit FILEINFO structure * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-vifi.c,v 1.42 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "medcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void MdcMakePatAnonymous(FILEINFO *fi) { MdcStringCopy(fi->patient_sex,"X",1); MdcStringCopy(fi->patient_name,"X",1); MdcStringCopy(fi->patient_id,"X",1); MdcStringCopy(fi->patient_dob,"0000:00:00",10); MdcStringCopy(fi->study_descr,"X",1); MdcStringCopy(fi->study_id,"X",1); MdcStringCopy(fi->series_descr,"X",1); fi->study_date_day = 0; fi->study_date_month = 0; fi->study_date_year = 0; fi->study_time_hour = 0; fi->study_time_minute = 0; fi->study_time_second = 0; } void MdcGivePatInformation(FILEINFO *fi) { int a; if (MDC_FILE_STDIN == MDC_YES) return; /* stdin already in use */ MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("\tPATIENT/STUDY INFORMATION\t\tFILE: %s\n",fi->ifname); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("\n\tNote: all strings are limited to %d characters\n\n" ,MDC_MAXSTR); MdcPrntScrn("\n\tGive patient name [%s]: ",fi->patient_name); if (! MdcPutDefault(mdcbufr)) MdcStringCopy(fi->patient_name,mdcbufr,strlen(mdcbufr)); MdcPrntScrn("\n\tGive patient id [%s]: ",fi->patient_id); if (! MdcPutDefault(mdcbufr)) MdcStringCopy(fi->patient_id,mdcbufr,strlen(mdcbufr)); MdcPrntScrn("\n\tSelect patient sex [%s]:\n",fi->patient_sex); MdcPrntScrn("\n\t\t 1 -> male"); MdcPrntScrn("\n\t\t 2 -> female"); MdcPrntScrn("\n\t\t 3 -> other"); MdcPrntScrn("\n\t\t -> default"); MdcPrntScrn("\n\n\tYour choice? "); if (! MdcPutDefault(mdcbufr)) { a = atoi(mdcbufr); switch (a) { case 1 : MdcStringCopy(fi->patient_sex,"M",1); break; case 2 : MdcStringCopy(fi->patient_sex,"F",1); break; default: MdcStringCopy(fi->patient_sex,"O",1); } } MdcPrntScrn("\n\tGive study description [%s]: ",fi->study_descr); if (! MdcPutDefault(mdcbufr)) MdcStringCopy(fi->study_descr,mdcbufr,strlen(mdcbufr)); MdcPrntScrn("\n\tGive study id/name/p-number [%s]: ",fi->study_id); if (! MdcPutDefault(mdcbufr)) MdcStringCopy(fi->study_id,mdcbufr,strlen(mdcbufr)); MdcPrntScrn("\n\tGive series description [%s]: ", fi->series_descr); if (! MdcPutDefault(mdcbufr)) MdcStringCopy(fi->series_descr,mdcbufr,strlen(mdcbufr)); MdcPrintLine('-',MDC_FULL_LENGTH); } char *MdcEditFI(FILEINFO *fi) { IMG_DATA *id=NULL; DYNAMIC_DATA *dd=NULL; Uint32 i, number, dflt, dim[MDC_MAX_DIMS]; Int8 a, LAST_FOUND=MDC_NO; float pixel_size, slice_width, slice_spacing, frame_duration; char *msg, *badvalue="Bad dim[]-value supplied"; int modality = fi->modality; if (MDC_FILE_STDIN == MDC_YES) return(NULL); /* stdin already in use */ MdcPrintLine('#',MDC_FULL_LENGTH); MdcPrntScrn("\tEDIT FILEINFO STRUCTURE\t\tFILE: %s\n",fi->ifname); MdcPrintLine('#',MDC_FULL_LENGTH); /* patient/slice orientation */ MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("\tPATIENT/SLICE ORIENTATION\n"); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("\n\tSelect Patient/Slice orientation:\n"); for (a=0; a < MDC_MAX_ORIENT; a++) MdcPrntScrn("\n\t\t %2hd -> %s",a,MdcGetStrPatSlOrient(a)); MdcPrntScrn("\n\n\tYour choice [%d]? ",fi->pat_slice_orient); if (MdcPutDefault(mdcbufr)) a = fi->pat_slice_orient; else a = (Int8)atoi(mdcbufr); fi->pat_slice_orient = a; strcpy(fi->pat_pos,MdcGetStrPatPos(fi->pat_slice_orient)); strcpy(fi->pat_orient,MdcGetStrPatOrient(fi->pat_slice_orient)); MdcPrintLine('-',MDC_HALF_LENGTH); /* pixel/slice dimensions */ MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("\tPIXEL/SLICE DIMENSIONS\n"); MdcPrintLine('-',MDC_HALF_LENGTH); /* fill in default values */ id = &fi->image[0]; pixel_size = id->pixel_xsize; slice_width = id->slice_width; slice_spacing = id->slice_spacing; if ((fi->dynnr > 0) && (fi->dyndata != NULL)) { frame_duration = fi->dyndata[0].time_frame_duration; }else{ frame_duration = 0.; } MdcPrntScrn("\n\tNote: The following entries require float values"); MdcPrntScrn("\n\t Examples: 10.0 or 1.0e+1\n"); MdcPrntScrn("\n\tGive pixel size in mm [%e]: ",pixel_size); if (! MdcPutDefault(mdcbufr)) pixel_size = (float)atof(mdcbufr); MdcPrntScrn("\n\tGive slice width in mm [%e]: ",slice_width); if (! MdcPutDefault(mdcbufr)) slice_width = (float)atof(mdcbufr); MdcPrntScrn("\n\tGive centre-centre slice separation in mm [%e]: " ,slice_spacing); if (! MdcPutDefault(mdcbufr)) slice_spacing = (float)atof(mdcbufr); MdcPrntScrn("\n\tGive duration of time frame in ms [%e]: ",frame_duration); if (! MdcPutDefault(mdcbufr)) frame_duration= (float)atof(mdcbufr); MdcPrintLine('-',MDC_HALF_LENGTH); /* array dimensions */ MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("\tARRAY DIMENSIONS\n"); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("\n\t"); MdcPrntScrn("Note: Each array entry must be a 1-based integer and the"); MdcPrntScrn("\n\t"); MdcPrntScrn(" product of dim[]-values = total numer of images\n"); /* fill in some defaults */ dflt = fi->number; for (i=0; inumber) return(badvalue); /* ok, use the values */ for (i=7; i>=3; i--) { fi->dim[i] = dim[i]; if ((LAST_FOUND == MDC_NO) && (dim[i] > 1)) { fi->dim[0] = i; LAST_FOUND = MDC_YES; } } MdcPrintLine('-',MDC_HALF_LENGTH); /* study information */ MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("\tSTUDY PARAMETERS\n"); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("\n\tReconstructed "); if (fi->reconstructed == MDC_YES) { MdcPrntScrn("([y]/n)"); }else{ MdcPrntScrn("(y/[n])"); } MdcPrntScrn(" ? "); if (!MdcPutDefault(mdcbufr)) { if ( mdcbufr[0] == 'y' || mdcbufr[0] == 'Y' ) { fi->reconstructed = MDC_YES; }else if ( mdcbufr[0] == 'n' || mdcbufr[0] == 'N' ) { fi->reconstructed = MDC_NO; } } MdcPrntScrn("\n\tPlanar study "); if (fi->planar == MDC_YES) { MdcPrntScrn("([y]/n)"); }else{ MdcPrntScrn("(y/[n])"); } MdcPrntScrn(" ? "); if (!MdcPutDefault(mdcbufr)) { if ( mdcbufr[0] == 'y' || mdcbufr[0] == 'Y' ) { fi->planar = MDC_YES; }else if ( mdcbufr[0] == 'n' || mdcbufr[0] == 'N' ) { fi->planar = MDC_NO; } } MdcPrntScrn("\n\tSelect Modality:\n"); MdcPrntScrn("\n\t\t 1 -> NM"); MdcPrntScrn("\n\t\t 2 -> PT"); MdcPrntScrn("\n\t\t 3 -> CT"); MdcPrntScrn("\n\t\t 4 -> MR"); MdcPrntScrn("\n\t\t -> current"); MdcPrntScrn("\n\n\tYour choice [%s] ? ",MdcGetStrModality(modality)); if (! MdcPutDefault(mdcbufr)) { a = atoi(mdcbufr); switch (a) { case 1: modality = M_NM; break; case 2: modality = M_PT; break; case 3: modality = M_CT; break; case 4: modality = M_MR; break; } } MdcPrntScrn("\n\tSelect Acquisition type:\n"); for (a=0; a < MDC_MAX_ACQUISITIONS; a++) MdcPrntScrn("\n\t\t %2hd -> %s",a,MdcGetStrAcquisition(a)); MdcPrntScrn("\n\n\tYour choice [%d]? ",fi->acquisition_type); if (!MdcPutDefault(mdcbufr)) { fi->acquisition_type = (Int16)atoi(mdcbufr); } MdcPrintLine('-',MDC_HALF_LENGTH); /* reset other data structs */ msg = MdcResetODs(fi); if (msg != NULL) return(msg); /* fill in FI struct */ if (fi->pixdim[0] < 4) fi->pixdim[0] = 4; /* at least */ fi->pixdim[1] = pixel_size; fi->pixdim[2] = pixel_size; fi->pixdim[3] = slice_width; fi->pixdim[4] = frame_duration; fi->modality = modality; /* fill in IMG_DATA structs */ for (i=0; i < fi->number; i++) { id = &fi->image[i]; id->pixel_xsize = pixel_size; id->pixel_ysize = pixel_size; id->slice_width = slice_width; id->slice_spacing= slice_spacing; MdcFillImgPos(fi,i,fi->dim[3]==0 ? 0 : i%fi->dim[3],(float)0.0); MdcFillImgOrient(fi,i); } /* fill DYNAMIC_DATA structs */ for (i=0; idynnr; i++) { dd = &fi->dyndata[i]; dd->nr_of_slices = fi->dim[3]; dd->time_frame_duration = frame_duration; } /* some final completions */ msg = MdcImagesPixelFiddle(fi); if (msg != NULL) return(msg); MdcPrintLine('#',MDC_FULL_LENGTH); return(NULL); } xmedcon-0.14.1/source/xinfo.c0000644000175000017510000010515412636253502012755 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xinfo.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : display info text routines * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcImagesInfo() - Display images info * * XMdcShowFileInfo() - Display general file info * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xinfo.c,v 1.71 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ /* gtktext was replaced by gtktextview in gtk-2.0, this enables it in 2.0 */ #define GTK_ENABLE_BROKEN #include "m-depend.h" #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "xmedcon.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcImagesInfo(GtkWidget *widget, Uint32 nr) { GtkWidget *window = NULL; GtkWidget *box1; GtkWidget *box2; GtkWidget *button; GtkWidget *separator; GtkWidget *table; GtkWidget *hscrollbar; GtkWidget *vscrollbar; GtkWidget *text; #ifdef GTKONE GdkFont *fixed = NULL; #else GdkFont *fixed = sfixed; #endif IMG_DATA *id; Uint32 i; float f; i = my.realnumber[nr]; id = &my.fi->image[i]; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_widget_set_usize(window, 500, 500); gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE); gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroy), NULL); gtk_window_set_title(GTK_WINDOW(window),XMdcGetImageLabelIndex(nr)); gtk_container_set_border_width(GTK_CONTAINER(window),0); box1 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(window),box1); gtk_widget_show(box1); box2 = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(box2), 0); gtk_box_pack_start(GTK_BOX(box1),box2,TRUE,TRUE,0); gtk_widget_show(box2); table = gtk_table_new(2, 2, FALSE); gtk_table_set_row_spacing(GTK_TABLE(table), 0, 2); gtk_table_set_col_spacing(GTK_TABLE(table), 0, 2); gtk_box_pack_start(GTK_BOX(box2),table,TRUE,TRUE,0); gtk_widget_show(table); text = gtk_text_new(NULL,NULL); gtk_text_set_editable(GTK_TEXT(text),FALSE); gtk_text_set_word_wrap (GTK_TEXT(text), TRUE); gtk_table_attach(GTK_TABLE(table),text, 0, 1, 0, 1, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); gtk_widget_show(text); hscrollbar = gtk_hscrollbar_new(GTK_TEXT(text)->hadj); gtk_table_attach(GTK_TABLE(table), hscrollbar, 0, 1, 1, 2, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(hscrollbar); vscrollbar = gtk_vscrollbar_new(GTK_TEXT(text)->vadj); gtk_table_attach(GTK_TABLE(table), vscrollbar, 1, 2, 0, 1, GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); gtk_widget_show(vscrollbar); gtk_text_freeze(GTK_TEXT(text)); gtk_widget_realize(text); /* create the info text */ gdk_color_alloc(gtk_widget_get_colormap(window), &Blue); sprintf(xmdcstr,"IMAGE: %02u PAGE: %02u NR: %03u\n\n", nr+1, my.curpage+1, i+1); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"\nPixel Dimensions\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"dimension: %ux%u\npixeltype: %s\n", id->width, id->height, MdcGetStrPixelType(id->type)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"\nReal Dimensions\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"pixel xsize : %+e mm\npixel ysize : %+e mm\n", id->pixel_xsize, id->pixel_ysize); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"slice width : %+e mm\n", id->slice_width); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"slice spacing : %+e mm\n", id->slice_spacing); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"\nct zoom factor: %+e\n", id->ct_zoom_fctr); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"\nRescale Factors\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"rescale slope : %+e ", id->rescale_slope); if (MDC_QUANTIFY == MDC_YES) { strcat(xmdcstr,"(= quantification)\n"); }else if (MDC_CALIBRATE == MDC_YES) { strcat(xmdcstr,"(= quantification * calibration)\n"); }else{ strcat(xmdcstr,"(= none)\n"); } gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"rescale intercept: %+e\n", id->rescale_intercept); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"quantification : %+e\n", id->quant_scale); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"calibration : %+e\n", id->calibr_fctr); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"intercept : %+e\n", id->intercept); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"\nPixel Values\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"image min value: %+e\t\timage max value: %+e\n", id->min, id->max); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"frame min value: %+e\t\tframe max value: %+e\n", id->fmin, id->fmax); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"\nQuantified Values\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"image qmin value: %+e\t\timage qmax value: %+e\n", id->qmin, id->qmax); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"frame qmin value: %+e\t\tframe qmax value: %+e\n", id->qfmin, id->qfmax); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"\nTime Specifications\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"frame number : %u\n",id->frame_number); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"slice start : %+e [ms] = %s\n" ,id->slice_start,MdcGetStrHHMMSS(id->slice_start)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); f = MdcSingleImageDuration(my.fi,id->frame_number-1); sprintf(xmdcstr,"slice duration: %+e [ms] = %s (auto-filled)\n" ,f,MdcGetStrHHMMSS(f)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"\nPosition & Orientation\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"image position device : %+e\\%+e\\%+e\n", id->image_pos_dev[0], id->image_pos_dev[1], id->image_pos_dev[2]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"image position patient : %+e\\%+e\\%+e\n", id->image_pos_pat[0], id->image_pos_pat[1], id->image_pos_pat[2]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"image orientation device : %+e\\%+e\\%+e\n", id->image_orient_dev[0], id->image_orient_dev[1], id->image_orient_dev[2]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr," %+e\\%+e\\%+e\n", id->image_orient_dev[3], id->image_orient_dev[4], id->image_orient_dev[5]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"image orientation patient : %+e\\%+e\\%+e\n", id->image_orient_pat[0], id->image_orient_pat[1], id->image_orient_pat[2]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr," %+e\\%+e\\%+e\n", id->image_orient_pat[3], id->image_orient_pat[4], id->image_orient_pat[5]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); if (id->sdata != NULL) { STATIC_DATA *sd = id->sdata; sprintf(xmdcstr,"\nStatic Data\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"label : %s\n",sd->label); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"total counts : %g\n",sd->total_counts); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"image duration : %e [ms] = %s\n" ,sd->image_duration,MdcGetStrHHMMSS(sd->image_duration)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"image start time : %02hd:%02hd:%02hd\n" ,sd->start_time_hour ,sd->start_time_minute ,sd->start_time_second); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); } gtk_text_thaw(GTK_TEXT(text)); /* create separator and close button */ separator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(box1),separator,FALSE,TRUE,0); gtk_widget_show(separator); box2 = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(box2), 0); gtk_box_pack_start(GTK_BOX(box1),box2, FALSE, FALSE, 0); gtk_widget_show(box2); button = gtk_button_new_with_label("Close"); gtk_signal_connect_object(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(window)); gtk_box_pack_start(GTK_BOX(box2),button,FALSE,FALSE,0); gtk_widget_show(button); gtk_widget_show(window); } void XMdcShowFileInfo(GtkWidget *widget, gpointer data) { GtkWidget *window = NULL; GtkWidget *box1; GtkWidget *box2; GtkWidget *button; GtkWidget *separator; GtkWidget *table; GtkWidget *hscrollbar; GtkWidget *vscrollbar; GtkWidget *text; #ifdef GTKONE GdkFont *fixed = NULL; #else GdkFont *fixed = sfixed; #endif Uint32 i; int v; if (XMdcNoFileOpened()) return; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_widget_set_usize(window,500,500); gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE); gtk_signal_connect(GTK_OBJECT(window),"destroy", GTK_SIGNAL_FUNC(gtk_widget_destroy), NULL); sprintf(mdcbufr,"FileInfo: %s",my.fi->ifname); gtk_window_set_title(GTK_WINDOW(window),mdcbufr); gtk_container_set_border_width(GTK_CONTAINER(window),0); box1 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(window),box1); gtk_widget_show(box1); box2 = gtk_vbox_new(FALSE,0); gtk_container_set_border_width(GTK_CONTAINER(box2), 0); gtk_box_pack_start(GTK_BOX(box1),box2,TRUE,TRUE,0); gtk_widget_show(box2); table = gtk_table_new(2, 2, FALSE); gtk_table_set_row_spacing(GTK_TABLE(table), 0, 2); gtk_table_set_col_spacing(GTK_TABLE(table), 0, 2); gtk_box_pack_start(GTK_BOX(box2),table,TRUE,TRUE,0); gtk_widget_show(table); text = gtk_text_new(NULL,NULL); gtk_text_set_editable(GTK_TEXT(text),FALSE); gtk_text_set_word_wrap(GTK_TEXT(text), TRUE); gtk_table_attach(GTK_TABLE(table),text, 0, 1, 0, 1, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); gtk_widget_show(text); hscrollbar = gtk_hscrollbar_new(GTK_TEXT(text)->hadj); gtk_table_attach(GTK_TABLE(table), hscrollbar, 0, 1, 1, 2, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show(hscrollbar); vscrollbar = gtk_vscrollbar_new(GTK_TEXT(text)->vadj); gtk_table_attach(GTK_TABLE(table), vscrollbar, 1, 2, 0, 1, GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); gtk_widget_show(vscrollbar); gtk_text_freeze(GTK_TEXT(text)); gtk_widget_realize(text); /* create the general info text */ gdk_color_alloc(gtk_widget_get_colormap(window), &Blue); sprintf(xmdcstr,"\nGeneral File Information\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"FILE *ifp : "); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); if (my.fi->ifp == NULL) sprintf(xmdcstr,"\n"); else sprintf(xmdcstr,"%p\n",(void *)my.fi->ifp); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"FILE *ofp : "); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); if (my.fi->ofp == NULL) sprintf(xmdcstr,"\n"); else sprintf(xmdcstr,"%p\n",(void *)my.fi->ofp); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"ipath : %s\n",my.fi->ipath); gtk_text_insert(GTK_TEXT(text),sfixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"opath : %s\n",my.fi->opath); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); if (my.fi->idir != NULL) sprintf(xmdcstr,"idir : %s\n",my.fi->idir); else sprintf(xmdcstr,"idir : \n"); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); if (my.fi->odir != NULL) sprintf(xmdcstr,"odir : %s\n",my.fi->odir); else sprintf(xmdcstr,"odir : \n"); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"ifname : %s\n",my.fi->ifname); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"ofname : %s\n",my.fi->ofname); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)my.fi->iformat; sprintf(xmdcstr,"iformat : %d (= %s)\n",v,FrmtString[v]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"modality : %d (= %s)\n",my.fi->modality ,MdcGetStrModality(my.fi->modality)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)my.fi->rawconv; sprintf(xmdcstr,"rawconv : %d (= %s)\n",v,MdcGetStrRawConv(v)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)my.fi->endian; sprintf(xmdcstr,"endian : %d (= %s)\n",v,MdcGetStrEndian(v)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)my.fi->compression; sprintf(xmdcstr,"compression : %d (= %s)\n",v,MdcGetStrCompression(v)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)my.fi->truncated; sprintf(xmdcstr,"truncated : %d (= %s)\n",v,MdcGetStrYesNo(v)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)my.fi->diff_type; sprintf(xmdcstr,"diff_type : %d (= %s)\n",v,MdcGetStrYesNo(v)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)my.fi->diff_size; sprintf(xmdcstr,"diff_size : %d (= %s)\n",v,MdcGetStrYesNo(v)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)my.fi->diff_scale; sprintf(xmdcstr,"diff_scale : %d (= %s)\n",v,MdcGetStrYesNo(v)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"\nGeneral Image Information\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"number : %u\n",my.fi->number); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"mwidth : %u\n",my.fi->mwidth); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"mheight : %u\n",my.fi->mheight); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"bits : %hu\n",my.fi->bits); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)my.fi->type; sprintf(xmdcstr,"type : %d (= %s)\n",v,MdcGetStrPixelType(v)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"dim[0] : %-5hd (= total in use)\n",my.fi->dim[0]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"dim[1] : %-5hd (= pixels X-dim)\n",my.fi->dim[1]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"dim[2] : %-5hd (= pixels Y-dim)\n",my.fi->dim[2]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"dim[3] : %-5hd (= planes | (time) slices)\n" ,my.fi->dim[3]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"dim[4] : %-5hd (= frames | time slots | phases)\n" ,my.fi->dim[4]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"dim[5] : %-5hd (= gates | R-R intervals)\n" ,my.fi->dim[5]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"dim[6] : %-5hd (= beds | detector heads)\n" ,my.fi->dim[6]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"dim[7] : %-5hd (= ... | energy windows)\n" ,my.fi->dim[7]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"pixdim[0] : %+e\n",my.fi->pixdim[0]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"pixdim[1] : %+e [mm]\n",my.fi->pixdim[1]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"pixdim[2] : %+e [mm]\n",my.fi->pixdim[2]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"pixdim[3] : %+e [mm]\n",my.fi->pixdim[3]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); for (i=4; ipixdim[i]); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); } sprintf(xmdcstr,"glmin : %+e\n",my.fi->glmin); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"glmax : %+e\n",my.fi->glmax); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"qglmin : %+e\n",my.fi->qglmin); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"qglmax : %+e\n",my.fi->qglmax); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)my.fi->contrast_remapped; sprintf(xmdcstr,"contrast remapped: %d (= %s)\n",v,MdcGetStrYesNo(v)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"window centre : %g\n",my.fi->window_centre); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"window width : %g\n",my.fi->window_width); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"\nOrientation Information\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"slice projection : %d (= %s)\n", my.fi->slice_projection,MdcGetStrSlProjection(my.fi->slice_projection)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"patient/slice orientation : %d (= %s)\n", my.fi->pat_slice_orient,MdcGetStrPatSlOrient(my.fi->pat_slice_orient)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"patient position : %s\n",my.fi->pat_pos); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"patient orientation : %s\n",my.fi->pat_orient); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"\nPatient Information\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"patient_sex : %s\n",my.fi->patient_sex); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"patient_name : %s\n",my.fi->patient_name); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"patient_id : %s\n",my.fi->patient_id); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"patient_dob : %s\n",my.fi->patient_dob); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"patient_weight: %.2f [kg]\n",my.fi->patient_weight); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"patient_height: %.2f [m]\n",my.fi->patient_height); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"\nStudy Information\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"operator_name : %s\n",my.fi->operator_name); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"study_descr : %s\n",my.fi->study_descr); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"study_id : %s\n",my.fi->study_id); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"study_date_year : %02d\n",my.fi->study_date_year); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"study_date_month : %d\n",my.fi->study_date_month); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"study_date_day : %d\n",my.fi->study_date_day); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"study_time_hour : %02d\n",my.fi->study_time_hour); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"study_time_minute: %02d\n",my.fi->study_time_minute); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"study_time_second: %02d\n",my.fi->study_time_second); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"dose_time_hour : %02d\n",my.fi->dose_time_hour); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"dose_time_minute : %02d\n",my.fi->dose_time_minute); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"dose_time_second : %02d\n",my.fi->dose_time_second); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"nr_series : %d\n",my.fi->nr_series); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"nr_acquisition : %d\n",my.fi->nr_acquisition); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"nr_instance : %d\n",my.fi->nr_instance); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)my.fi->decay_corrected; sprintf(xmdcstr,"decay_corrected : %d (= %s)\n",v,MdcGetStrYesNo(v)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)my.fi->flood_corrected; sprintf(xmdcstr,"flood_corrected : %d (= %s)\n",v,MdcGetStrYesNo(v)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)my.fi->acquisition_type; sprintf(xmdcstr,"acquisition_type : %d (= %s)\n",v,MdcGetStrAcquisition(v)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)my.fi->planar; sprintf(xmdcstr,"planar : %d (= %s)\n",v,MdcGetStrYesNo(v)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)my.fi->reconstructed; sprintf(xmdcstr,"reconstructed : %d (= %s)\n",v,MdcGetStrYesNo(v)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"recon_method : %s\n",my.fi->recon_method); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"institution : %s\n",my.fi->institution); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"manufacturer : %s\n",my.fi->manufacturer); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"series_descr : %s\n",my.fi->series_descr); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"radiopharma : %s\n",my.fi->radiopharma); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"filter_type : %s\n",my.fi->filter_type); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"organ_code : %s\n",my.fi->organ_code); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"isotope_code : %s\n",my.fi->isotope_code); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"isotope_halflife : %+e [sec] or %g [hrs]\n" ,my.fi->isotope_halflife ,my.fi->isotope_halflife/3600.); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"injected_dose : %+e [MBq]\n",my.fi->injected_dose); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"gantry_tilt : %+e [degrees]\n",my.fi->gantry_tilt); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); if ((my.fi->gatednr > 0) && (my.fi->gdata != NULL)) { sprintf(xmdcstr,"\nGated (SPECT) Data\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"gatednr : %u\n",my.fi->gatednr); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); for (i=0; igatednr; i++) { GATED_DATA *gd = &my.fi->gdata[i]; sprintf(xmdcstr,"------- [ %.3u ] --------\n",i+1); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)gd->gspect_nesting; sprintf(xmdcstr,"gspect_nesting : %d (= %s)\n",gd->gspect_nesting ,MdcGetStrGSpectNesting(gd->gspect_nesting)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"nr_projections : %g\n",gd->nr_projections); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"extent_rotation : %g\n",gd->extent_rotation); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"study_duration : %+e [ms] = %s\n" ,gd->study_duration,MdcGetStrHHMMSS(gd->study_duration)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"image_duration : %+e [ms] = %s\n" ,gd->image_duration,MdcGetStrHHMMSS(gd->image_duration)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"time_per_proj : %+e [ms] = %s\n" ,gd->time_per_proj,MdcGetStrHHMMSS(gd->time_per_proj)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"limit window_low : %+e [ms] = %s\n" ,gd->window_low,MdcGetStrHHMMSS(gd->window_low)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"limit window_high: %+e [ms] = %s\n" ,gd->window_high,MdcGetStrHHMMSS(gd->window_high)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"cycles_observed : %+e\n",gd->cycles_observed); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"cycles_acquired : %+e\n\n",gd->cycles_acquired); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"heart rate (observed): %d [bpm] (auto-filled)\n" ,(int)MdcGetHeartRate(gd,MDC_HEART_RATE_OBSERVED)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"heart rate (acquired): %d [bpm] (auto-filled)\n" ,(int)MdcGetHeartRate(gd,MDC_HEART_RATE_ACQUIRED)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); } } if ((my.fi->acqnr > 0) && (my.fi->acqdata != NULL)) { sprintf(xmdcstr,"\nAcquisition Data\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"acqnr : %u\n",my.fi->acqnr); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); for (i=0; iacqnr; i++) { ACQ_DATA *acq = &my.fi->acqdata[i]; sprintf(xmdcstr,"-------- [ %.3u ] --------\n",i+1); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)acq->rotation_direction; sprintf(xmdcstr,"rotation_direction : %d (= %s)\n",v,MdcGetStrRotation(v)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); v = (int)acq->detector_motion; sprintf(xmdcstr,"detector_motion : %d (= %s)\n",v,MdcGetStrMotion(v)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"rotation_offset : %g [mm]\n",acq->rotation_offset); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"radial_position : %g [mm]\n",acq->radial_position); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"angle_start : %g [degrees]\n",acq->angle_start); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"angle_step : %g [degrees]\n",acq->angle_step); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"scan_arc : %g [degrees]\n",acq->scan_arc); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); } } if ((my.fi->dynnr > 0) && (my.fi->dyndata != NULL)) { sprintf(xmdcstr,"\nDynamic Data\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"dynnr : %u\n",my.fi->dynnr); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); for (i=0; idynnr; i++) { DYNAMIC_DATA *dd = &my.fi->dyndata[i]; sprintf(xmdcstr,"-------- [ %.3u ] --------\n",i+1); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"nr_of_slices : %u\n",dd->nr_of_slices); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"time_frame_start : %+e [ms] = %s\n" ,dd->time_frame_start,MdcGetStrHHMMSS(dd->time_frame_start)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"time_frame_delay : %+e [ms] = %s\n" ,dd->time_frame_delay,MdcGetStrHHMMSS(dd->time_frame_delay)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"time_frame_duration: %+e [ms] = %s\n" ,dd->time_frame_duration,MdcGetStrHHMMSS(dd->time_frame_duration)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"delay_slices : %+e [ms] = %s\n" ,dd->delay_slices,MdcGetStrHHMMSS(dd->delay_slices)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); } } if ((my.fi->bednr > 0) && (my.fi->beddata != NULL)) { sprintf(xmdcstr,"\nBed Data\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"bednr : %u\n",my.fi->bednr); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); for (i=0; ibednr; i++) { BED_DATA *bd = &my.fi->beddata[i]; sprintf(xmdcstr,"-------- [ %.3u ] --------\n",i+1); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"bed horiz. offset : %+e [mm]\n",bd->hoffset); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"bed vert. offset : %+e [mm]\n", bd->voffset); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); } } sprintf(xmdcstr,"\nInternal Information\n"); gtk_text_insert(GTK_TEXT(text),fixed,&Blue,NULL,xmdcstr,-1); sprintf(xmdcstr,"map : %u (= %s)\n",my.fi->map, MdcGetStrColorMap((int)my.fi->map)); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"comm_length : %u\n",my.fi->comm_length); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); sprintf(xmdcstr,"comment : "); gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); if (my.fi->comm_length != 0 && my.fi->comment != NULL) { strncpy(xmdcstr,my.fi->comment,my.fi->comm_length); xmdcstr[my.fi->comm_length]='\0'; }else{ sprintf(xmdcstr,"\n"); } gtk_text_insert(GTK_TEXT(text),fixed,NULL,NULL,xmdcstr,-1); gtk_text_thaw(GTK_TEXT(text)); /* create separator and close button */ separator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(box1),separator,FALSE,TRUE,0); gtk_widget_show(separator); box2 = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(box2), 0); gtk_box_pack_start(GTK_BOX(box1),box2, FALSE, FALSE, 0); gtk_widget_show(box2); button = gtk_button_new_with_label("Close"); gtk_signal_connect_object(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(window)); gtk_box_pack_start(GTK_BOX(box2),button,FALSE,FALSE,0); gtk_widget_show(button); gtk_widget_show(window); } xmedcon-0.14.1/source/xdefs.c0000644000175000017510000000564012636253502012742 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xdefs.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : global defines * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xdefs.c,v 1.26 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include #include "xmedcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ Uint8 XMDC_FILE_OPEN=MDC_NO; Uint8 XMDC_FILE_TYPE=XMDC_NORMAL; Uint8 XMDC_IMAGE_BORDER = 1; /* border between images in viewer window */ GdkColor Red; GdkColor Green; GdkColor Blue; GdkColor Yellow; GdkCursor *handcursor; GdkCursor *fleurcursor; GdkFont *sfixed; MyMainStruct my; OptionsMedConStruct sOptionsMedCon; ColormapSelectionStruct sColormapSelection; MapPlaceSelectionStruct sMapPlaceSelection; LabelSelectionStruct sLabelSelection; RenderSelectionStruct sRenderSelection; ExtractSelectionStruct sExtractSelection; RawReadSelectionStruct sRawReadSelection; ResizeSelectionStruct sResizeSelection; PagesSelectionStruct sPagesSelection; ColGbcCorrectStruct sGbc; EditFileInfoStruct sEditFI; char labelindex[25]; char labeltimes[50]; Uint32 write_counter=0; char xmdcstr[MDC_2KB_OFFSET]; char *XMEDCONLUT=NULL; /* environ var: dir to color lookup tables */ char *XMEDCONRPI=NULL; /* environ var: dir to raw predef input files */ xmedcon-0.14.1/source/m-raw.h0000644000175000017510000000533712636253502012664 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-raw.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-raw.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-raw.h,v 1.23 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_RAW_H__ #define __M_RAW_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ #define MdcReadInterActive(a) MdcReadRAW(a) typedef struct MdcRawInputStruct_t { Uint32 gen_offset, img_offset; Int8 DIFF, REPEAT, REDO; }MdcRawInputStruct; typedef struct MdcRawPrevInputStruct_t { Uint32 XDIM, YDIM, NRIMGS; Uint32 GENHDR, IMGHDR, ABSHDR; Int16 PTYPE; Int8 DIFF, HDRREP, PSWAP, REDO; }MdcRawPrevInputStruct; extern MdcRawInputStruct mdcrawinput; extern MdcRawPrevInputStruct mdcrawprevinput; /**************************************************************************** F U N C T I O N S ****************************************************************************/ void MdcInitRawPrevInput(void); char *MdcGetRawInput(FILEINFO *fi); char *MdcUsePrevRawInput(FILEINFO *fi); char *MdcAskRawInput(FILEINFO *fi); char *MdcReadRAW(FILEINFO *fi); char *MdcWriteRAW(FILEINFO *fi); int MdcCheckPredef(const char *fname); char *MdcReadPredef(const char *fname); char *MdcWritePredef(const char *fname); #endif xmedcon-0.14.1/source/appicon.rc0000644000175000017510000000004007313505110013420 00000000000000app ICON "..\\etc\\xmedcon.ico" xmedcon-0.14.1/source/m-ecat72.h0000644000175000017510000001035012636253502013147 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-ecat72.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-ecat72.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-ecat72.h,v 1.21 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_ECAT72_H__ #define __M_ECAT72_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_ECAT7_SIG "MATRIX7" #define MDC_ECAT7_MAX_MATRICES 5000 #define MDC_ECAT7_MAX_PLANES 1024 #define MDC_ECAT7_MAX_FRAMES 512 #define MDC_ECAT7_MAX_GATES 32 #define MDC_ECAT7_MAX_BEDS 32 #define MDC_ECAT7_FILE_TYPE_UNKNOWN 0 #define MDC_ECAT7_FILE_TYPE_SINOGRAM 1 #define MDC_ECAT7_FILE_TYPE_IMAGE16 2 #define MDC_ECAT7_FILE_TYPE_ATTNCORR 3 #define MDC_ECAT7_FILE_TYPE_NORM 4 #define MDC_ECAT7_FILE_TYPE_POLARMAP 5 #define MDC_ECAT7_FILE_TYPE_VOLUME8 6 #define MDC_ECAT7_FILE_TYPE_VOLUME16 7 #define MDC_ECAT7_FILE_TYPE_PROJECTION8 8 #define MDC_ECAT7_FILE_TYPE_PROJECTION16 9 #define MDC_ECAT7_FILE_TYPE_IMAGE8 10 #define MDC_ECAT7_FILE_TYPE_3DSINO16 11 #define MDC_ECAT7_FILE_TYPE_3DSINO8 12 #define MDC_ECAT7_FILE_TYPE_3DNORM 13 #define MDC_ECAT7_FILE_TYPE_3DSINOFLT 14 #define MDC_ECAT7_SOURCE_TYPE_NONE 1 #define MDC_ECAT7_SOURCE_TYPE_RRING 2 #define MDC_ECAT7_SOURCE_TYPE_RING 3 #define MDC_ECAT7_SOURCE_TYPE_ROD 4 #define MDC_ECAT7_SOURCE_TYPE_RROD 5 #define MDC_ECAT7_FEETFIRST_PRONE 0 #define MDC_ECAT7_HEADFIRST_PRONE 1 #define MDC_ECAT7_FEETFIRST_SUPINE 2 #define MDC_ECAT7_HEADFIRST_SUPINE 3 #define MDC_ECAT7_FEETFIRST_RIGHT 4 #define MDC_ECAT7_HEADFIRST_RIGHT 5 #define MDC_ECAT7_FEETFIRST_LEFT 6 #define MDC_ECAT7_HEADFIRST_LEFT 7 #define MDC_ECAT7_SCAN_UNKNOWN 0 #define MDC_ECAT7_SCAN_BLANK 1 #define MDC_ECAT7_SCAN_TRANSMISSION 2 #define MDC_ECAT7_SCAN_STATIC_EMISSION 3 #define MDC_ECAT7_SCAN_DYNAMIC_EMISSION 4 #define MDC_ECAT7_SCAN_GATED_EMISSION 5 #define MDC_ECAT7_SCAN_TRANS_RECTILINEAR 6 #define MDC_ECAT7_SCAN_EMISSION_RECTILINEAR 7 /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcCheckECAT7(FILEINFO *fi); void MdcEcatPrintMainHdr(Mdc_Main_header7 *mh); void MdcEcatPrintImgSubHdr(Mdc_Image_subheader7 *ish, int nr); void MdcEcatPrintAttnSubHdr(Mdc_Attn_subheader7 *ash, int nr); void MdcEcatPrintScanSubHdr(Mdc_Scan_subheader7 *ssh); void MdcEcatPrintNormSubHdr(Mdc_Norm_subheader7 *nsh); const char *MdcReadECAT7(FILEINFO *fi); const char *MdcWriteECAT7(FILEINFO *fi); #endif xmedcon-0.14.1/source/xhelp.h0000644000175000017510000000351712636253502012757 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xhelp.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xhelp.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xhelp.h,v 1.16 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XHELP__H__ #define __XHELP__H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcHelp(GtkWidget *widget, gpointer data); #endif xmedcon-0.14.1/source/m-conc.h0000644000175000017510000012360512636253502013014 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-conc.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-conc.c header file * * * * project : (X)MedCon by Erik Nolf * * * * Author : Andy Loening * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-conc.h,v 1.35 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_CONC_H__ #define __M_CONC_H__ /**************************************************************************** H E A D E R S ****************************************************************************/ /**************************************************************************** D E F I N E S ****************************************************************************/ /* Acquisition scanner modality (integer) */ typedef enum { MDC_CONC_MODALITY_UNKNOWN = -1, MDC_CONC_MODALITY_PET = 0, MDC_CONC_MODALITY_CT = 1, MDC_CONC_MODALITY_SPECT = 2, MDC_CONC_MODALITY_LAST = 3, /* place holder, as list begins at -1 */ MDC_CONC_NUM_MODALITIES = 4 } MdcConcModalityTypes; /* siemens/concorde data file types (integer) */ typedef enum { MDC_CONC_FILE_UNKNOWN, MDC_CONC_FILE_LIST_MODE, MDC_CONC_FILE_SINOGRAM, MDC_CONC_FILE_NORMALIZATION, MDC_CONC_FILE_ATTENUATION, MDC_CONC_FILE_IMAGE, MDC_CONC_FILE_BLANK, MDC_CONC_FILE_RESERVED, /* 7 is skipped for some reason */ MDC_CONC_FILE_MU_MAP, MDC_CONC_FILE_SCATTER_CORRECTION, MDC_CONC_FILE_CRYSTAL_EFFICIENCY_DATA, MDC_CONC_FILE_CRYSTAL_INTERFERENCE_CORRECTION, MDC_CONC_FILE_TRANSAXIAL_GEOMETRIC_CORRECTION, MDC_CONC_FILE_AXIAL_GEOMETRIC_CORRECTION, MDC_CONC_FILE_CT_PROJECTION_DATA, MDC_CONC_FILE_SPECT_RAW_PROJECTION_DATA, MDC_CONC_FILE_SPECT_ENERGY_PROJECTION_DATA, MDC_CONC_FILE_SPECT_NORMALIZATION_DATA, MDC_CONC_NUM_FILE_TYPES } MdcConcFileTypes; /* siemens/concorde acquisition modes (integer) */ typedef enum { MDC_CONC_ACQ_UNKNOWN, /* Unknown acquisition mode */ MDC_CONC_ACQ_BLANK, /* Blank acquisition */ MDC_CONC_ACQ_EMISSION, /* Emission acquisition */ MDC_CONC_ACQ_DYNAMIC, /* Dynamic acquisition */ MDC_CONC_ACQ_GATED, /* Gated acquisition */ MDC_CONC_ACQ_CONTINUOUS, /* Continous bed motion acquisition */ MDC_CONC_ACQ_SINGLES, /* Singles transmission acquisition */ MDC_CONC_ACQ_WINDOWED_COINCIDENCE, /* Windowed coincidence transmission acquisition */ MDC_CONC_ACQ_NON_WINDOWED_COINCIDENCE, /* Non-windowed coincidence transmission acquisition */ MDC_CONC_ACQ_CT_PROJECTION, /* CT projection acquisition */ MDC_CONC_ACQ_CT_CALIBRATION, /* CT calibration acquisition */ MDC_CONC_ACQ_SPECT_PLANAR_PROJECTION, /* SPECT planar projection acquisition */ MDC_CONC_ACQ_SPECT_MULTIPROJECTION, /* SPECT multi-projection acquisition */ MDC_CONC_ACQ_SPECT_CALIBRATION, /* SPECT calibration acquisition */ MDC_CONC_ACQ_SPECT_NORMALIZATION, /* SPECT normalization acquisition */ MDC_CONC_ACQ_SPECT_DETECTOR_SETUP, /* SPECT detector setup acquisition */ MDC_CONC_ACQ_SPECT_SCOUT_VIEW, /* SPECT scout view acquisition */ MDC_CONC_NUM_ACQ_MODES } MdcConcAcqModes; typedef enum { MDC_CONC_BED_MOTION_STATIC, /* Static or unknown bed motion */ MDC_CONC_BED_MOTION_CONTINOUS, /* Continous bed motion */ MDC_CONC_BED_MOTION_MULTIPLE, /* Multiple bed positions, i.e. step and shoot */ MDC_CONC_NUM_BED_MOTIONS } MdcConcBedMotion; typedef enum { MDC_CONC_TX_SRC_UNKNOWN, /* Unknown transmission source type */ MDC_CONC_TX_SRC_POINT, /* Transmission point source */ MDC_CONC_TX_SRC_LINE, /* transmission line source */ MDC_CONC_NUM_TX_SRC_TYPES } MdcConcTXSrcTypes; typedef enum { MDC_CONC_DATA_UNKNOWN, /* Unknown data type */ MDC_CONC_DATA_SBYTE, /* Signed 8 bit */ MDC_CONC_DATA_SSHORT_LE, /* Signed 16 bit int, little endian */ MDC_CONC_DATA_SINT_LE, /* Signed 32 bit int, little endian */ MDC_CONC_DATA_FLOAT_LE, /* IEEE Float (32bit), little endian */ MDC_CONC_DATA_FLOAT_BE, /* IEEE Float (32bit), big endian */ MDC_CONC_DATA_SSHORT_BE, /* Signed 16 bit int, big endian */ MDC_CONC_DATA_SINT_BE, /* Signed 32 bit int, big endian */ MDC_CONC_NUM_DATA_TYPES } MdcConcDataTypes; typedef enum { MDC_CONC_ORDER_VIEW, /* Element/Axis/View/Ring_diff - view mode */ MDC_CONC_ORDER_SINOGRAM, /* Element/View/Axis/Ring_Diff - sinogram mode */ MDC_CONC_NUM_ORDER_MODES } MdcConcOrderModes; typedef enum { MDC_CONC_REBIN_UNKNOWN, /* Unknown, or no, algorith type */ MDC_CONC_REBIN_FULL, /* Full 3D binning (span and ring difference) */ MDC_CONC_REBIN_SINGLE, /* Single-Slice Rebinning */ MDC_CONC_REBIN_FOURIER, /* Fourier Rebinning */ MDC_CONC_NUM_REBIN_TYPES } MdcConcRebinTypes; typedef enum { MDC_CONC_RECON_UNKNOWN, /* Unknown, or no, algorithm type */ MDC_CONC_RECON_FBP, /* Filtered Backprojection */ MDC_CONC_RECON_OSEM2D, /* OSEM2D */ MDC_CONC_RECON_OSEM3D, /* OSEM3D */ MDC_CONC_RECON_UNUSED4, /* unused */ MDC_CONC_RECON_UNUSED5, /* unused */ MDC_CONC_RECON_OSEM3D_MAP, /* OSEM3D followed by MAP or FastMAP */ MDC_CONC_RECON_MAPTR, /* MAPTR for transmission image */ MDC_CONC_RECON_FELDKAMP, /* Feldkamp cone beam */ MDC_CONC_NUM_RECON_TYPES } MdcConcReconTypes; typedef enum { MDC_CONC_OSEM2D_UNWEIGHTED, /* Unweighted osem2d reconstruction */ MDC_CONC_OSEM2D_ATTENUATION, /* Attenuation weighted osem2d reconstruction */ MDC_CONC_NUM_OSEM2D_TYPES, MDC_CONC_OSEM2D_UNKNOWN } MdcConcOSEM2DTypes; /* deadtime correction applied to the data set */ typedef enum { MDC_CONC_DEAD_CORR_NONE, /* No deadtime correction applied */ MDC_CONC_DEAD_CORR_GLOBAL, /* Global estimate based on singles */ MDC_CONC_DEAD_CORR_CMS, /* CMS estimate based on singles */ MDC_CONC_DEAD_CORR_GLOBAL_RUNNING, /* Global estimate based on running average */ MDC_CONC_DEAD_CORR_BLOCK, /* Blank/TX singles estimate (block based) */ MDC_CONC_NUM_DEAD_CORR_TYPES } MdcConcDeadCorrTypes; typedef enum { MDC_CONC_ATTN_CORR_NONE, /* No attenuation applied */ MDC_CONC_ATTN_CORR_PT_WINDOWED_COINCIDENCE, /* Point source in windowed TX coincidence */ MDC_CONC_ATTN_CORR_PT_SINGLES, /* Point source singles based TX */ MDC_CONC_ATTN_CORR_SEG_COINCIDENCE, /* Segmented point src in TX coincidence*/ MDC_CONC_ATTN_CORR_SEG_SINGLES, /* Segmented point src singles based TX */ MDC_CONC_ATTN_CORR_GEOMETRY, /* Calculated by geometry */ MDC_CONC_ATTN_CORR_NON_BETA_SINGLES, /* Non-positron source singles based TX */ MDC_CONC_ATTN_CORR_PT_NON_WINDOWED_COINCIDENCE, /* Point source in non-windowed TX coincidence */ MDC_CONC_NUM_ATTN_CORR_TYPES } MdcConcAttnCorrTypes; typedef enum { MDC_CONC_SCATTER_CORR_NONE, /* No scatter correction applied */ MDC_CONC_SCATTER_CORR_TAILS, /* Fit of emission tail */ MDC_CONC_SCATTER_CORR_MONTE_CARLO, /* Monte Carlo of emission and transmission data */ MDC_CONC_SCATTER_CORR_DIRECT, /* Direct calculation from analytical formulas */ MDC_CONC_SCATTER_CORR_MODEL, /* Model-based scatter for singles TX */ MDC_CONC_SCATTER_CORR_OFF_WINDOW, /* TX off-window windowed coincidence subtraction */ MDC_CONC_SCATTER_CORR_SCALED, /* Singles TX scaled scatter from attenuation subtraction */ MDC_CONC_NUM_SCATTER_CORR_TYPES } MdcConcScatterCorrTypes; typedef enum { MDC_CONC_EVENT_UNKNOWN, /* Unknown event type */ MDC_CONC_EVENT_SINGLES, /* Singles */ MDC_CONC_EVENT_COINCIDENCES, /* Prompt events (coincidences) */ MDC_CONC_EVENT_DELAYS, /* Delay events */ MDC_CONC_EVENT_TRUES, /* Trues */ MDC_CONC_EVENT_ENERGY_SPECTRUM, /* Energy spectrum data */ MDC_CONC_NUM_EVENT_TYPES } MdcConcEventTypes; typedef enum { MDC_CONC_FILTER_NONE, /* No filter */ MDC_CONC_FILTER_RAMP, /* Ramp filter (backprojection) or no filter */ MDC_CONC_FILTER_BUTTERWORTH_1, /* First-order Butterworth window */ MDC_CONC_FILTER_HANNING, /* Hanning window */ MDC_CONC_FILTER_HAMMING, /* Hamming window */ MDC_CONC_FILTER_PARZEN, /* Parzen window */ MDC_CONC_FILTER_SHEPP, /* Shepp filter */ MDC_CONC_FILTER_BUTTERWORTH_2, /* Second-order Butterworth window */ MDC_CONC_NUM_FILTER_TYPES } MdcConcFilterTypes; typedef enum { MDC_CONC_NORM_NONE, /* No normalization applied */ MDC_CONC_NORM_POINT_INVERSE, /* Point source inversion */ MDC_CONC_NORM_POINT_COMPONENT, /* Point source component based */ MDC_CONC_NORM_CYL_INVERSE, /* Cylinder source inversion */ MDC_CONC_NORM_CYL_COMPONENT, /* Cylinder source component based */ MDC_CONC_NUM_NORM_TYPES } MdcConcNormTypes; typedef enum { MDC_CONC_CALIB_UNITS_UNKNOWN, /* Unknown calibration units */ MDC_CONC_CALIB_UNITS_NANOCURIES, /* nanoCuries/cc */ MDC_CONC_CALIB_UNITS_BEQUERELS, /* bequerels/cc */ MDC_CONC_NUM_CALIB_UNITS } MdcConcCalibUnits; typedef enum { MDC_CONC_DOSE_UNITS_UNKNOWN, /* Unknown calibration units */ MDC_CONC_DOSE_UNITS_MILLICURIES, /* mCi */ MDC_CONC_DOSE_UNITS_MEGA_BEQUERELS, /* MBq */ MDC_CONC_NUM_DOSE_UNITS } MdcConcDoseUnits; typedef enum { MDC_CONC_SUBJECT_ORIENTATION_UNKNOWN, /* 0 - Unknown subject orientation */ MDC_CONC_SUBJECT_ORIENTATION_FEET_PRONE, /* 1 - Feet first, prone */ MDC_CONC_SUBJECT_ORIENTATION_HEAD_PRONE, /* 2 - Head first, prone */ MDC_CONC_SUBJECT_ORIENTATION_FEET_SUPINE, /* 3 - Feet first, supine */ MDC_CONC_SUBJECT_ORIENTATION_HEAD_SUPINE, /* 4 - Head first, supine */ MDC_CONC_SUBJECT_ORIENTATION_FEET_RIGHT, /* 5 - Feet first, right */ MDC_CONC_SUBJECT_ORIENTATION_HEAD_RIGHT, /* 6 - Head first, right */ MDC_CONC_SUBJECT_ORIENTATION_FEET_LEFT, /* 7 - Feet first, left */ MDC_CONC_SUBJECT_ORIENTATION_HEAD_LEFT, /* 8 - Head first, left */ MDC_CONC_NUM_SUBJECT_ORIENTATIONS } MdcConcSubjectOrientation; typedef enum { MDC_CONC_LENGTH_UNITS_UNKNOWN, /* 0 - Unknown length units */ MDC_CONC_LENGTH_UNITS_MILLIMETERS, /* 1 - millimeters */ MDC_CONC_LENGTH_UNITS_CENTIMETERS, /* 2 - centimeters */ MDC_CONC_LENGTH_UNITS_INCHES, /* 3 - inches */ MDC_CONC_NUM_LENGTH_UNITS } MdcConcLengthUnits; typedef enum { MDC_CONC_WEIGHT_UNITS_UNKNOWN, /* 0 - Unknown weight units */ MDC_CONC_WEIGHT_UNITS_GRAMS, /* 1 - grams */ MDC_CONC_WEIGHT_UNITS_OUNCES, /* 2 - ounces */ MDC_CONC_WEIGHT_UNITS_KILOGRAMS, /* 3 - kilograms */ MDC_CONC_WEIGHT_UNITS_POUNDS, /* 4 - pounds */ MDC_CONC_NUM_WEIGHT_UNITS } MdcConcWeightUnits; /* what can appear in the top of the header */ typedef enum { /* Version of header parameters (float) */ MDC_CONC_HDR_VERSION, /* Manufacturer's name (string) */ MDC_CONC_HDR_MANUFACTURER, /* Scanner model (integer) 0 - Unknown 2000 - Primate 2001 - Rodent 2002 - microPET2 2500 - Focus_220 2501 - Focus_120 3000 - mCAT 3500 - mCATII 4000 - mSPECT 5000 - Inveon_Dedicated_PET 5001 - Inveon_MM_Platform 6000 - MR_PET_Head_Insert 8000 - Tuebingen_PET_MR */ MDC_CONC_HDR_MODEL, /* Acquisition scanner modality (integer) -1 - Unknown acquisition modality 0 - PET acquisition 1 - CT acquisition 2 - SPECT acquisition */ MDC_CONC_HDR_MODALITY, /* Scanner modality configuration number (integer) 0 - Unknown 2000 - Primate 2001 - Rodent 2002 - microPET2 2500 - Focus_220 2501 - Focus_120 3000 - mCAT 3500 - mCATII 3600 - Inveon_MM_Std_CT 3601 - Inveon_MM_HiRes_Std_CT 3602 - Inveon_MM_Std_LFOV_CT 3603 - Inveon_MM_HiRes_LFOV_CT 5000 - Inveon_Dedicated_PET 6000 - MR_PET_Head_Insert 8000 - Tuebingen_PET_MR 5500 - Inveon_MM_PET */ MDC_CONC_HDR_MODALITY_CONFIGURATION, /* Institution identification (string) */ MDC_CONC_HDR_INSTITUTION, /* Study type/description (string) */ MDC_CONC_HDR_STUDY, /* Data filename, possibly including path (string) */ /* NOTE: Filename may contain spaces, therefore the ENTIRE */ /* line, up to the EOL, is used after the parameter name. */ MDC_CONC_HDR_FILE_NAME, /* Data file type (integer) 0 - Unknown data file type 1 - List mode data file 2 - Sinogram data file 3 - Normalization data file 4 - Attenuation correction data file 5 - Image data file 6 - Blank data file 8 - Mu map data file 9 - Scatter correction data file 10 - Crystal efficiency data 11 - Crystal interference correction 12 - Transaxial geometric correction 13 - Axial geometric correction 14 - CT projection data 15 - SPECT raw projection data 16 - SPECT energy data from projections 17 - SPECT normalization data */ MDC_CONC_HDR_FILE_TYPE, /* Acquisition mode (integer) 0 - Unknown acquisition mode 1 - Blank acquisition 2 - Emission acquisition 3 - Dynamic acquisition 4 - Gated acquisition 5 - Continuous bed motion acquisition 6 - Singles transmission acquisition 7 - Windowed coincidence transmission acquisition 8 - Non-windowed coincidence transmission acquisition 9 - CT projection acquisition 10 - CT calibration acquisition 11 - SPECT planar projection acquisition 12 - SPECT multi-projection acquisition 13 - SPECT calibration acquisition */ MDC_CONC_HDR_ACQUISITION_MODE, /* Bed control (integer) 0 - Unknown bed control 1 - Dedicated PET 2 - microCAT II 3 - Multimodality bed control 4 - microPET bed control */ MDC_CONC_HDR_BED_CONTROL, /* Bed motion (integer) */ /* 0 - Static or unknown bed motion */ /* 1 - Continuous bed motion */ /* 2 - Multiple bed positions, i.e. step and shoot */ MDC_CONC_HDR_BED_MOTION, /* Number of bed positions in data file (integer) */ MDC_CONC_HDR_NUMBER_BED_POSITIONS, /* Horizontal bed calibration, in microns (float) */ MDC_CONC_HDR_HORIZONTAL_BED_CALIBRATION, /* Vertical bed calibration, in microns (float) */ MDC_CONC_HDR_VERTICAL_BED_CALIBRATION, /* Number of frames in data file (integer) */ MDC_CONC_HDR_TOTAL_FRAMES, /* Number of time frames in data file (integer) */ MDC_CONC_HDR_TIME_FRAMES, /* Isotope description (string) */ MDC_CONC_HDR_ISOTOPE, /* Isotope half-life, in secs (float) */ MDC_CONC_HDR_ISOTOPE_HALF_LIFE, /* Isotope branching fraction (float) */ /* NOTE: Frame scale factor DOES NOT include */ /* isotope branching fraction. */ MDC_CONC_HDR_ISOTOPE_BRANCHING_FRACTION, /* Transaxial crystals per block (integer) */ MDC_CONC_HDR_TRANSAXIAL_CRYSTALS_PER_BLOCK, /* Axial crystals per block (integer) */ MDC_CONC_HDR_AXIAL_CRYSTALS_PER_BLOCK, /* Crystal offset for intrinsic rotation (integer) */ MDC_CONC_HDR_INTRINSIC_CRYSTAL_OFFSET, /* Number of transaxial blocks (integer) */ MDC_CONC_HDR_TRANSAXIAL_BLOCKS, /* Number of axial blocks (integer) */ MDC_CONC_HDR_AXIAL_BLOCKS, /* Transaxial crystal pitch, in cm (float) */ MDC_CONC_HDR_TRANSAXIAL_CRYSTAL_PITCH, /* Axial crystal pitch, in cm (float) */ MDC_CONC_HDR_AXIAL_CRYSTAL_PITCH, /* Ring radius to crystal face, in cm (float) */ MDC_CONC_HDR_RADIUS, /* Radial field-of-view, in cm (float) */ MDC_CONC_HDR_RADIAL_FOV, /* (Point) source radius, in cm (float) */ MDC_CONC_HDR_PT_SRC_RADIUS, /* deprecated? */ MDC_CONC_HDR_SRC_RADIUS, /* Source axial cm per revolution, in cm (float) */ MDC_CONC_HDR_SRC_CM_PER_REV, /* Source type (integer) */ /* 0 - Unknown TX source type */ /* 1 - TX point source */ /* 2 - TX line source */ MDC_CONC_HDR_TX_SRC_TYPE, /* (Point) source encoder steps per revolution (integer) */ MDC_CONC_HDR_PT_SRC_STEPS_PER_REV, /* deprecated? */ MDC_CONC_HDR_SRC_STEPS_PER_REV, /* Default number of projections (integer) */ MDC_CONC_HDR_DEFAULT_PROJECTIONS, /* Default number of transaxial angles (integer) */ MDC_CONC_HDR_DEFAULT_TRANSAXIAL_ANGLES, /* Crystal thickness, in cm (float) */ MDC_CONC_HDR_CRYSTAL_THICKNESS, /* Depth of interaction, in cm (float) */ MDC_CONC_HDR_DEPTH_OF_INTERACTION, /* Transaxial projection bin size, in cm (float) */ MDC_CONC_HDR_TRANSAXIAL_BIN_SIZE, /* Axial plane size, in cm (float) */ MDC_CONC_HDR_AXIAL_PLANE_SIZE, /* Number of detector panels ("rings/CT" are "1") (integer) */ MDC_CONC_HDR_NUMBER_DETECTOR_PANELS, /* Lower level energy threshold, in KeV (float) */ MDC_CONC_HDR_LLD, /* Upper level energy threshold, in KeV (float) */ MDC_CONC_HDR_ULD, /* Coincidence timing window, in nsecs (int) */ MDC_CONC_HDR_TIMING_WINDOW, /* Data type (integer) */ /* 0 - Unknown data type */ /* 1 - Byte (8-bits) data type */ /* 2 - 2-byte integer - Little Endian */ /* 3 - 4-byte integer - Little Endian */ /* 4 - 4-byte IEEE float - Little Endian */ /* 5 - 4-byte IEEE float - Big Endian */ /* 6 - 2-byte integer - Big Endian */ /* 7 - 4-byte integer - Big Endian */ MDC_CONC_HDR_DATA_TYPE, /* Data order (integer) */ /* 0 - Element/Axis/View/Ring_Diff - view mode */ /* 1 - Element/View/Axis/Ring_Diff - sinogram mode */ /* NOTE that ElVwAxRd (XYZW) is the data order for images. */ /* ElVwAxRd for images means that Z and Y are flipped. */ MDC_CONC_HDR_DATA_ORDER, /* Span of data set (integer) */ MDC_CONC_HDR_SPAN, /* Maximum ring difference of data set (integer) */ MDC_CONC_HDR_RING_DIFFERENCE, /* Number of dimensions in data set (integer) */ /* Order from fastest to slowest is XYZW */ MDC_CONC_HDR_NUMBER_OF_DIMENSIONS, /* Size of X dimension in data set (integer) */ MDC_CONC_HDR_X_DIMENSION, /* Size of Y dimension in data set (integer) */ MDC_CONC_HDR_Y_DIMENSION, /* Size of Z dimension in data set (integer) */ MDC_CONC_HDR_Z_DIMENSION, /* Size of W dimension in data set (integer) */ MDC_CONC_HDR_W_DIMENSION, /* Size of 'changing' dimension at each step (integer integer) */ MDC_CONC_HDR_DELTA_ELEMENTS, /* X filter and/or apodizing windows type (integer) */ /* and cutoff (float) */ /* 0 - No filter */ /* 1 - Ramp filter (backprojection) or no filter */ /* 2 - First-order Butterworth window */ /* 3 - Hanning window */ /* 4 - Hamming window */ /* 5 - Parzen window */ /* 6 - Shepp filter */ /* 7 - Second-order Butterworth window */ /* NOTE that a cutoff of 0.5 is the Nyquist point */ /* i.e 1.0 / (2.0 * sampling). */ /* Also, the Ramp and Shepp should ONLY be used */ /* for backprojection */ MDC_CONC_HDR_X_FILTER, /* Y apodizing filter type (integer) and cutoff (float) */ /* 0 - No filter */ /* 2 - First-order Butterworth window */ /* 3 - Hanning window */ /* 4 - Hamming window */ /* 5 - Parzen window */ /* 7 - Second-order Butterworth window */ /* NOTE that a cutoff of 0.5 is the Nyquist point */ /* i.e 1.0 / (2.0 * sampling). */ MDC_CONC_HDR_Y_FILTER, /* Z apodizing filter type (integer) and cutoff (float) */ /* 0 - No filter */ /* 2 - First-order Butterworth window */ /* 3 - Hanning window */ /* 4 - Hamming window */ /* 5 - Parzen window */ /* 7 - Second-order Butterworth window */ /* NOTE that a cutoff of 0.5 is the Nyquist point */ /* i.e 1.0 / (2.0 * sampling). */ MDC_CONC_HDR_Z_FILTER, /* Version of histogram program used (float) */ MDC_CONC_HDR_HISTOGRAM_VERSION, /* Rebinning type (integer) */ /* 0 - Unknown, or no, algorithm type */ /* 1 - Full 3D binning (span and ring difference) */ /* 2 - Single-Slice Rebinning */ /* 3 - Fourier Rebinning */ MDC_CONC_HDR_REBINNING_TYPE, /* Version of rebinning program used (float) */ MDC_CONC_HDR_REBINNING_VERSION, /* Reconstruction type (integer) */ /* 0 - Unknown, or no, algorithm type */ /* 1 - Filtered Backprojection */ /* 2 - OSEM2D */ /* 3 - OSEM3D */ /* 4 - unused */ /* 5 - unused */ /* 6 - OSEM3D followed by MAP or FastMAP */ /* 7 - MAPTR for transmission image */ /* 8 - MAP 3D reconstruction */ /* 9 - Feldkamp cone beam */ MDC_CONC_HDR_RECON_ALGORITHM, /* Version of reconstruction program used (float) */ MDC_CONC_HDR_RECON_VERSION, /* Number of osem3d subsets in MAP reconstruction (integer) */ MDC_CONC_HDR_MAP_SUBSETS, /* Number of osem3d iterations in MAP reconstruction (integer) */ MDC_CONC_HDR_MAP_OSEM3D_ITERATIONS, /* Number of MAP iterations after osem3d iterations (integer) */ MDC_CONC_HDR_MAP_ITERATIONS, /* Beta value for MAP reconstruction (float) */ MDC_CONC_HDR_MAP_BETA, /* MAP blur kernel type (int) */ MDC_CONC_HDR_MAP_BLUR_TYPE, /* MAP prior type (int) */ MDC_CONC_HDR_MAP_PRIOR_TYPE, /* MAP blur kernel file prefix (string) */ MDC_CONC_HDR_MAP_BLUR_FILE, /* MAP P matrix file prefix (string) */ MDC_CONC_HDR_MAP_PMATRIX_FILE, /* OSEM2D method (integer) */ /* 0 - Unweighted osem2d reconstruction */ /* 1 - Attenuation weighted osem2d reconstruction */ MDC_CONC_HDR_OSEM2D_METHOD, /* Number of osem2d subsets (integer) */ MDC_CONC_HDR_OSEM2D_SUBSETS, /* Number of osem2d iterations (integer) */ MDC_CONC_HDR_OSEM2D_ITERATIONS, /* Number of EM iterations after osem2d iterations (integer) */ MDC_CONC_HDR_OSEM2D_EM_ITERATIONS, /* Epsilon and power values for map regularization (float integer) */ MDC_CONC_HDR_OSEM2D_MAP, /* Large object osem2d x_offset in cm (float) */ MDC_CONC_HDR_OSEM2D_X_OFFSET, /* Large object osem2d y_offset in cm (float) */ MDC_CONC_HDR_OSEM2D_Y_OFFSET, /* Large object osem2d zoom (float) */ MDC_CONC_HDR_OSEM2D_ZOOM, /* Deadtime correction applied to data set (integer) */ /* 0 - No deadtime correction applied */ /* 1 - Global estimate based on singles */ /* 2 - CMS estimate based on singles */ /* 3 - Global estimate based on running deadtime average */ /* 4 - Blank/TX singles estimate (block based) */ MDC_CONC_HDR_DEADTIME_CORRECTION_APPLIED, /* Decay correction applied to data set (integer) */ /* 0 (FALSE) - Decay correction has NOT been applied */ /* !0 (TRUE) - Decay correction has been applied */ MDC_CONC_HDR_DECAY_CORRECTION_APPLIED, /* Normalization applied to data set (integer) */ /* 0 - No normalization applied */ /* 1 - Point source inversion */ /* 2 - Point source component based */ /* 3 - Cylinder source inversion */ /* 4 - Cylinder source component based */ MDC_CONC_HDR_NORMALIZATION_APPLIED, /* Normalization filename, possibly including path (string) */ /* NOTE: Filename may contain spaces, therefore the ENTIRE */ /* line, up to the EOL, is used after the parameter name. */ MDC_CONC_HDR_NORMALIZATION_FILENAME, /* Attenuation applied to data set (integer) */ /* 0 - No attenuation applied */ /* 1 - Point source in windowed TX coincidence */ /* 2 - Point source singles based TX */ /* 3 - Segmented point source in TX coincidence */ /* 4 - Segmented point source singles based TX */ /* 5 - Calculated by geometry */ /* 6 - Non-positron source singles based TX */ /* 7 - Point source in non-windowed TX coincidence */ /* 8 - Generated from CT image */ MDC_CONC_HDR_ATTENUATION_APPLIED, /* Attenuation correction filename, possibly including path (string) */ /* NOTE: Filename may contain spaces, therefore the ENTIRE */ /* line, up to the EOL, is used after the parameter name. */ MDC_CONC_HDR_ATTENUATION_FILENAME, /* Scatter correction applied to data set (integer) */ /* 0 - No scatter correction applied */ /* 1 - Fit of emission tail */ /* 2 - Monte Carlo of emission and transmission data */ /* 3 - Direct calculation from analytical formulas */ /* 4 - Model-based scatter for singles TX */ /* 5 - TX off-window windowed coincidence subtraction */ /* 6 - Singles TX scaled scatter from attenuation subtraction */ MDC_CONC_HDR_SCATTER_CORRECTION, /* Version of scatter program used (float) */ MDC_CONC_HDR_SCATTER_VERSION, /* Arc correction applied to data set (integer) */ /* 0 (FALSE) - Arc correction has NOT been applied */ /* !0 (TRUE) - Arc correction has been applied */ MDC_CONC_HDR_ARC_CORRECTION_APPLIED, /* Rotation, in degrees, applied to data set (float) */ MDC_CONC_HDR_ROTATION, /* X offset, in cm, applied to data set (float) */ MDC_CONC_HDR_X_OFFSET, /* Y offset, in cm, applied to data set (float) */ MDC_CONC_HDR_Y_OFFSET, /* Z offset, in cm, applied to data set (float) */ MDC_CONC_HDR_Z_OFFSET, /* Zoom applied to data set (float) */ MDC_CONC_HDR_ZOOM, /* X origin of volume, in voxels (integer) */ MDC_CONC_HDR_VOLUME_ORIGIN_X, /* Y origin of volume, in voxels (integer) */ MDC_CONC_HDR_VOLUME_ORIGIN_Y, /* Z origin of volume, in voxels (integer) */ MDC_CONC_HDR_VOLUME_ORIGIN_Z, /* Registration data available (integer) 0 - No registration data available 1 - CT registration data available 2 - PET registration data available */ MDC_CONC_HDR_REGISTRATION_AVAILABLE, /* Transformation matrix filename, possibly including path (string) NOTE: Filename may contain spaces, therefore the ENTIRE line, up to the EOL, is used after the parameter name. */ MDC_CONC_HDR_TRANSFORMATION_MATRIX, /* Spatial identification for registration (string) */ MDC_CONC_HDR_SPATIAL_IDENTIFIER, /* Reconstructed pixel size, in cm (float) */ /* NOTE: pixel_size = (((X_crystal_pitch / 2.0) * X_dim) / */ /* (image_size * zoom)) * (effective_radius / radius) */ MDC_CONC_HDR_PIXEL_SIZE, /* Reconstructed pixel size in X, in mm (float) */ MDC_CONC_HDR_PIXEL_SIZE_X, /* Reconstructed pixel size in Y, in mm (float) */ MDC_CONC_HDR_PIXEL_SIZE_Y, /* Reconstructed pixel size in Z, in mm (float) */ MDC_CONC_HDR_PIXEL_SIZE_Z, /* Calibration units (integer) */ /* 0 - Unknown calibration units */ /* 1 - nanoCuries/cc */ /* 2 - bequerels/cc */ MDC_CONC_HDR_CALIBRATION_UNITS, /* Calibration factor (float) */ /* NOTE: Frame scale factor DOES NOT include calibration factor. */ MDC_CONC_HDR_CALIBRATION_FACTOR, /* Calibration source branching fraction (float) */ /* NOTE: Frame scale factor DOES NOT include * calibration source branching fraction. */ MDC_CONC_HDR_CALIBRATION_BRANCHING_FRACTION, /* Number of singles rates in subheader (integer) */ /* NOTE: This normally is the number of blocks. */ MDC_CONC_HDR_NUMBER_OF_SINGLES_RATES, /* Investigator identification (string) */ MDC_CONC_HDR_INVESTIGATOR, /* Operator identification (string) */ MDC_CONC_HDR_OPERATOR, /* Study identification (string) */ MDC_CONC_HDR_STUDY_IDENTIFIER, /* Acquisition user ID (string) */ MDC_CONC_HDR_ACQUISITION_USER_ID, /* Histogram user ID (string) */ MDC_CONC_HDR_HISTOGRAM_USER_ID, /* Reconstruction user ID (string) */ MDC_CONC_HDR_RECONSTRUCTION_USER_ID, /* Scatter correction user ID (string) */ MDC_CONC_HDR_SCATTER_CORRECTION_USER_ID, /* Acquisition notes (string) */ MDC_CONC_HDR_ACQUISITION_NOTES, /* Scan start date and time (string) */ /* Format is: Sun Sep 16 01:03:52 1973 */ MDC_CONC_HDR_SCAN_TIME, /* Scan start date and time - GMT-based (string) Format is: Sun Sep 16 01:03:52 1973 */ MDC_CONC_HDR_GMT_SCAN_TIME, /* Injected compound (string) */ MDC_CONC_HDR_INJECTED_COMPOUND, /* Dose units (integer) */ /* 0 - Unknown dose units */ /* 1 - mCi */ /* 2 - MBq */ MDC_CONC_HDR_DOSE_UNITS, /* Injected dose (float) */ MDC_CONC_HDR_INJECTED_DOSE, /* Injection date and time (string) */ /* Format is: Sun Sep 16 01:03:52 1973 */ MDC_CONC_HDR_INJECTION_TIME, /* Injection decay correction factor (float) */ /* NOTE: Frame scale factor and decay correction factor */ /* DO NOT include injection decay correction factor. */ MDC_CONC_HDR_INJECTION_DECAY_CORRECTION, /* Pre- and residual activity units (integer) 0 - Unknown dose units 1 - mCi 2 - MBq */ MDC_CONC_HDR_ACTIVITY_UNITS, /* Activity before injection (float) */ MDC_CONC_HDR_ACTIVITY_BEFORE_INJECTION, /* Activity before injection measurement date and time (string) Format is: Sun Sep 16 01:03:52 1973 */ MDC_CONC_HDR_ACTIVITY_BEFORE_INJECTION_TIME, /* Residual activity (float) */ MDC_CONC_HDR_RESIDUAL_ACTIVITY, /* Residual activity measurement date and time (string) Format is: Sun Sep 16 01:03:52 1973 */ MDC_CONC_HDR_RESIDUAL_ACTIVITY_TIME, /* Number of gating inputs in study (integer) */ /* NOTE: This is ONLY present when gating inputs are present. */ MDC_CONC_HDR_GATE_INPUTS, /* Gate input bins per cycle and gate input range array (integer integer float float) */ /* NOTE: This is ONLY present when gating inputs are present. */ /* If the minimum/maximum gate input ranges are < 0.0, all values up to or below are accepted. */ /* If they are NOT present, all values are accepted. */ /* gate_input gate_bins/cycle minimum gate cycle (secs) maximum gate cycle (secs) */ MDC_CONC_HDR_GATE_BINS, /* Gate input description (integer string) */ /* NOTE: This is ONLY present when gating inputs are present. */ /* gate_input gate_description */ MDC_CONC_HDR_GATE_DESCRIPTION, /* Subject identifier (string) */ MDC_CONC_HDR_SUBJECT_IDENTIFIER, /* Subject genus (string) */ MDC_CONC_HDR_SUBJECT_GENUS, /* Subject orientation (integer) */ /* 0 - Unknown subject orientation */ /* 1 - Feet first, prone */ /* 2 - Head first, prone */ /* 3 - Feet first, supine */ /* 4 - Head first, supine */ /* 5 - Feet first, right */ /* 6 - Head first, right */ /* 7 - Feet first, left */ /* 8 - Head first, left */ MDC_CONC_HDR_SUBJECT_ORIENTATION, /* Length units (integer) */ /* 0 - Unknown length units */ /* 1 - millimeters */ /* 2 - centimeters */ /* 3 - inches */ MDC_CONC_HDR_SUBJECT_LENGTH_UNITS, /* Subject length (float) */ MDC_CONC_HDR_SUBJECT_LENGTH, /* Weight units (integer) */ /* 0 - Unknown weight units */ /* 1 - grams */ /* 2 - ounces */ /* 3 - kilograms */ /* 4 - pounds */ MDC_CONC_HDR_SUBJECT_WEIGHT_UNITS, /* Subject weight (float) */ MDC_CONC_HDR_SUBJECT_WEIGHT, /* Subject phenotype (string) */ MDC_CONC_HDR_SUBJECT_PHENOTYPE, /* Study model (string) */ MDC_CONC_HDR_STUDY_MODEL, /* Subject anesthesia (string) */ MDC_CONC_HDR_ANESTHESIA, /* Subject analgesia (string) */ MDC_CONC_HDR_ANALGESIA, /* Other drugs (string) */ MDC_CONC_HDR_OTHER_DRUGS, /* Food access (string) */ MDC_CONC_HDR_FOOD_ACCESS, /* Water access (string) */ MDC_CONC_HDR_WATER_ACCESS, /* Subject date of birth (string) */ MDC_CONC_HDR_SUBJECT_DOB, /* Subject age (string) */ MDC_CONC_HDR_SUBJECT_AGE, /*Subject sex (string) */ MDC_CONC_HDR_SUBJECT_SEX, /* Subject scan region (string) */ MDC_CONC_HDR_SUBJECT_SCAN_REGION, /* Subject glucose level (string) */ MDC_CONC_HDR_SUBJECT_GLUCOSE_LEVEL, /* Subject glucose level measurement time (string) */ MDC_CONC_HDR_SUBJECT_GLUCOSE_LEVEL_TIME, /* Original acquisition filename, DOES NOT INCLUDE path (string) NOTE: Filename may contain spaces, therefore the ENTIRE line, up to the EOL, is used after the parameter name. */ MDC_CONC_HDR_ACQUISITION_FILE_NAME, /* Following parameters are used for CT or SPECT modalities */ /* Gantry rotation (integer) 0 - No gantry rotation 1 - Rotation with discrete steps 2 - Continuous rotation */ MDC_CONC_HDR_GANTRY_ROTATION, /* Rotation direction (integer) 0 - Clockwise 1 - Counterclockwise */ MDC_CONC_HDR_ROTATION_DIRECTION, /* Rotating gantry starting angle, in degrees (float) */ MDC_CONC_HDR_ROTATING_STAGE_START_POSITION, /* Rotating gantry stop angle, in degrees (float) */ MDC_CONC_HDR_ROTATING_STAGE_STOP_POSITION, /* Number of rotation projections for rotating gantry (integer) */ MDC_CONC_HDR_NUMBER_OF_PROJECTIONS, /* Number of gantry revolutions for rotating gantry (float) */ MDC_CONC_HDR_GANTRY_ROTATIONS, /* Following parameters are used for CT modality only */ /* CAT file version (integer) */ MDC_CONC_HDR_CT_FILE_VERSION, /* Header size of CAT files before dark and light projections (integer) */ MDC_CONC_HDR_CT_HEADER_SIZE, /* CT transaxial projection size, in pixels (integer) */ MDC_CONC_HDR_CT_PROJ_SIZE_TRANSAXIAL, /* CT axial projection size, in pixels (integer) */ MDC_CONC_HDR_CT_PROJ_SIZE_AXIAL, /* Number to average the dark calibration projections (integer) */ MDC_CONC_HDR_CT_AVERAGE_DARK_PROJECTIONS, /* Number to average the light calibration projections (integer) */ MDC_CONC_HDR_CT_AVERAGE_LIGHT_PROJECTIONS, /* Total positions to acquire the light calibration projections (integer) */ MDC_CONC_HDR_CT_LIGHT_CALIBRATION_PROJECTIONS, /* Indicates if the positions to acquire light projections are same as scan projection positions (integer) */ MDC_CONC_HDR_CT_DEPENDENT_LIGHT_CALIBRATION_PROJECTIONS, /* CT X-ray detector offset, in mm (float) */ MDC_CONC_HDR_CT_XRAY_DETECTOR_OFFSET, /* CT detector transaxial position, in cm (float) */ MDC_CONC_HDR_CT_DETECTOR_TRANSAXIAL_POSITION, /* CT detector uncropped transaxial pixels (integer) */ MDC_CONC_HDR_CT_UNCROPPED_TRANSAXIAL_PIXELS, /* CT detector uncropped axial pixels (integer) */ MDC_CONC_HDR_CT_UNCROPPED_AXIAL_PIXELS, /* CT detector cropped transaxial pixels (integer) */ MDC_CONC_HDR_CT_CROPPED_TRANSAXIAL_PIXELS, /* CT detector cropped axial pixels (integer) */ MDC_CONC_HDR_CT_CROPPED_AXIAL_PIXELS, /* CT X-ray detector pitch, in um (float) */ MDC_CONC_HDR_CT_XRAY_DETECTOR_PITCH, /* CT horizontal rotation-axis-bed angle, in degrees (float) */ MDC_CONC_HDR_CT_HORIZ_ROT_AXIS_BED_ANGLE, /* CT vertical rotation-axis-bed angle, in degrees (float) */ MDC_CONC_HDR_CT_VERT_ROT_AXIS_BED_ANGLE, /* CT exposure time, in msecs (float) */ MDC_CONC_HDR_CT_EXPOSURE_TIME, /* CT total scan time, in min:sec (integer:integer) */ MDC_CONC_HDR_CT_SCAN_TIME, /* CT warping type (integer) 0 - Unknown warping type 1 - No warping 2 - Bilinear warping 3 - Nearest neighbor warping */ MDC_CONC_HDR_CT_WARPING, /* CT defect map filename, possibly including path (string) NOTE: Filename may contain spaces, therefore the ENTIRE line, up to the EOL, is used after the parameter name. */ MDC_CONC_HDR_CT_DEFECT_MAP_FILE_NAME, /* CT x-ray voltage, in kVp (float) */ MDC_CONC_HDR_CT_XRAY_VOLTAGE, /* CT anode current, in uA (float) */ MDC_CONC_HDR_CT_ANODE_CURRENT, /* Number of CT calibration exposures (integer) */ MDC_CONC_HDR_CT_CALIBRATION_EXPOSURES, /* CT cone angle, in degrees (float) */ MDC_CONC_HDR_CT_CONE_ANGLE, /* CT projection interpolation type (integer) 0 - Unknown projection interpolation type 1 - Bilinear projection interpolation 2 - Nearest neighbor projection interpolation */ MDC_CONC_HDR_CT_PROJECTION_INTERPOLATION, /* CT source to detector distance, in cm (float) */ MDC_CONC_HDR_CT_SOURCE_TO_DETECTOR, /* CT source to center of rotation, in cm (float) */ MDC_CONC_HDR_CT_SOURCE_TO_CROT, /* CT vetical detector offset, in pixels (float) */ MDC_CONC_HDR_CT_DETECTOR_VERTICAL_OFFSET, /* CT detector tilt relative to horizontal axis, in degrees (float) */ MDC_CONC_HDR_CT_DETECTOR_HORIZONTAL_TILT, /* CT detector tilt relative to vertical axis, in degrees (float) */ MDC_CONC_HDR_CT_DETECTOR_VERTICAL_TILT, /* CT axial projection bin factor, in pixels (integer) */ MDC_CONC_HDR_CT_TRANSAXIAL_BIN_FACTOR, /* CT axial projection bin factor, in pixels (integer) */ MDC_CONC_HDR_CT_AXIAL_BIN_FACTOR, /* CT gating signal used (integer) */ MDC_CONC_HDR_CT_GATING, /* CT Hounsfield scale (float) */ MDC_CONC_HDR_CT_HOUNSFIELD_SCALE, /* CT Hounsfield offset (float) */ MDC_CONC_HDR_CT_HOUNSFIELD_OFFSET, /* CT projection downsample factor (integer) */ MDC_CONC_HDR_CT_PROJ_DOWNSAMPLE_FACTOR, /* CT first projection used in reconstruction (integer) */ MDC_CONC_HDR_CT_FIRST_RECON_PROJ, /* CT last projection used in reconstruction (integer) */ MDC_CONC_HDR_CT_LAST_RECON_PROJ, /* CT every Nth projection used for reconstruction (integer) */ MDC_CONC_HDR_CT_RECON_EVERY_NTH_PROJ, /* CT attenuation of water, in cm^-1 (float) */ MDC_CONC_HDR_CT_ATTENUATION_WATER, /* CT TX rotation offsets: X Y Z, in mm (float) */ MDC_CONC_HDR_CT_TX_ROTATION_OFFSETS, /* CT TX transaxial offsets: X Y Z, in mm (float) */ MDC_CONC_HDR_CT_TX_TRANSAXIAL_OFFSETS, /* CT BH correction applied (int) 0 (FALSE) - CT BH correction has NOT been applied !0 (TRUE) - CT BH correction has been applied */ MDC_CONC_HDR_CT_BH_CORRECTION, /* CT aluminum filter thickness (mm) (float) */ MDC_CONC_HDR_CT_ALUMINUM_FILTER_THICKNESS, /* CT projection array (integer float) projection_number acquisition_position (degrees) */ MDC_CONC_HDR_PROJECTION, /* CT projection average center offset (float) */ MDC_CONC_HDR_CT_PROJECTION_AVERAGE_CENTER_OFFSET, /* CT projection average center offset array (integer float) projection_number average center offset (mm) */ MDC_CONC_HDR_CT_PROJECTION_CENTER_OFFSET, /* CT projection horizontal bed offset array (integer float) projection_number horizontal bed offset (mm) */ MDC_CONC_HDR_CT_PROJECTION_HORIZONTAL_BED_OFFSET, /* End of Header indicator */ MDC_CONC_HDR_END_OF_HEADER, MDC_CONC_NUM_HDR_VALUES, MDC_CONC_HDR_UNKNOWN, MDC_CONC_HDR_EOF } MdcConcHdrValue; /* what can appear in the bottom of the header */ typedef enum { /* Frame number (integer) */ MDC_CONC_BLOCK_FRAME, /* Detector panel - NOTE: "ring" systems are "0" ONLY (integer) */ MDC_CONC_BLOCK_DETECTOR_PANEL, /* Event type (integer) */ /* 0 - Unknown event type */ /* 1 - Singles */ /* 2 - Prompt events (coincidences) */ /* 3 - Delay events */ /* 4 - Trues (prompts - delays) */ /* 5 - Energy spectrum data */ MDC_CONC_BLOCK_EVENT_TYPE, /* Energy window - NOTE PET/CT systems are typically "0" only (integer) */ MDC_CONC_BLOCK_ENERGY_WINDOW, /* Gate number (integer) */ MDC_CONC_BLOCK_GATE, /* Bed number (integer) */ MDC_CONC_BLOCK_BED, /* Bed offset, in cm (float) */ MDC_CONC_BLOCK_BED_OFFSET, /* Ending horizontal bed offset, in cm (float) */ MDC_CONC_BLOCK_ENDING_BED_OFFSET, /* Number of bed passes during frame (integer) */ MDC_CONC_BLOCK_BED_PASSES, /* Vertical bed offset, in cm (float) */ MDC_CONC_BLOCK_VERTICAL_BED_OFFSET, /* Data file offset to start of data (2 longs) */ /* Values are: low_part */ /* or: high_part low_part */ MDC_CONC_BLOCK_DATA_FILE_POINTER, /* Frame start time, in secs (float) */ MDC_CONC_BLOCK_FRAME_START, /* Frame duration, in secs (float) */ MDC_CONC_BLOCK_FRAME_DURATION, /* Scale factor for data set (float) */ MDC_CONC_BLOCK_SCALE_FACTOR, /* Minimum value in data set (float) */ MDC_CONC_BLOCK_MINIMUM, /* Maximum value in data set (float) */ MDC_CONC_BLOCK_MAXIMUM, /* Deadtime correction for data set (float) */ /* NOTE: Scale factor INCLUDES this value. */ MDC_CONC_BLOCK_DEADTIME_CORRECTION, /* Global decay correction applied to data set (float) */ /* NOTE: Scale factor INCLUDES this value. */ MDC_CONC_BLOCK_DECAY_CORRECTION, /* Prompts count for data set (long) */ MDC_CONC_BLOCK_PROMPTS, /* Delays count for data set (long) */ MDC_CONC_BLOCK_DELAYS, /* Trues count for data set (long) */ MDC_CONC_BLOCK_TRUES, /* Prompts countrate per sec before histogramming (int) */ MDC_CONC_BLOCK_PROMPTS_RATE, /* Delays countrate per sec before histogramming (int) */ MDC_CONC_BLOCK_DELAYS_RATE, /* Singles rate array (integer float) */ /* block_number singles/sec */ MDC_CONC_BLOCK_SINGLES, /* End of Header indicator */ MDC_CONC_BLOCK_END_OF_HEADER, MDC_CONC_NUM_BLOCK_VALUES, MDC_CONC_BLOCK_UNKNOWN, MDC_CONC_BLOCK_EOF } MdcConcBlockValue; /**************************************************************************** F U N C T I O N S ****************************************************************************/ const char *MdcLoadPlaneCONC(FILEINFO *fi, int img); const char *MdcLoadHeaderCONC(FILEINFO *fi); const char *MdcLoadCONC(FILEINFO *fi); const char *MdcSavePlaneCONC(FILEINFO *fi, int img); const char *MdcSaveInitCONC(FILEINFO *fi, char *raw_filename); const char *MdcSaveHeaderCONC(FILEINFO *fi, char *raw_filename); const char *MdcSaveCONC(FILEINFO *fi); int MdcCheckCONC(FILEINFO *fi); const char *MdcReadCONC(FILEINFO *fi); const char *MdcWriteCONC(FILEINFO *fi); #endif xmedcon-0.14.1/source/ChangeLog0000644000175000017510000000000011152103415013205 00000000000000xmedcon-0.14.1/source/xpages.c0000644000175000017510000002647512636253502013131 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xpages.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : image pages routines * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcPagesSelected() - Handle selected page * * XMdcPagesGoTo() - Go to a specified page * * XMdcPagesCreateMenu() - Create pages menu * * XMdcPagesNext() - Go to next page * * XMdcPagesPrev() - Go to previous page * * XMdcPagesSelCallbackApply() - Apply new page display * * XMdcPagesSel() - Select page display * * XMdcPagesGetNrImages() - Get images per page * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xpages.c,v 1.29 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include #include "xmedcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ static GtkWidget *wpages=NULL; /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcPagesSelected(GtkWidget *widget, Uint32 *pagenr) { if ( (Uint32)(*pagenr) != my.curpage) { my.curpage = (Uint32)(*pagenr); MdcDebugPrint("one-based selected page = %u",my.curpage + 1); XMdcMainWidgetsInsensitive(); XMdcRemovePreviousColorMap(); XMdcRemovePreviousImages(); XMdcBuildColorMap(); XMdcBuildCurrentImages(); my.prevpage = my.curpage; XMdcMainWidgetsResensitive(); } } gboolean XMdcPagesGoTo(GtkWidget *spinner, gpointer data) { GtkWidget *menu; GtkWidget *active; GtkSpinButton *spin = GTK_SPIN_BUTTON(spinner); Uint32 page, newpage; page = (Uint32) gtk_spin_button_get_value_as_int(spin); newpage = page - 1; if ( page == 0 || page > my.number_of_pages ) { XMdcDisplayWarn("Need a number between [1 , %u]",my.number_of_pages); }else{ gtk_option_menu_set_history(GTK_OPTION_MENU(my.pagemenu),newpage); menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(my.pagemenu)); gtk_menu_set_active(GTK_MENU(menu),newpage); active = gtk_menu_get_active(GTK_MENU(menu)); gtk_menu_item_activate(GTK_MENU_ITEM(active)); } return(TRUE); } GtkWidget *XMdcPagesCreateMenu(void) { GtkWidget *menu; GtkWidget *menuitem; GSList *group; Uint32 i; menu = gtk_menu_new(); group= NULL; for(i=0; i 0) { prevpage = my.curpage - 1; gtk_option_menu_set_history(GTK_OPTION_MENU(my.pagemenu),prevpage); menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(my.pagemenu)); gtk_menu_set_active(GTK_MENU(menu),prevpage); active = gtk_menu_get_active(GTK_MENU(menu)); gtk_menu_item_activate(GTK_MENU_ITEM(active)); } } void XMdcPagesSelCallbackApply(GtkWidget *widget, gpointer data) { Int8 type=XMDC_PAGES_FRAME_BY_FRAME; MdcDebugPrint("pages layout: "); if (GTK_TOGGLE_BUTTON(sPagesSelection.FrameByFrame)->active) { MdcDebugPrint("\tper frame"); type = XMDC_PAGES_FRAME_BY_FRAME; }else if (GTK_TOGGLE_BUTTON(sPagesSelection.SliceBySlice)->active) { MdcDebugPrint("\tper slice"); type = XMDC_PAGES_SLICE_BY_SLICE; }else if (GTK_TOGGLE_BUTTON(sPagesSelection.ScreenFull)->active) { MdcDebugPrint("\tscreen full"); type = XMDC_PAGES_SCREEN_FULL; } if (type != sPagesSelection.CurType) { sPagesSelection.CurType = type; if (XMDC_FILE_OPEN == MDC_YES) { /* prevent useless reprocessing */ if (my.fi->number == 1) return; XMdcProgressBar(MDC_PROGRESS_BEGIN,0.,"Redisplay images:"); XMdcViewerHide(); XMdcViewerEnableAutoShrink(); XMdcViewerReset(); XMdcDisplayImages(); XMdcProgressBar(MDC_PROGRESS_END,0.,NULL); } } } void XMdcPagesSel(void) { GtkWidget *box1; GtkWidget *box2; GtkWidget *box3; GtkWidget *box4; GtkWidget *frame; GtkWidget *button; GtkWidget *separator; GSList *group; if (wpages == NULL) { wpages = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_signal_connect(GTK_OBJECT(wpages),"destroy", GTK_SIGNAL_FUNC(XMdcMedconQuit),NULL); gtk_signal_connect(GTK_OBJECT(wpages),"delete_event", GTK_SIGNAL_FUNC(XMdcHandlerToHide),NULL); gtk_window_set_title(GTK_WINDOW(wpages),"Pages Selection"); gtk_container_set_border_width (GTK_CONTAINER (wpages), 0); box1 = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (wpages), box1); gtk_widget_show(box1); /* create upper box - Initial Resize */ box2 = gtk_vbox_new (FALSE, 5); gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER(box2), 5); gtk_widget_show(box2); box3 = gtk_hbox_new (FALSE, 5); gtk_box_pack_start(GTK_BOX(box2), box3, TRUE, TRUE, 0); gtk_widget_show(box3); frame = gtk_frame_new("Display Pages"); gtk_box_pack_start(GTK_BOX (box3), frame, TRUE, TRUE, 0); gtk_widget_show(frame); box4 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), box4); gtk_container_set_border_width(GTK_CONTAINER(box4), 5); gtk_widget_show(box4); button = gtk_radio_button_new_with_label(NULL, "frame by frame (volume)"); gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0); if (sPagesSelection.CurType == XMDC_PAGES_FRAME_BY_FRAME); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sPagesSelection.FrameByFrame = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group, "slice by slice (image)"); gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0); if (sPagesSelection.CurType == XMDC_PAGES_SLICE_BY_SLICE) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sPagesSelection.SliceBySlice = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group, "whole screen filled"); gtk_box_pack_start (GTK_BOX(box4), button, TRUE, TRUE, 0); if (sPagesSelection.CurType == XMDC_PAGES_SCREEN_FULL) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sPagesSelection.ScreenFull = button; /* create horizontal separator */ separator = gtk_hseparator_new (); gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, FALSE, 0); gtk_widget_show (separator); /* create bottom button box */ box2 = gtk_hbox_new (FALSE, 0); gtk_box_pack_start(GTK_BOX(box1), box2, TRUE, TRUE, 2); gtk_widget_show(box2); button = gtk_button_new_with_label("Apply"); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 2); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(wpages)); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcPagesSelCallbackApply), NULL); gtk_widget_show(button); button = gtk_button_new_with_label ("Cancel"); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 2); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide),GTK_OBJECT(wpages)); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcViewerShow), NULL); gtk_widget_show(button); }else{ /* set buttons to appropriate state */ GtkWidget *b1, *b2, *b3; gtk_widget_hide(wpages); b1 = sPagesSelection.FrameByFrame; b2 = sPagesSelection.SliceBySlice; b3 = sPagesSelection.ScreenFull; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3),FALSE); switch (sPagesSelection.CurType) { case XMDC_PAGES_FRAME_BY_FRAME : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),TRUE); break; case XMDC_PAGES_SLICE_BY_SLICE : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),TRUE); break; case XMDC_PAGES_SCREEN_FULL : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3),TRUE); break; } } XMdcShowWidget(wpages); } Uint32 XMdcPagesGetNrImages(void) { Uint32 nr=0; switch (sPagesSelection.CurType) { case XMDC_PAGES_FRAME_BY_FRAME: nr = my.fi->dim[3]; break; case XMDC_PAGES_SLICE_BY_SLICE: nr = 1; break; case XMDC_PAGES_SCREEN_FULL : nr = my.fi->number; break; } return(nr); } xmedcon-0.14.1/source/m-progress.c0000644000175000017510000000555712636253502013736 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-progress.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : pointer hooks for progress functions * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcSetProgress() - Set progress value * * MdcIncrProgress() - Increment progress value * * MdcBeginProgress() - Begin of progress * * MdcEndProgress() - End of progress * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-progress.c,v 1.13 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include #include "m-defs.h" #include "m-error.h" #include "m-progress.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MDC_PROGRESS = MDC_NO; static void MdcProgressBar(int type, float value, char *label) { switch (type) { case MDC_PROGRESS_BEGIN: if (label != NULL) MdcPrntScrn("\n%35s ",label); break; case MDC_PROGRESS_SET : MdcPrntScrn("."); break; case MDC_PROGRESS_INCR : MdcPrntScrn("."); break; case MDC_PROGRESS_END : MdcPrntScrn("\n"); break; } } void (*MdcProgress)(int type, float value, char *label) = MdcProgressBar; xmedcon-0.14.1/source/m-xtract.h0000644000175000017510000000451412636253502013374 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-xtract.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-xtract.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-xtract.h,v 1.18 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_XTRACT_H__ #define __M_XTRACT_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ typedef struct MdcExtractInputStruct_t { char list[MDC_MAX_LIST+1]; int INTERACTIVE; Int32 style; Uint32 *inrs; Uint32 num_p, num_f, num_g, num_b; }MdcExtractInputStruct; extern MdcExtractInputStruct mdcextractinput; /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcGetImagesToExtract(FILEINFO *fi, MdcExtractInputStruct *input); char *MdcExtractImages(FILEINFO *fi); #endif xmedcon-0.14.1/source/m-getopt.h0000644000175000017510000000403112636253502013363 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-getopt.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-getopt.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-getopt.h,v 1.21 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_GETOPT_H__ #define __M_GETOPT_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void MdcPrintGlobalOptions(void); void MdcPrintLocalOptions(void); void MdcPrintShortInfo(void); void MdcPrintUsage(char *pgrname); int MdcHandleArgs(FILEINFO *fi, int argc, char *argv[], int MAXFILES); char *MdcApplyReadOptions(FILEINFO *fi); #endif xmedcon-0.14.1/source/m-raw.c0000644000175000017510000005137612636253502012663 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-raw.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : read (interactive) and write raw images * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcReadRAW() - Read raw images interactive * * MdcWriteRAW() - Write raw images to file * * MdcInitRawPrevInput() - Initialize previous inputs * * MdcGetRawInput() - Get raw image layout from user * * MdcUsePrevRawInput() - Use previus raw layout settings * * MdcAskRawInput() - Ask raw layout from user * * MdcReadPredef() - Read predefined RAW settings * * MdcWritePredef() - Write predefined RAW settings * * * * Notes : Reading is an interactive process to determine * * the headersize to skip and the pixel data type * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-raw.c,v 1.56 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "medcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_PREDEFSIG "# RPI v0.1" /* predef signature */ MdcRawInputStruct mdcrawinput; MdcRawPrevInputStruct mdcrawprevinput; /**************************************************************************** F U N C T I O N S ****************************************************************************/ void MdcInitRawPrevInput(void) { MdcRawPrevInputStruct *prev = &mdcrawprevinput; prev->XDIM=0; prev->YDIM=0; prev->NRIMGS=1; prev->GENHDR=0; prev->IMGHDR=0; prev->ABSHDR=0; prev->PTYPE = BIT16_S; prev->DIFF = MDC_NO; prev->HDRREP = MDC_NO; prev->PSWAP = MDC_NO; prev->REDO = MDC_YES; /* required for first time to ask parameters */ } char *MdcGetRawInput(FILEINFO *fi) { MdcRawPrevInputStruct *prev = &mdcrawprevinput; char *msg; if (XMDC_GUI == MDC_YES) return(NULL); /* procedure not used in GUI */ if (prev->REDO == MDC_NO) { msg = MdcUsePrevRawInput(fi); }else{ msg = MdcAskRawInput(fi); } return(msg); } char *MdcUsePrevRawInput(FILEINFO *fi) { MdcRawPrevInputStruct *prev = &mdcrawprevinput; IMG_DATA *id=NULL; Uint32 i; /* use previous settings */ if (!MdcGetStructID(fi,prev->NRIMGS)) return("RAW Bad malloc IMG_DATA structs from previous settings."); /* prepare FILEINFO structure */ for (i=0; inumber; i++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); id = &fi->image[i]; id->width = prev->XDIM; id->height = prev->YDIM; id->type = prev->PTYPE; id->bits = MdcType2Bits(id->type); } if (prev->PSWAP == MDC_YES) { MDC_FILE_ENDIAN = !MDC_HOST_ENDIAN; }else{ MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; } fi->endian = MDC_FILE_ENDIAN; fi->dim[0] = 3; fi->dim[3] = fi->number; return(NULL); } char *MdcAskRawInput(FILEINFO *fi) { MdcRawInputStruct *input = &mdcrawinput; MdcRawPrevInputStruct *prev = &mdcrawprevinput; IMG_DATA *id=NULL; Uint32 i, number; /* init input entries */ input->gen_offset=0; input->img_offset=0; input->REPEAT=MDC_NO; input->DIFF=MDC_NO; input->REDO=MDC_NO; MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("\tINTERACTIVE PROCEDURE\n"); MdcPrintLine('-',MDC_FULL_LENGTH); number = prev->NRIMGS; MdcPrntScrn("\n\tFilename: %s\n\n",fi->ifname); MdcPrntScrn("\tNumber of images [%u]? ",number); if (!MdcPutDefault(mdcbufr)) number = (Uint32)atol(mdcbufr); prev->NRIMGS=number; if (number == 0) return("RAW No images specified"); if (!MdcGetStructID(fi,number)) return("RAW Bad malloc IMG_DATA structs"); MdcPrntScrn("\tGeneral header offset to binary data [%u bytes]? " ,prev->GENHDR); if (MdcPutDefault(mdcbufr)) input->gen_offset = prev->GENHDR; else{ input->gen_offset = (Uint32)atol(mdcbufr); prev->GENHDR = input->gen_offset; } MdcPrntScrn("\tImage header offset to binary data [%u bytes]? " ,prev->IMGHDR); if (MdcPutDefault(mdcbufr)) input->img_offset = prev->IMGHDR; else{ input->img_offset = (Uint32)atol(mdcbufr); prev->IMGHDR = input->img_offset; } MdcPrntScrn("\tImage header repeated before each image "); sprintf(mdcbufr,"%s",MdcGetStrYesNo(prev->HDRREP)); MdcPrntScrn("[%s]? ",mdcbufr); if (!MdcPutDefault(mdcbufr)) { if (mdcbufr[0]=='y' || mdcbufr[0]=='Y') { input->REPEAT = MDC_YES; prev->HDRREP = MDC_YES; }else{ input->REPEAT = MDC_NO; prev->HDRREP = MDC_NO; } }else{ input->REPEAT = prev->HDRREP; } MdcPrntScrn("\tSwap the pixel bytes "); sprintf(mdcbufr,"%s",MdcGetStrYesNo(prev->PSWAP)); MdcPrntScrn("[%s]? ",mdcbufr); if (!MdcPutDefault(mdcbufr)) { if (mdcbufr[0]=='y' || mdcbufr[0]=='Y') { MDC_FILE_ENDIAN = !MDC_HOST_ENDIAN; prev->PSWAP = MDC_YES; }else{ MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; prev->PSWAP = MDC_NO; } }else{ if (prev->PSWAP == MDC_YES) { MDC_FILE_ENDIAN = !MDC_HOST_ENDIAN; }else{ MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; } } MdcPrntScrn("\tSame characteristics for all images "); sprintf(mdcbufr,"%s",MdcGetStrYesNo(!prev->DIFF)); MdcPrntScrn("[%s]? ",mdcbufr); if (!MdcPutDefault(mdcbufr)) { if (mdcbufr[0]=='n' || mdcbufr[0]=='N') { input->DIFF=MDC_YES; prev->DIFF = MDC_YES; }else{ input->DIFF=MDC_NO; prev->DIFF = MDC_NO; } }else{ input->DIFF = prev->DIFF; } for (i=0; inumber; i++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); id = &fi->image[i]; if (input->DIFF) { MdcPrntScrn("\n\tIMAGE #%03u\n",i+1); MdcPrntScrn("\t----------\n"); }else if (i==0) { MdcPrntScrn("\n\tALL IMAGES\n"); MdcPrntScrn("\t----------\n"); } /* put default */ if (i==0) id->type = prev->PTYPE; if (input->DIFF || (!input->DIFF && i==0)) { MdcPrntScrn("\tAbsolute offset in bytes [%u]? ",prev->ABSHDR); if (MdcPutDefault(mdcbufr)) id->load_location = prev->ABSHDR; else{ id->load_location = (size_t) atol(mdcbufr); prev->ABSHDR = id->load_location; } MdcPrntScrn("\tImage columns [%u]? ",prev->XDIM); if (MdcPutDefault(mdcbufr)) id->width = prev->XDIM; else{ id->width = (Uint32)atol(mdcbufr); prev->XDIM = id->width; } if (id->width == 0) return("RAW No width specified"); MdcPrntScrn("\tImage rows [%u]? ",prev->YDIM); if (MdcPutDefault(mdcbufr)) id->height = prev->YDIM; else{ id->height = (Uint32)atol(mdcbufr); prev->YDIM = id->height; } if (id->height == 0) return("RAW No height specified"); MdcPrntScrn("\tPixel data type:\n\n"); MdcPrntScrn("\t\t %2d -> bit\n",BIT1); MdcPrntScrn("\t\t %2d -> Int8 \t\t %2d -> Uint8\n",BIT8_S,BIT8_U); MdcPrntScrn("\t\t %2d -> Int16\t\t %2d -> Uint16\n",BIT16_S,BIT16_U); MdcPrntScrn("\t\t %2d -> Int32\t\t %2d -> Uint32\n",BIT32_S,BIT32_U); #ifdef HAVE_8BYTE_INT MdcPrntScrn("\t\t %2d -> Int64\t\t %2d -> Uint64\n",BIT64_S,BIT64_U); #endif MdcPrntScrn("\t\t %2d -> float\t\t %2d -> double\n",FLT32,FLT64); MdcPrntScrn("\t\t %2d -> ascii\n",ASCII); MdcPrntScrn("\t\t %2d -> RGB\n\n",COLRGB); MdcPrntScrn("\tYour choice [%hu]? ", prev->PTYPE); if (MdcPutDefault(mdcbufr)) id->type = prev->PTYPE; else{ id->type = (Int16)atoi(mdcbufr); prev->PTYPE = id->type; } MdcPrntScrn("\n"); }else{ id->width = prev->XDIM; id->height = prev->YDIM; id->type = prev->PTYPE; id->load_location = prev->ABSHDR; } switch (id->type) { case BIT1 : case BIT8_S : case BIT8_U : case BIT16_S: case BIT16_U: case BIT32_S: case BIT32_U: #ifdef HAVE_8BYTE_INT case BIT64_S: case BIT64_U: #endif case FLT32 : case FLT64 : case ASCII : case COLRGB : id->bits = MdcType2Bits(id->type); break; default : return("RAW Unsupported data type"); } } fi->endian = MDC_FILE_ENDIAN; fi->dim[0] = 3; fi->dim[3] = fi->number; MdcPrintImageLayout(fi,input->gen_offset,input->img_offset,input->REPEAT); MdcPrntScrn("\n\tRedo input for next file "); sprintf(mdcbufr,"%s",MdcGetStrYesNo(prev->REDO)); MdcPrntScrn("[%s]? ",mdcbufr); if (!MdcPutDefault(mdcbufr)) { if (mdcbufr[0]=='y' || mdcbufr[0]=='Y') { input->REDO=MDC_YES; prev->REDO=MDC_YES; }else{ input->REDO=MDC_NO; prev->REDO=MDC_NO; } }else{ if (prev->REDO == MDC_YES) { input->REDO=MDC_YES; prev->REDO=MDC_YES; }else{ input->REDO=MDC_NO; prev->REDO=MDC_NO; } } return(NULL); } /* read raw images */ char *MdcReadRAW(FILEINFO *fi) { MdcRawInputStruct *input = &mdcrawinput; IMG_DATA *id=NULL; Uint32 i, p, bytes; double *pix=NULL; char *err=NULL; int r; if (MDC_FILE_STDIN == MDC_YES) return("RAW File read from stdin not possible"); if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Reading RAW:"); /* put some defaults we use */ fi->map = MDC_MAP_GRAY; /* get raw input parameters required to read binary images */ err=MdcGetRawInput(fi); if (err != NULL) return(err); if (MDC_VERBOSE) MdcPrntMesg("RAW Reading <%s> ...",fi->ifname); fseek(fi->ifp,(signed)input->gen_offset,SEEK_SET); /* read the images */ for (i = 0; inumber; i++) { id = &fi->image[i]; if ( i==0 || input->REPEAT) fseek(fi->ifp,(signed)input->img_offset,SEEK_CUR); if (id->load_location != 0) fseek(fi->ifp,id->load_location,SEEK_SET); bytes = id->width * id->height * MdcType2Bytes(id->type); id->buf = MdcGetImgBuffer(bytes); if (id->buf == NULL) { return("RAW Bad malloc image buffer"); } if (id->type == ASCII) { pix = (double *)id->buf; for (p=0; p < (id->width * id->height); p++) { r = fscanf(fi->ifp,"%le",&pix[p]); if (r != 1) { err=MdcHandleTruncated(fi,i+1,MDC_YES); if (err != NULL) { return(err); } break; } } id->type = FLT64; /* read ascii as double */ }else{ if (fread(id->buf,1,bytes,fi->ifp) != bytes) { err=MdcHandleTruncated(fi,i+1,MDC_YES); if (err != NULL) { return(err); } } } if (id->type == BIT1) { MdcMakeBIT8_U(id->buf, fi, i); id->type = BIT8_U; id->bits = MdcType2Bits(id->type); if (i==0) { fi->type = id->type; fi->bits = id->bits; } } if (id->type == COLRGB) fi->map = MDC_MAP_PRESENT; /* color */ if (fi->truncated) break; } MdcCloseFile(fi->ifp); if (fi->truncated) return("RAW Truncated image file"); return NULL; } char *MdcWriteRAW(FILEINFO *fi) { IMG_DATA *id; Uint32 size, i, p, bytes; Uint8 *new_buf=NULL, *pbuf=NULL; MDC_FILE_ENDIAN = MDC_WRITE_ENDIAN; /* print fileinfo to stderr */ if (MDC_FILE_STDOUT == MDC_YES) MdcPrintFI(fi); switch (fi->rawconv) { case MDC_FRMT_RAW: if (XMDC_GUI == MDC_NO) MdcDefaultName(fi,MDC_FRMT_RAW,fi->ofname,fi->ifname); break; case MDC_FRMT_ASCII: if (XMDC_GUI == MDC_NO) MdcDefaultName(fi,MDC_FRMT_ASCII,fi->ofname,fi->ifname); break; default: return("Internal ## Improper `fi->rawconv' value"); } if (MDC_PROGRESS) { switch (fi->rawconv) { case MDC_FRMT_RAW : MdcProgress(MDC_PROGRESS_BEGIN,0.,"Writing RAW:"); break; case MDC_FRMT_ASCII: MdcProgress(MDC_PROGRESS_BEGIN,0.,"Writing ASCII:"); break; } } if (MDC_VERBOSE) MdcPrntMesg("RAW Writing <%s> ...",fi->ofname); /* indexed color no use without colormap */ if ((fi->map == MDC_MAP_PRESENT) && (fi->type != COLRGB)) return("RAW Indexed colored files unsupported"); if (MDC_FILE_STDOUT == MDC_YES) { fi->ofp = stdout; }else{ if (MdcKeepFile(fi->ofname)) return("RAW File exists!!"); if ( (fi->ofp=fopen(fi->ofname,"wb")) == NULL ) return("RAW Couldn't open file"); } /* check some supported things */ if (fi->type != COLRGB) { if (MDC_FORCE_INT != MDC_NO) { /* Sorry, no message. The user should know ... */ }else if (MDC_QUANTIFY || MDC_CALIBRATE) { if (fi->rawconv == MDC_FRMT_RAW) { MdcPrntWarn("RAW Quantification to `float' type"); } } } for (i=0; inumber; i++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); id = &fi->image[i]; size = id->width * id->height; if (id->type == COLRGB) { /* rgb */ bytes = MdcType2Bytes(id->type); if (fwrite(id->buf,bytes,size,fi->ofp) != size) { return("RAW Bad write RGB image"); } }else if (MDC_FORCE_INT != MDC_NO) { /* int */ switch (MDC_FORCE_INT) { case BIT8_U : new_buf=MdcGetImgBIT8_U(fi,i); if (new_buf == NULL) return("RAW Bad malloc Uint8 buffer"); break; case BIT16_S: new_buf=MdcGetImgBIT16_S(fi,i); if (new_buf == NULL) return("RAW Bad malloc Int16 buffer"); break; default: new_buf=MdcGetImgBIT16_S(fi,i); if (new_buf == NULL) return("RAW Bad malloc Int16 buffer"); } bytes = MdcType2Bytes(MDC_FORCE_INT); switch (fi->rawconv) { case MDC_FRMT_RAW: if (MDC_FILE_ENDIAN != MDC_HOST_ENDIAN) MdcMakeImgSwapped(new_buf,fi,i,id->width,id->height,MDC_FORCE_INT); if (fwrite(new_buf,bytes,size,fi->ofp) != size) { MdcFree(new_buf); return("RAW Bad write integer image"); } break; case MDC_FRMT_ASCII: for (pbuf=new_buf, p=0; p < size; p++, pbuf+=bytes) { MdcPrintValue(fi->ofp,pbuf,MDC_FORCE_INT); fprintf(fi->ofp," "); if ( ((p+1) % id->width) == 0 ) fprintf(fi->ofp,MDC_NEWLINE); } fprintf(fi->ofp,MDC_NEWLINE); break; } }else if (MDC_QUANTIFY || MDC_CALIBRATE) { new_buf=MdcGetImgFLT32(fi,i); if (new_buf == NULL) return("RAW Quantification failed!"); bytes = MdcType2Bytes(FLT32); switch (fi->rawconv) { case MDC_FRMT_RAW: if (MDC_FILE_ENDIAN != MDC_HOST_ENDIAN) MdcMakeImgSwapped(new_buf,fi,i,id->width,id->height,FLT32); if (fwrite(new_buf,bytes,size,fi->ofp) != size) { MdcFree(new_buf); return("RAW Bad write quantified image"); } break; case MDC_FRMT_ASCII: for (pbuf = new_buf, p=0; p < size; p++, pbuf+=bytes) { MdcPrintValue(fi->ofp,pbuf,FLT32); fprintf(fi->ofp," "); if ( ((p+1) % id->width) == 0 ) fprintf(fi->ofp,MDC_NEWLINE); } fprintf(fi->ofp,MDC_NEWLINE); break; } }else{ /* same pixel type */ bytes = MdcType2Bytes(id->type); switch (fi->rawconv) { case MDC_FRMT_RAW: if (MDC_FILE_ENDIAN != MDC_HOST_ENDIAN) { new_buf = MdcGetImgSwapped(fi,i); if (fwrite(new_buf,bytes,size,fi->ofp) != size) { MdcFree(new_buf); return("RAW Bad write swapped image"); } }else if (fwrite(id->buf,bytes,size,fi->ofp) != size) { return("RAW Bad write original image "); } break; case MDC_FRMT_ASCII: for (pbuf=id->buf, p=0; p < size; p++, pbuf+=bytes) { MdcPrintValue(fi->ofp,pbuf,id->type); fprintf(fi->ofp," "); if ( ((p+1) % id->width) == 0 ) fprintf(fi->ofp,MDC_NEWLINE); } fprintf(fi->ofp,MDC_NEWLINE); break; } } MdcFree(new_buf); /* free when allocated */ } MdcCloseFile(fi->ofp); return NULL; } int MdcCheckPredef(const char *fname) { FILE *fp; char sig[10]; int r; if ((fp = fopen(fname,"rb")) == NULL) return(MDC_NO); r = fread(sig,1,10,fp); MdcCloseFile(fp); if (r != 10) return(MDC_NO); if ( memcmp(sig,MDC_PREDEFSIG,10) ) return(MDC_NO); return(MDC_YES); } char *MdcReadPredef(const char *fname) { MdcRawPrevInputStruct *prev = &mdcrawprevinput; FILE *fp; prev->DIFF = MDC_NO; prev->PSWAP = MDC_NO; prev->HDRREP = MDC_NO; if ((fp = fopen(fname,"rb")) == NULL) { return("Couldn't open raw predef input file"); }else{ MdcGetStrLine(mdcbufr,80,fp); prev->NRIMGS=(Uint32)atoi(mdcbufr); MdcGetStrLine(mdcbufr,80,fp); prev->GENHDR=(Uint32)atoi(mdcbufr); MdcGetStrLine(mdcbufr,80,fp); prev->IMGHDR=(Uint32)atoi(mdcbufr); MdcGetStrLine(mdcbufr,80,fp); if (mdcbufr[0] == 'y') prev->HDRREP = MDC_YES; MdcGetStrLine(mdcbufr,80,fp); if (mdcbufr[0] == 'y') prev->PSWAP = MDC_YES; MdcGetStrLine(mdcbufr,80,fp); if (mdcbufr[0] == 'y') { } /*no DIFF allowed*/ MdcGetStrLine(mdcbufr,80,fp); prev->ABSHDR=(Uint32)atoi(mdcbufr); MdcGetStrLine(mdcbufr,80,fp); prev->XDIM=(Uint32)atoi(mdcbufr); MdcGetStrLine(mdcbufr,80,fp); prev->YDIM=(Uint32)atoi(mdcbufr); MdcGetStrLine(mdcbufr,80,fp); prev->PTYPE=(Int16)atoi(mdcbufr); /* MdcGetStrLine(mdcbufr,80,fp); */ /* redo for next file */ } if (ferror(fp)) { MdcCloseFile(fp); return("Error reading raw predef input file"); } MdcCloseFile(fp); return(NULL); } /* write predefined RAW settings, suitable */ /* as input for interactive read */ char *MdcWritePredef(const char *fname) { FILE *fp; MdcRawPrevInputStruct *prev = &mdcrawprevinput; if (MdcKeepFile(fname)) return("Raw predef input file already exists!!"); if ((fp = fopen(fname,"w")) == NULL) { return("Couldn't open writeable raw predef input file"); }else{ fprintf(fp,"%s - BEGIN #\n#\n",MDC_PREDEFSIG); /* MDC_PREDEFSIG - BEGIN */ fprintf(fp,"# Total number of images?\n%u\n",prev->NRIMGS); fprintf(fp,"# General header offset (bytes)?\n%u\n",prev->GENHDR); fprintf(fp,"# Image header offset (bytes)?\n%u\n",prev->IMGHDR); fprintf(fp,"# Repeated image header?\n"); if (prev->HDRREP == MDC_YES) { fprintf(fp,"yes\n"); }else{ fprintf(fp,"no\n"); } fprintf(fp,"# Swap pixel bytes?\n"); if (prev->PSWAP == MDC_YES) { fprintf(fp,"yes\n"); }else{ fprintf(fp,"no\n"); } fprintf(fp,"# Identical images?\nyes\n"); fprintf(fp,"# Absolute offset in bytes?\n%u\n",prev->ABSHDR); fprintf(fp,"# Image columns?\n%u\n",prev->XDIM); fprintf(fp,"# Image rows?\n%u\n",prev->YDIM); fprintf(fp,"# Pixel data type?\n%hu\n",prev->PTYPE); fprintf(fp,"# Redo input for next file?\nno\n"); fprintf(fp,"#\n%s - END #\n",MDC_PREDEFSIG); } if (ferror(fp)) { MdcCloseFile(fp); return("Failure to write raw predef input file"); } MdcCloseFile(fp); return(NULL); } xmedcon-0.14.1/source/m-files.c0000644000175000017510000016605712636253502013177 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-files.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : Files edit, file I/O, image buffers * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcOpenFile() - Open file * * MdcReadFile() - Read file * * MdcWriteFile() - Write file * * MdcLoadFile() - Load file * * MdcSaveFile() - Save file * * MdcLoadPlane() - Load one plane * * MdcSavePlane() - Save one plane * * MdcDecompressFile() - Decompress file * * MdcStringCopy() - Copy a string * * MdcFileSize() - Get the size of a file * * MdcFileExists() - Check if file exists * * MdcKeepFile() - Prevent overwrite existing file * * MdcGetFrmt() - Get format of imagefile * * MdcGetImgBuffer() - Malloc a buffer * * MdcHandleTruncated() - Reset FILEINFO for truncated file* * MdcWriteLine() - Write image line * * MdcWriteDoublePixel() - Write single pixel double input * * MdcGetFname() - Get filename * * MdcSetExt() - Set filename extension * * MdcNewExt() - Create filename extension * * MdcPrefix() - Create filename prefix * * MdcGetPrefixNr() - Get proper filename prefix * * MdcGetLastPathDelim() - Get pointer last path delimiter * * MdcMySplitPath() - Split path from filename * * MdcMyMergePath() - Merge path to filename * * MdcNewName() - Create new filename * * MdcAliasName() - Create alias name based on ID's * * MdcEchoAliasName() - Echo alias name based on ID's * * MdcDefaultName() - Create new filename for format * * MdcRenameFile() - Let user give a new name * * MdcFillImgPos() - Fill the image_pos(_dev/_pat) * * MdcFillImgOrient() - Fill the image_orient(_dev/_pat) * * MdcGetOrthogonalInt() - Get orthogonal direction cosine * * MdcGetPatSliceOrient()- Get patient_slice_orient * * MdcTryPatSliceOrient()- Try to get it from pat_orient * * MdcCheckQuantitation()- Check quantitation preservation * * MdcGetHeartRate() - Get heart rate from gated data * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-files.c,v 1.118 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #ifdef HAVE_UNISTD_H #include #endif #include "medcon.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcOpenFile(FILEINFO *fi, const char *path) { int ctype; if (MDC_FILE_STDIN == MDC_NO) { if ( (ctype = MdcWhichCompression(path)) != MDC_NO ) { if ((MdcDecompressFile(path)) != MDC_OK) { MdcPrntWarn("Decompression failed"); /* no longer quit, because NIFTI */ /* can read .gz files directly */ /* return(MDC_BAD_OPEN); */ /* prevent unwanted unlink later */ ctype = MDC_NO; } } }else{ ctype = MDC_NO; } MdcInitFI(fi, path); fi->compression = (Int8)ctype; if (MDC_FILE_STDIN == MDC_NO) { if ( (fi->ifp=fopen(fi->ipath,"rb")) == NULL) { MdcPrntWarn("Couldn't open <%s> for reading",fi->ipath); return(MDC_BAD_OPEN); } }else{ fi->ifp = stdin; strcpy(fi->ipath,"stdin"); } if (ctype != MDC_NO) unlink(path); MdcSplitPath(fi->ipath,fi->idir,fi->ifname); return(MDC_OK); } int MdcReadFile(FILEINFO *fi, int filenr, char *(*ReadFunc)(FILEINFO *fi)) { int FORMAT=MDC_FRMT_NONE; const char *msg=NULL; if (ReadFunc == NULL) { /* get the format or fallback */ if ( (FORMAT=MdcGetFrmt(fi) ) == MDC_FRMT_NONE ) { MdcCloseFile(fi->ifp); MdcPrntWarn("Unsupported format in <%s>",fi->ifname); return(MDC_BAD_CODE); }else if (FORMAT < 0) { MdcCloseFile(fi->ifp); MdcPrntWarn("Unsuccessful read from <%s>",fi->ifname); return(MDC_BAD_READ); } } /* print a header message */ if (MDC_INFO && !MDC_INTERACTIVE) { MdcPrntScrn("\n"); MdcPrintLine('*',MDC_FULL_LENGTH); MdcPrntScrn("FILE %03d : %s\t\t\t",filenr,fi->ifname); MdcPrntScrn("FORMAT: %s\n",FrmtString[fi->iformat]); MdcPrintLine('*',MDC_FULL_LENGTH); MdcPrntScrn("\n"); } /* read the appropriate format */ switch (FORMAT) { case MDC_FRMT_RAW: msg=MdcReadRAW(fi); break; #if MDC_INCLUDE_ACR case MDC_FRMT_ACR: msg=MdcReadACR(fi); break; #endif #if MDC_INCLUDE_GIF case MDC_FRMT_GIF: msg=MdcReadGIF(fi); break; #endif #if MDC_INCLUDE_INW case MDC_FRMT_INW: msg=MdcReadINW(fi); break; #endif #if MDC_INCLUDE_ECAT case MDC_FRMT_ECAT6: msg=MdcReadECAT6(fi); break; case MDC_FRMT_ECAT7: msg=MdcReadECAT7(fi); break; #endif #if MDC_INCLUDE_INTF case MDC_FRMT_INTF: msg=MdcReadINTF(fi); break; #endif #if MDC_INCLUDE_ANLZ case MDC_FRMT_ANLZ: msg=MdcReadANLZ(fi); break; #endif #if MDC_INCLUDE_DICM case MDC_FRMT_DICM: msg=MdcReadDICM(fi); break; #endif #if MDC_INCLUDE_PNG case MDC_FRMT_PNG: msg=MdcReadPNG(fi); break; #endif #if MDC_INCLUDE_CONC case MDC_FRMT_CONC: msg=MdcReadCONC(fi); break; #endif #if MDC_INCLUDE_NIFTI case MDC_FRMT_NIFTI: msg=MdcReadNIFTI(fi); break; #endif default: if (ReadFunc != NULL) { msg = ReadFunc(fi); }else{ MdcPrntWarn("Reading: Unsupported format"); return(MDC_BAD_FILE); } } /* read error handling */ if (msg != NULL) { MdcPrntWarn("Reading: %s",msg); if (strstr(msg,"Truncated image") == NULL) { MdcCleanUpFI(fi); return(MDC_BAD_READ); }else{ MdcCloseFile(fi->ifp); } } /* database info | dangerous: not all image info read */ if (MDC_INFO_DB == MDC_YES) return(MDC_OK); /* echo alias, quickly leave */ if (MDC_ECHO_ALIAS == MDC_YES) return(MDC_OK); /* set the proper color map */ if (fi->map == MDC_MAP_GRAY) { /* gray scale images, set selected colormap */ if (MDC_COLOR_MAP < MDC_MAP_GRAY) MDC_COLOR_MAP = MDC_MAP_GRAY; fi->map = MDC_COLOR_MAP; }else{ /* colored images, preserve map */ fi->map = (Uint8)MdcSetPresentMap(fi->palette); } /* get the proper color map */ MdcGetColorMap((int)fi->map,fi->palette); /* the obligated pixel handling */ msg = MdcImagesPixelFiddle(fi); if (msg != NULL) { MdcCleanUpFI(fi); MdcPrntWarn("Reading: %s",msg); return(MDC_BAD_CODE); } /* do some requested transformations */ msg = NULL; if (MDC_INFO == MDC_NO) { if ((msg == NULL) && (MDC_CONTRAST_REMAP == MDC_YES)) msg=MdcContrastRemap(fi); if ((msg == NULL) && (MDC_MAKE_SQUARE != MDC_NO)) msg=MdcMakeSquare(fi,MDC_MAKE_SQUARE); if ((msg == NULL) && (MDC_FLIP_HORIZONTAL == MDC_YES)) msg=MdcFlipHorizontal(fi); if ((msg == NULL) && (MDC_FLIP_VERTICAL == MDC_YES)) msg=MdcFlipVertical(fi); if ((msg == NULL) && (MDC_SORT_REVERSE == MDC_YES)) msg=MdcSortReverse(fi); if ((msg == NULL) && (MDC_SORT_CINE_APPLY == MDC_YES)) msg=MdcSortCineApply(fi); if ((msg == NULL) && (MDC_SORT_CINE_UNDO == MDC_YES)) msg=MdcSortCineUndo(fi); if ((msg == NULL) && (MDC_CROP_IMAGES == MDC_YES)) msg=MdcCropImages(fi,NULL); if (msg != NULL) { MdcCleanUpFI(fi); MdcPrntWarn("Transform: %s",msg); return(MDC_BAD_CODE); } } return(MDC_OK); } int MdcWriteFile(FILEINFO *fi, int format, int prefixnr, char *(*WriteFunc)()) { const char *msg=NULL; Int8 INTERNAL_ENDIAN; if (WriteFunc != NULL) format = MDC_FRMT_NONE; /* reset ID's rescaled stuff from any previous write */ MdcResetIDs(fi); /* negative value = self made prefix */ if (prefixnr >= 0 ) MdcPrefix(prefixnr); /* preserve internal file endian - global var issue */ INTERNAL_ENDIAN = MDC_FILE_ENDIAN; switch (format) { case MDC_FRMT_RAW : fi->rawconv = MDC_FRMT_RAW; msg=MdcWriteRAW(fi); break; case MDC_FRMT_ASCII: fi->rawconv = MDC_FRMT_ASCII; msg=MdcWriteRAW(fi); break; #if MDC_INCLUDE_ACR case MDC_FRMT_ACR : msg=MdcWriteACR(fi); break; #endif #if MDC_INCLUDE_GIF case MDC_FRMT_GIF : msg=MdcWriteGIF(fi); break; #endif #if MDC_INCLUDE_INW case MDC_FRMT_INW : msg=MdcWriteINW(fi); break; #endif #if MDC_INCLUDE_ECAT case MDC_FRMT_ECAT6: msg=MdcWriteECAT6(fi); break; #if MDC_INCLUDE_TPC case MDC_FRMT_ECAT7: msg=MdcWriteECAT7(fi); break; #endif #endif #if MDC_INCLUDE_INTF case MDC_FRMT_INTF : msg=MdcWriteINTF(fi); break; #endif #if MDC_INCLUDE_ANLZ case MDC_FRMT_ANLZ : msg=MdcWriteANLZ(fi); break; #endif #if MDC_INCLUDE_DICM case MDC_FRMT_DICM : msg=MdcWriteDICM(fi); break; #endif #if MDC_INCLUDE_PNG case MDC_FRMT_PNG : msg=MdcWritePNG(fi); break; #endif #if MDC_INCLUDE_CONC case MDC_FRMT_CONC : msg=MdcWriteCONC(fi); break; #endif #if MDC_INCLUDE_NIFTI case MDC_FRMT_NIFTI: msg=MdcWriteNIFTI(fi); break; #endif default: if (WriteFunc != NULL) { msg = WriteFunc(fi); }else{ MdcPrntWarn("Writing: Unsupported format"); return(MDC_BAD_FILE); } } /* restore internal file endian - global var issue */ MDC_FILE_ENDIAN = INTERNAL_ENDIAN; MdcCloseFile(fi->ofp); if (msg != NULL) { MdcPrntWarn("Writing: %s",msg); return(MDC_BAD_WRITE); } return(MDC_OK); } int MdcLoadFile(FILEINFO *fi) { int FORMAT=MDC_FRMT_NONE; const char *msg=NULL; /* get the format or fallback */ if ( (FORMAT=MdcGetFrmt(fi) ) == MDC_FRMT_NONE ) { MdcCloseFile(fi->ifp); return(MDC_BAD_READ); } /* read the appropriate format */ switch (FORMAT) { case MDC_FRMT_RAW: msg=MdcReadRAW(fi); break; #if MDC_INCLUDE_ACR case MDC_FRMT_ACR: msg=MdcReadACR(fi); break; #endif #if MDC_INCLUDE_GIF case MDC_FRMT_GIF: msg=MdcReadGIF(fi); break; #endif #if MDC_INCLUDE_INW case MDC_FRMT_INW: msg=MdcReadINW(fi); break; #endif #if MDC_INCLUDE_ECAT case MDC_FRMT_ECAT6: msg=MdcReadECAT6(fi); break; case MDC_FRMT_ECAT7: msg=MdcReadECAT7(fi); break; #endif #if MDC_INCLUDE_INTF case MDC_FRMT_INTF: msg=MdcReadINTF(fi); break; #endif #if MDC_INCLUDE_ANLZ case MDC_FRMT_ANLZ: msg=MdcReadANLZ(fi); break; #endif #if MDC_INCLUDE_DICM case MDC_FRMT_DICM: msg=MdcReadDICM(fi); break; #endif #if MDC_INCLUDE_PNG case MDC_FRMT_PNG: msg=MdcReadPNG(fi); break; #endif #if MDC_INCLUDE_CONC case MDC_FRMT_CONC: msg=MdcLoadCONC(fi); break; #endif #if MDC_INCLUDE_NIFTI case MDC_FRMT_NIFTI: msg=MdcReadNIFTI(fi); break; #endif default: MdcPrntWarn("Loading: unsupported format"); return(MDC_BAD_FILE); } /* read error handling */ if (msg != NULL) { MdcPrntWarn("Loading: %s",msg); return(MDC_BAD_READ); } return(MDC_OK); } int MdcSaveFile(FILEINFO *fi, int format, int prefixnr) { const char *msg=NULL; Int8 INTERNAL_ENDIAN; /* reset ID's rescaled stuff from any previous write */ MdcResetIDs(fi); /* negative value = self made prefix */ if (prefixnr >= 0 ) MdcPrefix(prefixnr); /* preserve internal file endian - global var issue */ INTERNAL_ENDIAN = MDC_FILE_ENDIAN; switch (format) { case MDC_FRMT_RAW : fi->rawconv = MDC_FRMT_RAW; msg=MdcWriteRAW(fi); break; case MDC_FRMT_ASCII: fi->rawconv = MDC_FRMT_ASCII; msg=MdcWriteRAW(fi); break; #if MDC_INCLUDE_ACR case MDC_FRMT_ACR : msg=MdcWriteACR(fi); break; #endif #if MDC_INCLUDE_GIF case MDC_FRMT_GIF : msg=MdcWriteGIF(fi); break; #endif #if MDC_INCLUDE_INW case MDC_FRMT_INW : msg=MdcWriteINW(fi); break; #endif #if MDC_INCLUDE_ECAT case MDC_FRMT_ECAT6: msg=MdcWriteECAT6(fi); break; #if MDC_INCLUDE_TPC case MDC_FRMT_ECAT7: msg=MdcWriteECAT7(fi); break; #endif #endif #if MDC_INCLUDE_INTF case MDC_FRMT_INTF : msg=MdcWriteINTF(fi); break; #endif #if MDC_INCLUDE_ANLZ case MDC_FRMT_ANLZ : msg=MdcWriteANLZ(fi); break; #endif #if MDC_INCLUDE_DICM case MDC_FRMT_DICM : msg=MdcWriteDICM(fi); break; #endif #if MDC_INCLUDE_PNG case MDC_FRMT_PNG : msg=MdcWritePNG(fi); break; #endif #if MDC_INCLUDE_CONC case MDC_FRMT_CONC : msg=MdcSaveCONC(fi); break; #endif #if MDC_INCLUDE_NIFTI case MDC_FRMT_NIFTI: msg=MdcWriteNIFTI(fi); break; #endif default: MdcPrntWarn("Writing: Unsupported format"); return(MDC_BAD_FILE); } /* restore internal file endian - global var issue */ MDC_FILE_ENDIAN = INTERNAL_ENDIAN; MdcCloseFile(fi->ofp); if (msg != NULL) { MdcPrntWarn("Saving: %s",msg); return(MDC_BAD_WRITE); } return(MDC_OK); } int MdcLoadPlane(FILEINFO *fi, Uint32 img) { const char *msg=NULL; /* sanity check */ if (img >= fi->number) { MdcPrntWarn("Loading plane %d: non-existent",img); return(MDC_BAD_CODE); } /* check the format */ if (fi->iformat == MDC_FRMT_NONE) { MdcPrntWarn("Loading plane %d: unsupported format",img); return(MDC_BAD_CODE); } /* check for loaded planes */ if (fi->image[img].buf != NULL) { MdcPrntWarn("Loading plane %d: already loaded",img); return(MDC_OK); } /* read appropriate format */ switch (fi->iformat) { case MDC_FRMT_RAW: /* msg=MdcLoadPlaneRAW(fi, img); */ break; #if MDC_INCLUDE_ACR case MDC_FRMT_ACR: /* msg=MdcLoadPlaneACR(fi, img); */ break; #endif #if MDC_INCLUDE_GIF case MDC_FRMT_GIF: /* msg=MdcLoadPlaneGIF(fi, img); */ break; #endif #if MDC_INCLUDE_INW case MDC_FRMT_INW: /* msg=MdcLoadPlaneINW(fi, img); */ break; #endif #if MDC_INCLUDE_ECAT case MDC_FRMT_ECAT6: /* msg=MdcLoadPlaneECAT6(fi, img); */ break; case MDC_FRMT_ECAT7: /* msg=MdcLoadPlaneECAT7(fi, img); */ break; #endif #if MDC_INCLUDE_INTF case MDC_FRMT_INTF: /* msg=MdcLoadPlaneINTF(fi, img); */ break; #endif #if MDC_INCLUDE_ANLZ case MDC_FRMT_ANLZ: /* msg=MdcLoadPlaneANLZ(fi, img); */ break; #endif #if MDC_INCLUDE_DICM case MDC_FRMT_DICM: /* msg=MdcLoadPlaneDICM(fi, img); */ break; #endif #if MDC_INCLUDE_PNG case MDC_FRMT_PNG: /* msg=MdcLoadPlanePNG(fi, img); */ break; #endif #if MDC_INCLUDE_CONC case MDC_FRMT_CONC: msg=MdcLoadPlaneCONC(fi, (signed)img); break; #endif #if MDC_INCLUDE_NIFTI case MDC_FRMT_NIFTI: /* msg=MdcLoadPlaneNIFTI(fi, img); */ break; #endif default: MdcPrntWarn("Loading plane %d: unsupported format",img); return(MDC_BAD_FILE); } /* error handling */ if (msg != NULL) { MdcPrntWarn("Loading plane %d: %s",img,msg); return(MDC_BAD_READ); } return(MDC_OK); } int MdcDecompressFile(const char *path) { char *ext; if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Decompress (Waiting)"); if (MDC_VERBOSE) MdcPrntMesg("Decompression ..."); /* get last extension (.gz or .Z) */ ext = strrchr(path,'.'); /* build system call, put paths between quotes */ /* in order to catch at least some weird filenames */ sprintf(mdcbufr,"%s -c \"%s\" > \"",MDC_DECOMPRESS,path); /* remove extension from filename */ *ext = '\0'; /* add to pipe of system call */ strcat(mdcbufr,path); strcat(mdcbufr,"\""); /* check if decompressed file already exists */ if (MdcKeepFile(path)) { MdcPrntWarn("Decompressed filename exists!!"); if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_END,0.,NULL); /* no overwrite, restore orig path */ *ext = '.'; return(MDC_BAD_CODE); } if (system(mdcbufr)) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_END,0.,NULL); unlink(path); /* no gunzip? restore orig path */ *ext = '.'; return(MDC_BAD_CODE); } return(MDC_OK); } void MdcStringCopy(char *s1, char *s2, Uint32 length) { if ( length < MDC_MAXSTR) { memcpy(s1,s2,length); s1[length] = '\0'; }else{ memcpy(s1,s2,MDC_MAXSTR); s1[MDC_MAXSTR-1] = '\0'; } } int MdcFileSize(FILE *fp) { int size; fseek(fp,0,SEEK_END); size=ftell(fp); fseek(fp,0,SEEK_SET); return(size); } int MdcFileExists(const char *fname) { FILE *fp; if ((fp=fopen(fname,"rb")) == NULL) return MDC_NO; MdcCloseFile(fp); return MDC_YES; } int MdcKeepFile(const char *fname) { if (MDC_FILE_OVERWRITE == MDC_YES) return(MDC_NO); return(MdcFileExists(fname)); } int MdcGetFrmt(FILEINFO *fi) { int i, format=MDC_FRMT_NONE; if (MDC_FILE_STDIN == MDC_YES && MDC_FRMT_INPUT != MDC_FRMT_NONE) { fi->iformat = MDC_FRMT_INPUT; return(MDC_FRMT_INPUT); } if (MDC_INTERACTIVE) { fi->iformat = MDC_FRMT_RAW; return(MDC_FRMT_RAW); } for (i=MDC_MAX_FRMTS-1;i>=3; i--) { /* MARK: checks reversed; NIFTI must come before ANLZ */ /* otherwise MdcReadANLZ() would handle NIFTI files */ switch (i) { #if MDC_INCLUDE_ACR case MDC_FRMT_ACR: format = MdcCheckACR(fi); break; #endif #if MDC_INCLUDE_GIF case MDC_FRMT_GIF: format = MdcCheckGIF(fi); break; #endif #if MDC_INCLUDE_INW case MDC_FRMT_INW: format = MdcCheckINW(fi); break; #endif #if MDC_INCLUDE_INTF case MDC_FRMT_INTF: format = MdcCheckINTF(fi); break; #endif #if MDC_INCLUDE_ANLZ case MDC_FRMT_ANLZ: format = MdcCheckANLZ(fi); break; #endif #if MDC_INCLUDE_ECAT case MDC_FRMT_ECAT6: format = MdcCheckECAT6(fi); break; case MDC_FRMT_ECAT7: format = MdcCheckECAT7(fi); break; #endif #if MDC_INCLUDE_DICM case MDC_FRMT_DICM: format = MdcCheckDICM(fi); break; #endif #if MDC_INCLUDE_PNG case MDC_FRMT_PNG: format = MdcCheckPNG(fi); break; #endif #if MDC_INCLUDE_CONC case MDC_FRMT_CONC: format = MdcCheckCONC(fi); break; #endif #if MDC_INCLUDE_NIFTI case MDC_FRMT_NIFTI: format = MdcCheckNIFTI(fi); break; #endif } fseek(fi->ifp,0,SEEK_SET); if ( format != MDC_FRMT_NONE ) break; } if (format == MDC_FRMT_NONE) { if (MDC_FALLBACK_FRMT != MDC_FRMT_NONE) { MdcPrntWarn("Image format unknown - trying fallback format"); format = MDC_FALLBACK_FRMT; } } fi->iformat = format; return(format); } Uint8 *MdcGetImgBuffer(Uint32 bytes) { return((Uint8 *)calloc(1,bytes)); } char *MdcHandleTruncated(FILEINFO *fi, Uint32 images, int remap) { Uint32 i; if (images == 0) images = 1; if ((remap == MDC_YES) && (images < fi->number)) { if (!MdcGetStructID(fi,images)) { return("Couldn't realloc truncated IMG_DATA structs"); } } fi->truncated = MDC_YES; fi->dim[0] = 3; fi->dim[3] = fi->number; for (i=4; idim[i] = 0; return NULL; } /* put whole line but MdcSWAP if necessary */ /* on success 1 on error 0 */ int MdcWriteLine(IMG_DATA *id, Uint8 *buf, int type, FILE *fp) { Uint32 i, bytes = MdcType2Bytes(type); Uint8 *pbuf; if (bytes == 1) { fwrite(buf,id->width,bytes,fp); /* no MdcSWAP necessary */ }else for (i=0; iwidth; i++) { pbuf = buf + (i * bytes); switch (type) { case BIT16_S: { Int16 pix; memcpy(&pix,pbuf,bytes); MdcSWAP(pix); fwrite((char *)&pix,1,bytes,fp); } break; case BIT16_U: { Uint16 pix; memcpy(&pix,pbuf,bytes); MdcSWAP(pix); fwrite((char *)&pix,1,bytes,fp); } break; case BIT32_S: { Int32 pix; memcpy(&pix,pbuf,bytes); MdcSWAP(pix); fwrite((char *)&pix,1,bytes,fp); } break; case BIT32_U: { Uint32 pix; memcpy(&pix,pbuf,bytes); MdcSWAP(pix); fwrite((char *)&pix,1,bytes,fp); } break; #ifdef HAVE_8BYTE_INT case BIT64_S: { Int64 pix; memcpy(&pix,pbuf,bytes); MdcSWAP(pix); fwrite((char *)&pix,1,bytes,fp); } break; case BIT64_U: { Uint64 pix; memcpy(&pix,pbuf,bytes); MdcSWAP(pix); fwrite((char *)&pix,1,bytes,fp); } break; #endif case FLT32: { float pix; memcpy(&pix,pbuf,bytes); MdcSWAP(pix); fwrite((char *)&pix,1,bytes,fp); } break; case FLT64: { double pix; memcpy(&pix,pbuf,bytes); MdcSWAP(pix); fwrite((char *)&pix,1,bytes,fp); } break; case VAXFL32: { float flt; memcpy(&flt,pbuf,bytes); MdcMakeVAXfl(flt); fwrite((char *)&flt,1,bytes,fp); } break; } } if (ferror(fp)) return MDC_NO; return MDC_YES; } /* Put pixel but MdcSWAP if necessary */ /* on success 1 on error 0 */ int MdcWriteDoublePixel(double pix, int type, FILE *fp) { unsigned int bytes = (unsigned)MdcType2Bytes(type); switch (type) { case BIT8_S: { Int8 c = (Int8)pix; fwrite((char *)&c,1,bytes,fp); } break; case BIT8_U: { Uint8 c = (Uint8)pix; fwrite((char *)&c,1,bytes,fp); } break; case BIT16_S: { Int16 c = (Int16)pix; MdcSWAP(c); fwrite((char *)&c,1,bytes,fp); } break; case BIT16_U: { Uint16 c = (Uint16)pix; MdcSWAP(c); fwrite((char *)&c,1,bytes,fp); } break; case BIT32_S: { Int32 c = (Int32)pix; MdcSWAP(c); fwrite((char *)&c,1,bytes,fp); } break; case BIT32_U: { Uint32 c = (Uint32)pix; MdcSWAP(c); fwrite((char *)&c,1,bytes,fp); } break; #ifdef HAVE_8BYTE_INT case BIT64_S: { Int64 c = (Int64)pix; MdcSWAP(c); fwrite((char *)&c,1,bytes,fp); } break; case BIT64_U: { Uint64 c = (Uint64)pix; MdcSWAP(c); fwrite((char *)&c,1,bytes,fp); } break; #endif case FLT32: { float c = (float)pix; MdcSWAP(c); fwrite((char *)&c,1,bytes,fp); } break; case VAXFL32: { float flt = (float)pix; MdcMakeVAXfl(flt); fwrite((char *)&flt,1,bytes,fp); } break; case FLT64: { double c = (double)pix; MdcSWAP(c); fwrite((char *)&c,1,bytes,fp); } break; } if (ferror(fp)) return MDC_NO; return MDC_YES; } char *MdcGetFname(char path[]) { char *p; p = MdcGetLastPathDelim(path); if ( p == NULL ) return(path); return(p+1); } void MdcSetExt(char path[], char *ext) { char *p; if (path == NULL) return; if (ext == NULL) return; p=(char *)strrchr(path,'.'); if ( p != NULL ) *p = '\0'; strcat(path,"."); strcat(path,ext); } void MdcNewExt(char dest[], char *src, char *ext) { char *p, *s; if (mdcbasename != NULL) { /* forced output name/path */ s = MdcGetLastPathDelim(mdcbasename); p = strrchr(mdcbasename,'.'); if (s != NULL) { /* full pathname */ strncpy(dest,mdcbasename,MDC_MAX_PATH); dest[MDC_MAX_PATH-5]='\0'; if ((p != NULL) && (p < s)) { /* prevent "(.)./filename" without . for extension */ strcat(dest,".ext"); } }else{ /* single basename */ strncpy(dest,mdcbasename,MDC_MAX_PATH); } }else{ /* default output name */ if ((src != NULL) && (src[0] != '\0')) strcat(dest,src); } MdcSetExt(dest,ext); } /* create a prefix of the form: 000 ... ... 999,A00................ZZZ <- normal -> | <----- extra -----> (1000) (33696) normal prefixes = integers from 000 to 999 (1000) extra prefixes = + 1st char: A...Z (26) 2nd char: 0...9,A...Z (36) 3rd char: 0...9,A...Z (36) This construct gives at first numeric prefixes, extended with a lot more alphanumeric prefixes before overlap. A directory listing will thus show the filenames in sequence of creation. */ void MdcPrefix(int n) { int t, c1, c2, c3, v1, v2, v3; int A='A', Zero='0'; /* ascii values for A and Zero */ char cprefix[6]; if (MDC_PREFIX_DISABLED == MDC_YES) { strcpy(prefix,""); return; } if (n < 1000) { sprintf(cprefix,"m%03d-",n); }else{ t = n - 1000; v1 = t / 1296; v2 = (t % 1296) / 36; v3 = (t % 1296) % 36; if (n >= 34696) { MdcPrntWarn("%d-th conversion creates overlapping filenames", n); if (MDC_FILE_OVERWRITE == MDC_NO) return; } /* first char */ c1 = A + v1; /* A...Z */ /* second char */ if (v2 < 10) c2 = Zero + v2; /* 0...9 */ else c2 = A + v2 - 10; /* A...Z */ /* third char */ if (v3 < 10) c3 = Zero + v3; /* 0...9 */ else c3 = A + v3 - 10; /* A...Z */ sprintf(cprefix,"m%c%c%c-",(char)c1,(char)c2,(char)c3); } if (MDC_FILE_SPLIT != MDC_NO) { /* special naming for splitted files */ switch (MDC_FILE_SPLIT) { case MDC_SPLIT_PER_FRAME: sprintf(prefix,"%sf%04u-",cprefix,MdcGetNrSplit() + 1); break; case MDC_SPLIT_PER_SLICE: sprintf(prefix,"%ss%04d-",cprefix,MdcGetNrSplit() + 1); break; } }else if (MDC_FILE_STACK != MDC_NO) { /* special naming for stacked files */ switch (MDC_FILE_STACK) { case MDC_STACK_SLICES: sprintf(prefix,"%sstacks-",cprefix); break; case MDC_STACK_FRAMES: sprintf(prefix,"%sstackf-",cprefix); break; } }else{ /* default naming */ strcpy(prefix,cprefix); } } int MdcGetPrefixNr(FILEINFO *fi, int nummer) { int prefixnr; prefixnr = MDC_PREFIX_ACQ == MDC_YES ? fi->nr_acquisition : (MDC_PREFIX_SER == MDC_YES ? fi->nr_series : nummer) ; return(prefixnr); } void MdcNewName(char dest[], char *src, char *ext) { strcpy(dest,prefix); MdcNewExt( dest, src, ext); } char *MdcAliasName(FILEINFO *fi, char alias[]) { char unknown[]="unknown"; char *c, *patient, *patient_id, *study; Int16 year, month, day; Int16 hour, minute, second; Int32 series, acquisition, instance; patient = strlen(fi->patient_name) ? fi->patient_name : unknown; patient_id = strlen(fi->patient_id) ? fi->patient_id : unknown; study = strlen(fi->study_id) ? fi->study_id : unknown; year = fi->study_date_year; month = fi->study_date_month; day = fi->study_date_day; hour = fi->study_time_hour; minute= fi->study_time_minute; second= fi->study_time_second; switch (fi->iformat) { case MDC_FRMT_ACR: case MDC_FRMT_DICM: /* UID's */ series = (fi->nr_series > 0) ? fi->nr_series : 0; acquisition = (fi->nr_acquisition > 0) ? fi->nr_acquisition : 0; instance = (fi->nr_instance > 0) ? fi->nr_instance : 0; sprintf(alias,"%s+%s+%hd%02hd%02hd+%02hd%02hd%02hd+%010d+%010d+%010d.ext" ,patient,study ,year,month,day ,hour,minute,second ,series,acquisition,instance); break; case MDC_FRMT_ANLZ: /* patient_id */ sprintf(alias,"%s+%s+%hd%02hd%02hd+%02hd%02hd%02hd.ext" ,patient_id,study ,year,month,day ,hour,minute,second); break; default: sprintf(alias,"%s+%s+%hd%02hd%02hd+%02hd%02hd%02hd.ext" ,patient,study ,year,month,day ,hour,minute,second); } /* change to lower and replace spaces */ c=alias; while (*c) { *c=tolower((int)*c); if (isspace((int)*c)) *c='_'; c++;} return(alias); } /* make alias in opath, splitted ipath assumed */ void MdcEchoAliasName(FILEINFO *fi) { MDC_ALIAS_NAME = MDC_YES; prefix[0]='\0'; MdcDefaultName(fi,fi->iformat,fi->opath,fi->ifname); fprintf(stdout,"%s\n",fi->opath); } void MdcDefaultName(FILEINFO *fi, int format, char dest[], char *src) { char alias[MDC_MAX_PATH]; if (MDC_ALIAS_NAME == MDC_YES) src = MdcAliasName(fi,alias); switch (format) { case MDC_FRMT_RAW : MdcNewName(dest,src,FrmtExt[MDC_FRMT_RAW]); break; case MDC_FRMT_ASCII: MdcNewName(dest,src,FrmtExt[MDC_FRMT_ASCII]); break; #if MDC_INCLUDE_ACR case MDC_FRMT_ACR : MdcNewName(dest,src,FrmtExt[MDC_FRMT_ACR]); break; #endif #if MDC_INCLUDE_GIF case MDC_FRMT_GIF : MdcNewName(dest,src,FrmtExt[MDC_FRMT_GIF]); break; #endif #if MDC_INCLUDE_INW case MDC_FRMT_INW : MdcNewName(dest,src,FrmtExt[MDC_FRMT_INW]); break; #endif #if MDC_INCLUDE_ECAT case MDC_FRMT_ECAT6: MdcNewName(dest,src,FrmtExt[MDC_FRMT_ECAT6]); break; #if MDC_INCLUDE_TPC case MDC_FRMT_ECAT7: MdcNewName(dest,src,FrmtExt[MDC_FRMT_ECAT7]); break; #endif #endif #if MDC_INCLUDE_INTF case MDC_FRMT_INTF : MdcNewName(dest,src,FrmtExt[MDC_FRMT_INTF]); break; #endif #if MDC_INCLUDE_ANLZ case MDC_FRMT_ANLZ : MdcNewName(dest,src,FrmtExt[MDC_FRMT_ANLZ]); break; #endif #if MDC_INCLUDE_DICM case MDC_FRMT_DICM : MdcNewName(dest,src,FrmtExt[MDC_FRMT_DICM]); break; #endif #if MDC_INCLUDE_PNG case MDC_FRMT_PNG : MdcNewName(dest,src,FrmtExt[MDC_FRMT_PNG]); break; #endif #if MDC_INCLUDE_CONC case MDC_FRMT_CONC : MdcNewName(dest,src,FrmtExt[MDC_FRMT_CONC]); break; #endif #if MDC_INCLUDE_NIFTI case MDC_FRMT_NIFTI: MdcNewName(dest,src,FrmtExt[MDC_FRMT_NIFTI]); break; #endif default : MdcNewName(dest,src,FrmtExt[MDC_FRMT_NONE]); break; } } void MdcRenameFile(char *name) { char *pbegin = NULL, *pend = NULL; MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("\tRENAME FILE\n"); MdcPrintLine('-',MDC_FULL_LENGTH); pbegin = MdcGetLastPathDelim(name); /* point to basename */ if (pbegin == NULL) pbegin = name; else pbegin = pbegin + 1; strcpy(mdcbufr,pbegin); pend = (char *)strrchr(mdcbufr,'.'); /* without extension */ if (pend != NULL) pend[0] = '\0'; MdcPrntScrn("\n\tOld Filename: %s\n",mdcbufr); MdcPrntScrn("\n\tNew Filename: "); MdcGetStrLine(mdcbufr,MDC_MAX_PATH-1,stdin); mdcbufr[MDC_MAX_PATH]='\0'; MdcRemoveEnter(mdcbufr); strcpy(name,mdcbufr); MdcPrintLine('-',MDC_FULL_LENGTH); } /* always check for both path delimiters */ char *MdcGetLastPathDelim(char *path) { char *p=NULL; if (path == NULL) return NULL; p = (char *)strrchr(path,'/'); if (p != NULL) return(p); p = (char *)strrchr(path,'\\'); return(p); } void MdcMySplitPath(char path[], char **dir, char **fname) { char *p=NULL; p = MdcGetLastPathDelim(path); /* last path delim becomes '\0' */ if ( p == NULL ) { *fname=&path[0]; *dir=NULL; } else { *p='\0'; *dir=&path[0]; *fname=p+1; } } void MdcMyMergePath(char path[], char *dir, char **fname) /* first '\0' becomes path delim again */ { char *p; if ( dir != NULL ) { p=(char *)strchr(path,'\0'); if ( p != NULL ) *p=MDC_PATH_DELIM_CHR; } *fname = &path[0]; } void MdcFillImgPos(FILEINFO *fi, Uint32 nr, Uint32 plane, float translation) { IMG_DATA *id = &fi->image[nr]; /* according to device coordinates */ switch (fi->pat_slice_orient) { case MDC_SUPINE_HEADFIRST_TRANSAXIAL: case MDC_PRONE_HEADFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL: case MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL : case MDC_SUPINE_FEETFIRST_TRANSAXIAL: case MDC_PRONE_FEETFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL: case MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL : id->image_pos_dev[0]=-(id->pixel_xsize*(float)id->width); id->image_pos_dev[1]=-(id->pixel_ysize*(float)id->height); id->image_pos_dev[2]=-((id->slice_spacing*(float)(plane+1))+translation); break; case MDC_SUPINE_HEADFIRST_SAGITTAL : case MDC_PRONE_HEADFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL: case MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL : case MDC_SUPINE_FEETFIRST_SAGITTAL : case MDC_PRONE_FEETFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL: case MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL : id->image_pos_dev[0]=-((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_dev[1]=-(id->pixel_xsize*(float)id->width); id->image_pos_dev[2]=-(id->pixel_ysize*(float)id->height); break; case MDC_SUPINE_HEADFIRST_CORONAL : case MDC_PRONE_HEADFIRST_CORONAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL: case MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL : case MDC_SUPINE_FEETFIRST_CORONAL : case MDC_PRONE_FEETFIRST_CORONAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL: case MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL : id->image_pos_dev[0]=-(id->pixel_xsize*(float)id->width); id->image_pos_dev[1]=-((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_dev[2]=-(id->pixel_ysize*(float)id->height); break; default : { } /* do nothing */ } /* according to the patient coordinate system */ switch (fi->pat_slice_orient) { case MDC_SUPINE_HEADFIRST_TRANSAXIAL: id->image_pos_pat[0]=-(id->pixel_xsize*(float)id->width); id->image_pos_pat[1]=-(id->pixel_ysize*(float)id->height); id->image_pos_pat[2]=-((id->slice_spacing*(float)(plane+1))+translation); break; case MDC_SUPINE_HEADFIRST_SAGITTAL : id->image_pos_pat[0]=-((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_pat[1]=-(id->pixel_xsize*(float)id->width); id->image_pos_pat[2]=-(id->pixel_ysize*(float)id->height); break; case MDC_SUPINE_HEADFIRST_CORONAL : id->image_pos_pat[0]=-(id->pixel_xsize*(float)id->width); id->image_pos_pat[1]=-((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_pat[2]=-(id->pixel_ysize*(float)id->height); break; case MDC_SUPINE_FEETFIRST_TRANSAXIAL: id->image_pos_pat[0]=+(id->pixel_xsize*(float)id->width); id->image_pos_pat[1]=-(id->pixel_ysize*(float)id->height); id->image_pos_pat[2]=+((id->slice_spacing*(float)(plane+1))+translation); break; case MDC_SUPINE_FEETFIRST_SAGITTAL : id->image_pos_pat[0]=+((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_pat[1]=-(id->pixel_xsize*(float)id->width); id->image_pos_pat[2]=+(id->pixel_ysize*(float)id->height); break; case MDC_SUPINE_FEETFIRST_CORONAL : id->image_pos_pat[0]=+(id->pixel_xsize*(float)id->width); id->image_pos_pat[1]=-((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_pat[2]=+(id->pixel_ysize*(float)id->height); break; case MDC_PRONE_HEADFIRST_TRANSAXIAL : id->image_pos_pat[0]=+(id->pixel_xsize*(float)id->width); id->image_pos_pat[1]=+(id->pixel_ysize*(float)id->height); id->image_pos_pat[2]=-((id->slice_spacing*(float)(plane+1))+translation); break; case MDC_PRONE_HEADFIRST_SAGITTAL : id->image_pos_pat[0]=+((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_pat[1]=+(id->pixel_xsize*(float)id->width); id->image_pos_pat[2]=-(id->pixel_ysize*(float)id->height); break; case MDC_PRONE_HEADFIRST_CORONAL : id->image_pos_pat[0]=+(id->pixel_xsize*(float)id->width); id->image_pos_pat[1]=+((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_pat[2]=-(id->pixel_ysize*(float)id->height); break; case MDC_PRONE_FEETFIRST_TRANSAXIAL : id->image_pos_pat[0]=-(id->pixel_xsize*(float)id->width); id->image_pos_pat[1]=+(id->pixel_ysize*(float)id->height); id->image_pos_pat[2]=+((id->slice_spacing*(float)(plane+1))+translation); break; case MDC_PRONE_FEETFIRST_SAGITTAL : id->image_pos_pat[0]=-((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_pat[1]=+(id->pixel_xsize*(float)id->width); id->image_pos_pat[2]=+(id->pixel_ysize*(float)id->height); break; case MDC_PRONE_FEETFIRST_CORONAL : id->image_pos_pat[0]=-(id->pixel_xsize*(float)id->width); id->image_pos_pat[1]=+((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_pat[2]=+(id->pixel_ysize*(float)id->height); break; case MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL: id->image_pos_pat[0]=+(id->pixel_ysize*(float)id->height); id->image_pos_pat[1]=-(id->pixel_xsize*(float)id->width); id->image_pos_pat[2]=-((id->slice_spacing*(float)(plane+1))+translation); break; case MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL: id->image_pos_pat[0]=-(id->pixel_xsize*(float)id->width); id->image_pos_pat[1]=-((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_pat[2]=-(id->pixel_ysize*(float)id->height); break; case MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL: id->image_pos_pat[0]=+((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_pat[1]=-(id->pixel_xsize*(float)id->width); id->image_pos_pat[2]=-(id->pixel_ysize*(float)id->height); break; case MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL: id->image_pos_pat[0]=+(id->pixel_ysize*(float)id->height); id->image_pos_pat[1]=+(id->pixel_xsize*(float)id->width); id->image_pos_pat[2]=+((id->slice_spacing*(float)(plane+1))+translation); break; case MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL: id->image_pos_pat[0]=+(id->pixel_xsize*(float)id->width); id->image_pos_pat[1]=+((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_pat[2]=+(id->pixel_ysize*(float)id->height); break; case MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL: id->image_pos_pat[0]=+((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_pat[1]=+(id->pixel_xsize*(float)id->width); id->image_pos_pat[2]=+(id->pixel_ysize*(float)id->height); break; case MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL : id->image_pos_pat[0]=-(id->pixel_ysize*(float)id->height); id->image_pos_pat[1]=+(id->pixel_xsize*(float)id->width); id->image_pos_pat[2]=-((id->slice_spacing*(float)(plane+1))+translation); break; case MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL : id->image_pos_pat[0]=-(id->pixel_xsize*(float)id->width); id->image_pos_pat[1]=+((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_pat[2]=-(id->pixel_ysize*(float)id->height); break; case MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL : id->image_pos_pat[0]=-((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_pat[1]=+(id->pixel_xsize*(float)id->width); id->image_pos_pat[2]=-(id->pixel_ysize*(float)id->height); break; case MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL : id->image_pos_pat[0]=-(id->pixel_ysize*(float)id->height); id->image_pos_pat[1]=-(id->pixel_xsize*(float)id->width); id->image_pos_pat[2]=+((id->slice_spacing*(float)(plane+1))+translation); break; case MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL : id->image_pos_pat[0]=+(id->pixel_xsize*(float)id->width); id->image_pos_pat[0]=-((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_pat[2]=+(id->pixel_ysize*(float)id->height); break; case MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL : id->image_pos_pat[0]=-((id->slice_spacing*(float)(plane+1))+translation); id->image_pos_pat[1]=-(id->pixel_xsize*(float)id->width); id->image_pos_pat[2]=+(id->pixel_ysize*(float)id->height); break; default : { } /* do nothing */ } } void MdcFillImgOrient(FILEINFO *fi, Uint32 nr) { IMG_DATA *id = &fi->image[nr]; /* according to device coordinate system */ switch (fi->pat_slice_orient) { case MDC_SUPINE_HEADFIRST_TRANSAXIAL: case MDC_PRONE_HEADFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL: case MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL : case MDC_SUPINE_FEETFIRST_TRANSAXIAL: case MDC_PRONE_FEETFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL: case MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL : id->image_orient_dev[0]=+1.0; id->image_orient_dev[3]=+0.0; id->image_orient_dev[1]=-0.0; id->image_orient_dev[4]=+1.0; id->image_orient_dev[2]=+0.0; id->image_orient_dev[5]=-0.0; break; case MDC_SUPINE_HEADFIRST_SAGITTAL : case MDC_PRONE_HEADFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL: case MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL : case MDC_SUPINE_FEETFIRST_SAGITTAL : case MDC_PRONE_FEETFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL: case MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL : id->image_orient_dev[0]=+0.0; id->image_orient_dev[3]=+0.0; id->image_orient_dev[1]=+1.0; id->image_orient_dev[4]=-0.0; id->image_orient_dev[2]=-0.0; id->image_orient_dev[5]=-1.0; break; case MDC_SUPINE_HEADFIRST_CORONAL : case MDC_PRONE_HEADFIRST_CORONAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL: case MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL : case MDC_SUPINE_FEETFIRST_CORONAL : case MDC_PRONE_FEETFIRST_CORONAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL: case MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL : id->image_orient_dev[0]=+1.0; id->image_orient_dev[3]=+0.0; id->image_orient_dev[1]=-0.0; id->image_orient_dev[4]=-0.0; id->image_orient_dev[2]=+0.0; id->image_orient_dev[5]=-1.0; break; default : { } } /* according to patient coordinate system */ switch (fi->pat_slice_orient) { case MDC_SUPINE_HEADFIRST_TRANSAXIAL: id->image_orient_pat[0]=+1.0; id->image_orient_pat[3]=+0.0; id->image_orient_pat[1]=-0.0; id->image_orient_pat[4]=+1.0; id->image_orient_pat[2]=+0.0; id->image_orient_pat[5]=-0.0; break; case MDC_SUPINE_HEADFIRST_SAGITTAL : id->image_orient_pat[0]=+0.0; id->image_orient_pat[3]=+0.0; id->image_orient_pat[1]=+1.0; id->image_orient_pat[4]=-0.0; id->image_orient_pat[2]=-0.0; id->image_orient_pat[5]=-1.0; break; case MDC_SUPINE_HEADFIRST_CORONAL : id->image_orient_pat[0]=+1.0; id->image_orient_pat[3]=+0.0; id->image_orient_pat[1]=-0.0; id->image_orient_pat[4]=-0.0; id->image_orient_pat[2]=+0.0; id->image_orient_pat[5]=-1.0; break; case MDC_SUPINE_FEETFIRST_TRANSAXIAL: id->image_orient_pat[0]=-1.0; id->image_orient_pat[3]=+0.0; id->image_orient_pat[1]=+0.0; id->image_orient_pat[4]=+1.0; id->image_orient_pat[2]=-0.0; id->image_orient_pat[5]=-0.0; break; case MDC_SUPINE_FEETFIRST_SAGITTAL : id->image_orient_pat[0]=+0.0; id->image_orient_pat[3]=-0.0; id->image_orient_pat[1]=+1.0; id->image_orient_pat[4]=+0.0; id->image_orient_pat[2]=-0.0; id->image_orient_pat[5]=+1.0; break; case MDC_SUPINE_FEETFIRST_CORONAL : id->image_orient_pat[0]=-1.0; id->image_orient_pat[3]=-0.0; id->image_orient_pat[1]=+0.0; id->image_orient_pat[4]=+0.0; id->image_orient_pat[2]=-0.0; id->image_orient_pat[5]=+1.0; break; case MDC_PRONE_HEADFIRST_TRANSAXIAL : id->image_orient_pat[0]=-1.0; id->image_orient_pat[3]=-0.0; id->image_orient_pat[1]=+0.0; id->image_orient_pat[4]=-1.0; id->image_orient_pat[2]=-0.0; id->image_orient_pat[5]=+0.0; break; case MDC_PRONE_HEADFIRST_SAGITTAL : id->image_orient_pat[0]=-0.0; id->image_orient_pat[3]=+0.0; id->image_orient_pat[1]=-1.0; id->image_orient_pat[4]=-0.0; id->image_orient_pat[2]=+0.0; id->image_orient_pat[5]=-1.0; break; case MDC_PRONE_HEADFIRST_CORONAL : id->image_orient_pat[0]=-1.0; id->image_orient_pat[3]=+0.0; id->image_orient_pat[1]=+0.0; id->image_orient_pat[4]=-0.0; id->image_orient_pat[2]=-0.0; id->image_orient_pat[5]=-1.0; break; case MDC_PRONE_FEETFIRST_TRANSAXIAL : id->image_orient_pat[0]=+1.0; id->image_orient_pat[3]=-0.0; id->image_orient_pat[1]=-0.0; id->image_orient_pat[4]=-1.0; id->image_orient_pat[2]=+0.0; id->image_orient_pat[5]=+0.0; break; case MDC_PRONE_FEETFIRST_SAGITTAL : id->image_orient_pat[0]=-0.0; id->image_orient_pat[3]=-0.0; id->image_orient_pat[1]=-1.0; id->image_orient_pat[4]=+0.0; id->image_orient_pat[2]=+0.0; id->image_orient_pat[5]=+1.0; break; case MDC_PRONE_FEETFIRST_CORONAL : id->image_orient_pat[0]=+1.0; id->image_orient_pat[3]=-0.0; id->image_orient_pat[1]=-0.0; id->image_orient_pat[4]=+0.0; id->image_orient_pat[2]=+0.0; id->image_orient_pat[5]=+1.0; break; case MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL: id->image_orient_pat[0]=+1.0; id->image_orient_pat[3]=+0.0; id->image_orient_pat[1]=-0.0; id->image_orient_pat[4]=+1.0; id->image_orient_pat[2]=+0.0; id->image_orient_pat[5]=-0.0; break; case MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL: case MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL: case MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL: case MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL: case MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL: case MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL : case MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL : case MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL : case MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL : case MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL : case MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL : /* FIXME */ /* MdcPrntWarn("Extra code needed in %s at line %d\n", __FILE__, __LINE__);*/ default : { } /* do nothing */ } } int MdcGetOrthogonalInt(float f) { int i; if (f == 0.0) i = 0; else if (f == 1.0) i = 1; else if (f == -1.0) i = -1; else i = (f < 0) ? (int)(f - 0.5) : (int)(f + 0.5); return(i); } Int8 MdcGetPatSliceOrient(FILEINFO *fi, Uint32 i) { IMG_DATA *id = &fi->image[i]; int i0,i1,i4,i5; int slice_orientation=MDC_UNKNOWN; int patient_orientation=MDC_UNKNOWN; int patient_rotation=MDC_UNKNOWN; Int8 pat_slice_orient=MDC_UNKNOWN; i0 = MdcGetOrthogonalInt(id->image_orient_pat[0]); i1 = MdcGetOrthogonalInt(id->image_orient_pat[1]); i4 = MdcGetOrthogonalInt(id->image_orient_pat[4]); i5 = MdcGetOrthogonalInt(id->image_orient_pat[5]); /* A) image orientation combined with patient position */ if (strstr(fi->pat_pos,"Unknown") == NULL) { /* patient orientation */ if (strstr(fi->pat_pos,"HF") != NULL) { patient_orientation = MDC_HEADFIRST; }else if (strstr(fi->pat_pos,"FF") != NULL) { patient_orientation = MDC_FEETFIRST; } /* patient rotation */ if (strstr(fi->pat_pos,"S") != NULL) { patient_rotation = MDC_SUPINE; }else if (strstr(fi->pat_pos,"P") != NULL) { patient_rotation = MDC_PRONE; }else if (strstr(fi->pat_pos, "DR") != NULL) { patient_rotation = MDC_DECUBITUS_RIGHT; }else if (strstr(fi->pat_pos, "DL") != NULL) { patient_rotation = MDC_DECUBITUS_LEFT; } /* slice orientation */ if ((i0 == +1 || i0 == -1) && (i4 == +1 || i4 == -1)) { slice_orientation = MDC_TRANSAXIAL; }else if ((i1 == +1 || i1 == -1) && (i5 == +1 || i5 == -1)) { slice_orientation = MDC_SAGITTAL; }else if ((i0 == +1 || i0 == -1) && (i5 == +1 || i5 == -1)) { slice_orientation = MDC_CORONAL; } /* combined result */ switch (patient_rotation) { case MDC_SUPINE: switch (patient_orientation) { case MDC_HEADFIRST: switch (slice_orientation) { case MDC_TRANSAXIAL: pat_slice_orient = MDC_SUPINE_HEADFIRST_TRANSAXIAL; break; case MDC_SAGITTAL: pat_slice_orient = MDC_SUPINE_HEADFIRST_SAGITTAL; break; case MDC_CORONAL: pat_slice_orient = MDC_SUPINE_HEADFIRST_CORONAL; break; } break; case MDC_FEETFIRST: switch (slice_orientation) { case MDC_TRANSAXIAL: pat_slice_orient = MDC_SUPINE_FEETFIRST_TRANSAXIAL; break; case MDC_SAGITTAL: pat_slice_orient = MDC_SUPINE_FEETFIRST_SAGITTAL; break; case MDC_CORONAL: pat_slice_orient = MDC_SUPINE_FEETFIRST_CORONAL; break; } break; } break; case MDC_PRONE: switch (patient_orientation) { case MDC_HEADFIRST: switch (slice_orientation) { case MDC_TRANSAXIAL: pat_slice_orient = MDC_PRONE_HEADFIRST_TRANSAXIAL; break; case MDC_SAGITTAL: pat_slice_orient = MDC_PRONE_HEADFIRST_SAGITTAL; break; case MDC_CORONAL: pat_slice_orient = MDC_PRONE_HEADFIRST_CORONAL; break; } break; case MDC_FEETFIRST: switch (slice_orientation) { case MDC_TRANSAXIAL: pat_slice_orient = MDC_PRONE_FEETFIRST_TRANSAXIAL; break; case MDC_SAGITTAL: pat_slice_orient = MDC_PRONE_FEETFIRST_SAGITTAL; break; case MDC_CORONAL: pat_slice_orient = MDC_PRONE_FEETFIRST_CORONAL; break; } break; } break; case MDC_DECUBITUS_RIGHT: switch (patient_orientation) { case MDC_HEADFIRST: switch (slice_orientation) { case MDC_TRANSAXIAL: pat_slice_orient=MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL; break; case MDC_SAGITTAL: pat_slice_orient=MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL; break; case MDC_CORONAL: pat_slice_orient=MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL; break; } break; case MDC_FEETFIRST: switch (slice_orientation) { case MDC_TRANSAXIAL: pat_slice_orient=MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL; break; case MDC_SAGITTAL: pat_slice_orient=MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL; break; case MDC_CORONAL: pat_slice_orient=MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL; break; } break; } break; case MDC_DECUBITUS_LEFT: switch (patient_orientation) { case MDC_HEADFIRST: switch (slice_orientation) { case MDC_TRANSAXIAL: pat_slice_orient=MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL; break; case MDC_SAGITTAL: pat_slice_orient=MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL; break; case MDC_CORONAL: pat_slice_orient=MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL; break; } break; case MDC_FEETFIRST: switch (slice_orientation) { case MDC_TRANSAXIAL: pat_slice_orient=MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL; break; case MDC_SAGITTAL: pat_slice_orient=MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL; break; case MDC_CORONAL: pat_slice_orient=MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL; break; } break; } break; } if (pat_slice_orient != MDC_UNKNOWN) return(pat_slice_orient); } /* B) image orientation alone */ if ((i0 == +1) && (i4 == +1)) return MDC_SUPINE_HEADFIRST_TRANSAXIAL; if ((i0 == -1) && (i4 == +1)) return MDC_SUPINE_FEETFIRST_TRANSAXIAL; if ((i0 == -1) && (i4 == -1)) return MDC_PRONE_HEADFIRST_TRANSAXIAL; if ((i0 == +1) && (i4 == -1)) return MDC_PRONE_FEETFIRST_TRANSAXIAL; /* FIXME - doesn't handle DECUBITUS positions */ if ((i1 == +1) && (i5 == -1)) return MDC_SUPINE_HEADFIRST_SAGITTAL; if ((i1 == +1) && (i5 == +1)) return MDC_SUPINE_FEETFIRST_SAGITTAL; if ((i1 == -1) && (i5 == -1)) return MDC_PRONE_HEADFIRST_SAGITTAL; if ((i1 == -1) && (i5 == +1)) return MDC_PRONE_FEETFIRST_SAGITTAL; /* FIXME - doesn't handle DECUBITUS positions */ if ((i0 == +1) && (i5 == -1)) return MDC_SUPINE_HEADFIRST_CORONAL; if ((i0 == -1) && (i5 == +1)) return MDC_SUPINE_FEETFIRST_CORONAL; if ((i0 == -1) && (i5 == -1)) return MDC_PRONE_HEADFIRST_CORONAL; if ((i0 == +1) && (i5 == +1)) return MDC_PRONE_FEETFIRST_CORONAL; /* FIXME - doesn't handle DECUBITUS positions */ return(MDC_UNKNOWN); } Int8 MdcTryPatSliceOrient(char *pat_orient) { char buffer[MDC_MAXSTR], *p1, *p2; Int8 orient1=MDC_UNKNOWN, orient2=MDC_UNKNOWN; MdcStringCopy(buffer,pat_orient,strlen(pat_orient)); p1 = buffer; p2 = strrchr(buffer, '\\'); if (p2 == NULL) return MDC_UNKNOWN; p2[0] = '\0'; p2+=1; if (strchr(p1,'L') != NULL) orient1 = MDC_LEFT; else if (strchr(p1,'R') != NULL) orient1 = MDC_RIGHT; else if (strchr(p1,'A') != NULL) orient1 = MDC_ANTERIOR; else if (strchr(p1,'P') != NULL) orient1 = MDC_POSTERIOR; else if (strchr(p1,'H') != NULL) orient1 = MDC_HEAD; else if (strchr(p1,'F') != NULL) orient1 = MDC_FEET; if (strchr(p2,'L') != NULL) orient2 = MDC_LEFT; else if (strchr(p2,'R') != NULL) orient2 = MDC_RIGHT; else if (strchr(p2,'A') != NULL) orient2 = MDC_ANTERIOR; else if (strchr(p2,'P') != NULL) orient2 = MDC_POSTERIOR; else if (strchr(p2,'H') != NULL) orient2 = MDC_HEAD; else if (strchr(p2,'F') != NULL) orient2 = MDC_FEET; if (orient1 == MDC_LEFT && orient2 == MDC_POSTERIOR) return MDC_SUPINE_HEADFIRST_TRANSAXIAL; if (orient1 == MDC_POSTERIOR && orient2 == MDC_FEET) return MDC_SUPINE_HEADFIRST_SAGITTAL; if (orient1 == MDC_LEFT && orient2 == MDC_FEET) return MDC_SUPINE_HEADFIRST_CORONAL; if (orient1 == MDC_RIGHT && orient2 == MDC_POSTERIOR) return MDC_SUPINE_FEETFIRST_TRANSAXIAL; if (orient1 == MDC_POSTERIOR && orient2 == MDC_HEAD) return MDC_SUPINE_FEETFIRST_SAGITTAL; if (orient1 == MDC_RIGHT && orient2 == MDC_HEAD) return MDC_SUPINE_FEETFIRST_CORONAL; if (orient1 == MDC_RIGHT && orient2 == MDC_ANTERIOR) return MDC_PRONE_HEADFIRST_TRANSAXIAL; if (orient1 == MDC_ANTERIOR && orient2 == MDC_FEET) return MDC_PRONE_HEADFIRST_SAGITTAL; if (orient1 == MDC_RIGHT && orient2 == MDC_FEET) return MDC_PRONE_HEADFIRST_CORONAL; if (orient1 == MDC_LEFT && orient2 == MDC_ANTERIOR) return MDC_PRONE_FEETFIRST_TRANSAXIAL; if (orient1 == MDC_ANTERIOR && orient2 == MDC_HEAD) return MDC_PRONE_FEETFIRST_SAGITTAL; if (orient1 == MDC_LEFT && orient2 == MDC_HEAD) return MDC_PRONE_FEETFIRST_CORONAL; if (orient1 == MDC_POSTERIOR && orient2 == MDC_RIGHT) return MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL; if (orient1 == MDC_RIGHT && orient2 == MDC_FEET) return MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL; if (orient1 == MDC_POSTERIOR && orient2 == MDC_FEET) return MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL; if (orient1 == MDC_ANTERIOR && orient2 == MDC_RIGHT) return MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL; if (orient1 == MDC_RIGHT && orient2 == MDC_HEAD) return MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL; if (orient1 == MDC_ANTERIOR && orient2 == MDC_HEAD) return MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL; if (orient1 == MDC_ANTERIOR && orient2 == MDC_LEFT) return MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL; if (orient1 == MDC_LEFT && orient2 == MDC_FEET) return MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL; if (orient1 == MDC_ANTERIOR && orient2 == MDC_FEET) return MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL; if (orient1 == MDC_POSTERIOR && orient2 == MDC_LEFT) return MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL; if (orient1 == MDC_LEFT && orient2 == MDC_FEET) return MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL; if (orient1 == MDC_POSTERIOR && orient2 == MDC_FEET) return MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL; return MDC_UNKNOWN; } /* Formats that only support one rescale factor but no slope/intercept */ /* sometimes can lose quantitation: during rescale, the rescaled_fctr */ /* is put to one. Warn the user about the loss of quantitation */ /* example: negatives and force Uint8 pixel output */ Int8 MdcCheckQuantitation(FILEINFO *fi) { IMG_DATA *id; Uint32 i; if (MDC_QUANTIFY || MDC_CALIBRATE) { for (i=0; inumber; i++) { id = &fi->image[0]; if (id->rescaled && (id->rescaled_fctr != id->rescaled_slope)) { MdcPrntWarn("Quantitation was lost"); return(MDC_YES); } } } return(MDC_NO); } /* return heart rate in beats per minute */ float MdcGetHeartRate(GATED_DATA *gd, Int16 type) { float heart_rate = 0.; if (gd->study_duration > 0.) { switch (type) { case MDC_HEART_RATE_ACQUIRED: /* note: [ms] -> [min] */ heart_rate = (gd->cycles_acquired * 60. * 1000.) / gd->study_duration; break; case MDC_HEART_RATE_OBSERVED: /* note: [ms] -> [min] */ heart_rate = (gd->cycles_observed * 60. * 1000.) / gd->study_duration; break; } } return(heart_rate); } xmedcon-0.14.1/source/m-fancy.h0000644000175000017510000001133712636253502013170 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-fancy.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-fancy.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-fancy.h,v 1.41 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_FANCY_H__ #define __M_FANCY_H__ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-defs.h" #include "m-structs.h" #include "m-algori.h" #include "m-global.h" #include "m-error.h" /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_FULL_LENGTH 79 #define MDC_HALF_LENGTH 39 #define MDC_BOX_SIZE 16 /**************************************************************************** F U N C T I O N S ****************************************************************************/ void MdcPrintLine(char c, int length); void MdcPrintChar(int c); void MdcPrintStr(char *str); void MdcPrintBoxLine(char c, int t); void MdcPrintYesNo(int value ); void MdcPrintImageLayout(FILEINFO *fi, Uint32 gen, Uint32 img, int repeat); int MdcPrintValue(FILE *fp, Uint8 *pvalue, Uint16 type); void MdcLowStr(char *str); void MdcUpStr(char *str); void MdcKillSpaces(char string[]); void MdcRemoveAllSpaces(char string[]); void MdcRemoveEnter(char string[]); void MdcGetStrLine(char string[], int maxchars, FILE *fp); void MdcGetStrInput(char string[], int maxchars); int MdcGetSubStr(char *dest, char *src, int dmax, char sep, int n); void MdcGetSafeString(char *dest, char *src, Uint32 length, Uint32 maximum); int MdcUseDefault(const char string[]); int MdcPutDefault(char string[]); int MdcGetRange(const char *item, Uint32 *from, Uint32 *to, Uint32 *step); char *MdcHandleEcatList(char *list, Uint32 **dims, Uint32 max); char *MdcHandleNormList(char *list, Uint32 **inrs, Uint32 *it , Uint32 *bt,Uint32 max); char *MdcHandlePixelList(char *list, Uint32 **cols, Uint32 **rows , Uint32 *it, Uint32 *bt); char *MdcGetStrAcquisition(int acq_type); char *MdcGetStrRawConv(int rawconv); char *MdcGetStrEndian(int endian); char *MdcGetStrCompression(int compression); char *MdcGetStrPixelType(int type); char *MdcGetStrColorMap(int map); char *MdcGetStrYesNo(int boolean); char *MdcGetStrSlProjection(int slice_projection); char *MdcGetStrPatSlOrient(int patient_slice_orient); char *MdcGetStrPatPos(int patient_slice_orient); char *MdcGetStrPatOrient(int patient_slice_orient); char *MdcGetStrSliceOrient(int patient_slice_orient); char *MdcGetStrRotation(int rotation); char *MdcGetStrMotion(int motion); char *MdcGetStrModality(int modint); char *MdcGetStrGSpectNesting(int nesting); char *MdcGetStrHHMMSS(float msecs); int MdcGetIntModality(char *modstr); int MdcGetIntSliceOrient(int patient_slice_orient); const char *MdcGetLibLongVersion(void); const char *MdcGetLibShortVersion(void); Uint32 MdcCheckStrSize(char *str_to_add, Uint32 current_size, Uint32 max); int MdcMakeScanInfoStr(FILEINFO *fi); int MdcIsDigit(char c); void MdcWaitForEnter(int page); Int32 MdcGetSelectionType(void); void MdcFlushInput(void); int MdcWhichDecompress(void); int MdcWhichCompression(const char *fname); void MdcAddCompressionExt(int ctype, char *fname); #endif xmedcon-0.14.1/source/xrender.h0000644000175000017510000000364712636253502013312 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xrender.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xrender.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xrender.h,v 1.16 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XRENDER_H__ #define __XRENDER_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcApplyNewRendering(void); void XMdcRenderingSelCallbackApply(GtkWidget *widget, gpointer data); void XMdcRenderingSel(void); #endif xmedcon-0.14.1/source/m-stack.c0000644000175000017510000004273712636253502013200 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-stack.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : stack files as specified * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcGetNormSliceSpacing() - Get spacing between slices * * MdcStackSlices() - Stack single slice image files* * MdcStackFrames() - Stack multi slice volume files* * MdcStackFiles() - Main stack routine * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-stack.c,v 1.48 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include #include #include "medcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ static FILEINFO infi, outfi; static int mdc_nrstack=0; /**************************************************************************** F U N C T I O N S ****************************************************************************/ float MdcGetNormSliceSpacing(IMG_DATA *id1, IMG_DATA *id2) { /* slice_spacing = sqrt( (x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2 ) */ float value, slice_spacing; float dx, dy, dz; slice_spacing = id1->slice_spacing; dx = id1->image_pos_pat[0] - id2->image_pos_pat[0]; dy = id1->image_pos_pat[1] - id2->image_pos_pat[1]; dz = id1->image_pos_pat[2] - id2->image_pos_pat[2]; value = (float)sqrt((double)(dx*dx + dy*dy + dz*dz)); if (fabs(slice_spacing - value) <= MDC_FLT_EPSILON) { /* insignificant difference, use original header value */ slice_spacing = id1->slice_spacing; }else{ /* significant, use calculated value from image_pos_pat[] info */ slice_spacing = (float)value; } return(slice_spacing); } /* tomo : stack single slice image files into one 3D volume file (2D+ -> 3D)*/ /* planar: stack planar slice image files into one single file */ char *MdcStackSlices(void) { FILEINFO *ifi, *ofi; IMG_DATA *id1, *id2; DYNAMIC_DATA *dd1, *dd2; Uint32 d, nr_of_images; int HAS_DYNAMIC_DATA = MDC_NO; char *msg=NULL; int *total = mdc_arg_total; /* total arguments of files & conversions */ int *convs = mdc_arg_convs; /* counter for each conversion format */ char **files = mdc_arg_files; /* array of pointers to input filenames */ int i, convert, c; float time_frame_duration=0.; ifi = &infi; ofi= &outfi; /* initialize output FILEINFO */ MdcInitFI(ofi,"stack3d"); nr_of_images = total[MDC_FILES]; if ((ifi->dynnr > 0) && (ifi->dyndata != NULL)) HAS_DYNAMIC_DATA = MDC_YES; /* read and stack the several single slice files */ for (i=0; idim[0] = 3; ofi->dim[1] = ifi->dim[1]; ofi->dim[2] = ifi->dim[2]; ofi->dim[3] = nr_of_images; ofi->pixdim[0] = 3.; ofi->pixdim[1] = ifi->pixdim[1]; ofi->pixdim[2] = ifi->pixdim[2]; if (ofi->planar == MDC_NO) ofi->acquisition_type = MDC_ACQUISITION_TOMO; if (!MdcGetStructDD(ofi,1)) { MdcCleanUpFI(ofi); MdcCleanUpFI(ifi); return("stack slices : Couldn't alloc output DYNAMIC_DATA structs"); }else{ ofi->dyndata[0].nr_of_slices = nr_of_images; } if (!MdcGetStructID(ofi,nr_of_images)) { MdcCleanUpFI(ofi); MdcCleanUpFI(ifi); return("stack slices : Couldn't alloc output ING_DATA structs"); } /* remember time_frame_duration */ if (HAS_DYNAMIC_DATA == MDC_YES) { time_frame_duration = ifi->dyndata[0].time_frame_duration; } }else{ if (HAS_DYNAMIC_DATA == MDC_YES) { dd1 = &ofi->dyndata[0]; dd2 = &ifi->dyndata[0]; /* check time_frame_duration differences */ if (time_frame_duration != dd2->time_frame_duration) { MdcPrntWarn("stack slices : Different image durations found"); } /* planar = increment total time_frame_duration */ if (ofi->planar == MDC_YES) { dd1->time_frame_duration += dd2->time_frame_duration; } } } /* sanity checks */ for (d=3; d < MDC_MAX_DIMS; d++) if (ifi->dim[d] > 1 ) { MdcCleanUpFI(ofi); MdcCleanUpFI(ifi); return("stack slices : Only single slice (one image) files supported"); } if (ifi->dim[3] == 0) { MdcCleanUpFI(ofi); MdcCleanUpFI(ifi); return("stack slices : File without image found"); } /* copy IMG_DATA info */ msg = MdcCopyID(&ofi->image[i],&ifi->image[0],MDC_YES); if (msg != NULL) { MdcCleanUpFI(ofi); MdcCleanUpFI(ifi); sprintf(mdcbufr,"stack slices : %s",msg); return(mdcbufr); } /* small checks for file integrity */ if (i > 0) { id1 = &ifi->image[0]; /* current slice */ id2 = &ofi->image[i-1]; /* previous slice */ if (ifi->pat_slice_orient != ofi->pat_slice_orient) { MdcPrntWarn("stack slices : Different 'patient_slice_orient' found"); } if ((id1->width != id2->width) || (id1->height != id2->height)) { MdcPrntWarn("stack slices : Different image dimensions found"); } if (id1->slice_width != id2->slice_width) { MdcPrntWarn("stack slices : Different slice thickness found"); } if (id1->slice_spacing != id2->slice_spacing) { MdcPrntWarn("stack slices : Different slice spacing found"); } if (id1->type != id2->type) { MdcPrntWarn("stack slices : Different pixel type found"); } } MdcCleanUpFI(ifi); } /* check all the images */ msg = MdcImagesPixelFiddle(ofi); if (msg != NULL) { MdcCleanUpFI(ofi); sprintf(mdcbufr,"stack slices : %s",msg); return(mdcbufr); } if (ofi->planar == MDC_NO) { /* check for orthogonal slices */ switch (ofi->pat_slice_orient) { case MDC_SUPINE_HEADFIRST_SAGITTAL : case MDC_SUPINE_FEETFIRST_SAGITTAL : case MDC_PRONE_HEADFIRST_SAGITTAL : case MDC_PRONE_FEETFIRST_SAGITTAL : case MDC_SUPINE_HEADFIRST_CORONAL : case MDC_SUPINE_FEETFIRST_CORONAL : case MDC_PRONE_HEADFIRST_CORONAL : case MDC_PRONE_FEETFIRST_CORONAL : case MDC_SUPINE_HEADFIRST_TRANSAXIAL : case MDC_SUPINE_FEETFIRST_TRANSAXIAL : case MDC_PRONE_HEADFIRST_TRANSAXIAL : case MDC_PRONE_FEETFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL : case MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL : case MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL : case MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL : case MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL : case MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL : case MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL : break; default: MdcPrntWarn("stack slices : Probably file with Non-Orthogonal slices"); } } /* correct slice_spacing */ for (i=1; iimage[i]; id2 = &ofi->image[i-1]; id1->slice_spacing=MdcGetNormSliceSpacing(id1,id2); } /* and also for the first image */ if (nr_of_images > 1) { ofi->image[0].slice_spacing = ofi->image[1].slice_spacing; } /* apply read options */ msg = MdcApplyReadOptions(ofi); if (msg != NULL) { MdcCleanUpFI(ofi); sprintf(mdcbufr,"stack slices : %s",msg); return(mdcbufr); } /* if requested, reverse slices */ if (MDC_SORT_REVERSE == MDC_YES) { msg = MdcSortReverse(ofi); if (msg != NULL) { MdcCleanUpFI(ofi); sprintf(mdcbufr,"stack slices : %s",msg); return(mdcbufr); } } /* write the file */ if (total[MDC_CONVS] > 0) { /* go through conversion formats */ for (c=1; c 0) { if (MdcWriteFile(ofi, c, mdc_nrstack++, NULL) != MDC_OK) { MdcCleanUpFI(ofi); return("stack slices : Failure to write file"); } } } } MdcCleanUpFI(ofi); return(NULL); } /* tomo : stack volumes at different time frames into one 4D file (3D+ -> 4D)*/ /* planar: stack planar dynamic files into one planar dynamic file */ char *MdcStackFrames(void) { FILEINFO *ifi, *ofi; Uint32 d, nr_of_frames, nr_of_images=0; char *msg = NULL; int *total = mdc_arg_total; /* total arguments of files & conversions */ int *convs = mdc_arg_convs; /* counter for each conversion format */ char **files = mdc_arg_files; /* array of pointers to input filenames */ int i, j, f, convert, c; ifi = &infi; ofi = &outfi; /* initialize output FILEINFO */ MdcInitFI(ofi,"stack4d"); nr_of_frames = total[MDC_FILES]; for (i=0, j=0, f=0; f < total[MDC_FILES]; f++) { /* open file */ if (MdcOpenFile(ifi,files[f]) != MDC_OK) { MdcCleanUpFI(ofi); return("stack frames : Failure to open file"); } /* read the file */ if (MdcReadFile(ifi,f,NULL) != MDC_OK) { MdcCleanUpFI(ofi); MdcCleanUpFI(ifi); return("stack frames : Failure to read file"); } MdcCloseFile(ifi->ifp); /* no further need */ /* sanity checks */ for (d=4; ddim[d] > 1) { MdcCleanUpFI(ofi); MdcCleanUpFI(ifi); return("stack frames : Only tomo volumes or planar dynamic supported"); } if ((ifi->dim[3] == 1) && (ifi->planar == MDC_NO)) { MdcCleanUpFI(ofi); MdcCleanUpFI(ifi); return("stack frames : Use option '-stacks' for single slice files"); } if (ifi->dim[3] == 0) { MdcCleanUpFI(ofi); MdcCleanUpFI(ifi); return("stack frames : File without images found"); } if (f == 0) { /* copy FILEINFO stuff from 1st file */ MdcCopyFI(ofi,ifi,MDC_NO,MDC_NO); /* 4D -> dynamic */ ofi->acquisition_type = MDC_ACQUISITION_DYNAMIC; /* get appropriate structs */ if (!MdcGetStructDD(ofi,nr_of_frames)) { MdcCleanUpFI(ofi); MdcCleanUpFI(ifi); return("stack frames : Couldn't alloc output DYNAMIC_DATA structs"); } /* set some specific parameters */ if (ofi->planar == MDC_YES) { /* planar: asymmetric */ nr_of_images= ifi->number; /* increment */ ofi->dim[0] = 3; ofi->dim[1] = ifi->dim[1]; ofi->dim[2] = ifi->dim[2]; ofi->dim[3] = nr_of_images; ofi->pixdim[0] = 3.; ofi->pixdim[1] = ifi->pixdim[1]; ofi->pixdim[2] = ifi->pixdim[2]; ofi->pixdim[3] = ifi->pixdim[3]; }else{ /* tomo : symmectric */ nr_of_images= ifi->number * nr_of_frames; ofi->dim[0] = 4; ofi->dim[1] = ifi->dim[1]; ofi->dim[2] = ifi->dim[2]; ofi->dim[3] = ifi->dim[3]; ofi->dim[4] = nr_of_frames; ofi->pixdim[0] = 4.; ofi->pixdim[1] = ifi->pixdim[1]; ofi->pixdim[2] = ifi->pixdim[2]; ofi->pixdim[3] = ifi->pixdim[3]; ofi->pixdim[4] = ofi->dyndata[0].time_frame_duration; /* tomo */ } /* malloc all IMG_DATA structs */ if (!MdcGetStructID(ofi,nr_of_images)) { MdcCleanUpFI(ofi); MdcCleanUpFI(ifi); return("stack frames : Couldn't alloc output IMG_DATA structs"); } }else{ if (ofi->planar == MDC_YES) { nr_of_images += ifi->number; ofi->dim[3] = nr_of_images; /* malloc IMG_DATA structs current frame */ if (!MdcGetStructID(ofi,nr_of_images)) { MdcCleanUpFI(ofi); MdcCleanUpFI(ifi); return("stack frames : Couldn't alloc planar IMG_DATA structs"); } } /* copy DYNAMIC_DATA struct when available */ /* f=0 already copied at initial MdcCopyFI() */ if ((ifi->dynnr > 0) && (ifi->dyndata != NULL)) { MdcCopyDD(&ofi->dyndata[f],&ifi->dyndata[0]); } /* suspectable differences */ if (ifi->pat_slice_orient != ofi->pat_slice_orient) { MdcPrntWarn("stack frames : Different 'patient_slice_orient' found"); } if (ifi->planar != ofi->planar) { MdcCleanUpFI(ofi); MdcCleanUpFI(ifi); return("stack frames : wrongful mixture of tomo and planar frames"); } } for (i=0; idim[3]; i++, j++) { /* copy IMG_DATA info */ msg = MdcCopyID(&ofi->image[j],&ifi->image[i],MDC_YES); if (msg != NULL) { MdcCleanUpFI(ofi); MdcCleanUpFI(ifi); sprintf(mdcbufr,"stack frames : %s",msg); return(mdcbufr); } } MdcCleanUpFI(ifi); } /* check all the images */ msg = MdcImagesPixelFiddle(ofi); if (msg != NULL) { MdcCleanUpFI(ofi); sprintf(mdcbufr,"stack frames : %s",msg); return(mdcbufr); } if (ofi->planar == MDC_NO) { /* check for orthogonal slices */ switch (ofi->pat_slice_orient) { case MDC_SUPINE_HEADFIRST_SAGITTAL : case MDC_SUPINE_FEETFIRST_SAGITTAL : case MDC_PRONE_HEADFIRST_SAGITTAL : case MDC_PRONE_FEETFIRST_SAGITTAL : case MDC_SUPINE_HEADFIRST_CORONAL : case MDC_SUPINE_FEETFIRST_CORONAL : case MDC_PRONE_HEADFIRST_CORONAL : case MDC_PRONE_FEETFIRST_CORONAL : case MDC_SUPINE_HEADFIRST_TRANSAXIAL : case MDC_SUPINE_FEETFIRST_TRANSAXIAL : case MDC_PRONE_HEADFIRST_TRANSAXIAL : case MDC_PRONE_FEETFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL : case MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL : case MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL : case MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL : case MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL : case MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL : case MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL : break; default: MdcPrntWarn("stack frames : Probably file with Non-Orthogonal slices"); } } /* apply read options */ msg = MdcApplyReadOptions(ofi); if (msg != NULL) { MdcCleanUpFI(ofi); sprintf(mdcbufr,"stack frames : %s",msg); return(mdcbufr); } /* write the file */ if (total[MDC_CONVS] > 0) { /* go through conversion formats */ for (c=1; c 0) { if (MdcWriteFile(ofi, c, mdc_nrstack++, NULL) != MDC_OK) { MdcCleanUpFI(ofi); return("stack frames : Failure to write file"); } } } } MdcCleanUpFI(ofi); return(NULL); } char *MdcStackFiles(Int8 stack) { char *msg=NULL; if (MDC_CONVERT != MDC_YES) return("In order to stack specify an output format"); if (mdc_arg_total[MDC_FILES] == 1) return("In order to stack at least two files are required"); switch (stack) { case MDC_STACK_SLICES: msg = MdcStackSlices(); break; case MDC_STACK_FRAMES: msg = MdcStackFrames(); break; } return(msg); } xmedcon-0.14.1/source/xzoom.h0000644000175000017510000000401112636253503013002 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xzoom.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xzoom.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xzoom.h,v 1.16 2015/12/22 13:59:31 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XZOOM_H__ #define __XZOOM_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcImagesZoomIn(GtkWidget *window); void XMdcImagesZoomOut(GtkWidget *window); gboolean XMdcImagesZoomCallbackClicked(GtkWidget *widget, GdkEventButton *button,GtkWidget *window); void XMdcImagesZoom(GtkWidget *widget, Uint32 nr); #endif xmedcon-0.14.1/source/xlabels.c0000644000175000017510000004427212636253502013267 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xlabels.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : label routines * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcGetEcatLabelNumbers() - Get ECAT label numbers * * XMdcGetImageLabelIndex() - Get image label index * * XMdcGetImageLabelTimes() - Get image label times * * XMdcPrintImageLabelIndex() - Print index labels * * XMdcPrintImageLabelTimes() - Print times labels * * XMdcLabelSelCallbackApply() - Label Apply callback * * XMdcUnsensitiveColNumFrames() - Set frames unusable * * XMdcSensitiveColNumFrames() - Set frames usable * * XMdcLabelSel() - Label selection * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xlabels.c,v 1.31 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "xmedcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ static GtkWidget *wlabel = NULL; static GtkWidget *colFrame = NULL, *numFrame = NULL; /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcGetEcatLabelNumbers(Uint32 realnumber, Uint32 *plane, Uint32 *frame, Uint32 *gate, Uint32 *bed) { /* realnumber = absolute image number, 0-based */ /* fi->number = total number images , 1-based */ /* fi->dim[3] = number of planes , 1-based */ /* fi->dim[4] = number of frames , 1-based */ /* fi->dim[5] = number of gates , 1-based */ /* fi->dim[6] = number of beds , 1-based */ Uint32 p, f, g, b; Uint32 images_in_frame, images_in_gate, images_in_bed; images_in_bed = my.fi->number / my.fi->dim[6]; images_in_gate = images_in_bed / my.fi->dim[5]; images_in_frame = images_in_gate / my.fi->dim[4]; b = realnumber / images_in_bed; /* bed NR */ *bed = b; /* keep 0-based */ g = (realnumber / images_in_gate) % my.fi->dim[5]; /* gate NR */ *gate = g+1; /* make 1-based */ f = (realnumber / images_in_frame) % my.fi->dim[4]; /* frame NR */ *frame = f+1; /* make 1-based */ p = (realnumber % images_in_frame); /* plane NR */ *plane = p+1; /* make 1-based */ } char *XMdcGetImageLabelIndex(Uint32 nr) { switch (sLabelSelection.CurStyle) { case XMDC_LABEL_STYLE_ABS : sprintf(labelindex,"%u",my.realnumber[nr]+1); break; case XMDC_LABEL_STYLE_PAGE: sprintf(labelindex,"%u",nr+1); break; case XMDC_LABEL_STYLE_ECAT: { Uint32 p, f, g, b; XMdcGetEcatLabelNumbers(my.realnumber[nr],&p,&f,&g,&b); sprintf(labelindex,"%u.%u.%u.%u.%u",f,p,g,0,b); /* date = 0 default */ } break; } return(labelindex); } char *XMdcGetImageLabelTimes(Uint32 nr) { IMG_DATA *id; Uint32 i, f; float duration; char s[10], d[10]; if (my.fi->dynnr == 0) { labeltimes[0]='\0'; return(labeltimes); } i = my.realnumber[nr]; id = &my.fi->image[i]; f = id->frame_number; duration = MdcSingleImageDuration(my.fi,f-1); strncpy(s,MdcGetStrHHMMSS(id->slice_start),10); s[9]='\0'; strncpy(d,MdcGetStrHHMMSS(duration),10); d[9]='\0'; sprintf(labeltimes,"%u S=%s D=%s",f,s,d); return(labeltimes); } void XMdcPrintImageLabelIndex(GtkWidget *widget, Uint32 nr) { GdkColormap *map = gtk_widget_get_colormap(widget); char *label; /* first, create a GC to draw on */ sLabelSelection.gc = gdk_gc_new(widget->window); switch (sLabelSelection.CurColor) { case XMDC_LABEL_RED : sLabelSelection.color = &Red; break; case XMDC_LABEL_GREEN : sLabelSelection.color = &Green; break; case XMDC_LABEL_BLUE : sLabelSelection.color = &Blue; break; case XMDC_LABEL_YELLOW: sLabelSelection.color = &Yellow; break; } /* set the foreground to our color */ gdk_colormap_alloc_color(map,sLabelSelection.color, FALSE, TRUE); gdk_gc_set_foreground(sLabelSelection.gc, sLabelSelection.color); label=XMdcGetImageLabelIndex(nr); gdk_draw_string(widget->window, sfixed, sLabelSelection.gc , 2, (gint)(XMdcScaleH(my.fi->mheight)-2), label); gdk_colormap_free_colors(map,sLabelSelection.color,1); gdk_gc_destroy(sLabelSelection.gc); } void XMdcPrintImageLabelTimes(GtkWidget *widget, Uint32 nr) { GdkColormap *map = gtk_widget_get_colormap(widget); char *label; /* first, create a GC to draw on */ sLabelSelection.gc = gdk_gc_new(widget->window); switch (sLabelSelection.CurColor) { case XMDC_LABEL_RED : sLabelSelection.color = &Red; break; case XMDC_LABEL_GREEN : sLabelSelection.color = &Green; break; case XMDC_LABEL_BLUE : sLabelSelection.color = &Blue; break; case XMDC_LABEL_YELLOW: sLabelSelection.color = &Yellow; break; } /* set the foreground to our color */ gdk_colormap_alloc_color(map,sLabelSelection.color, FALSE, TRUE); gdk_gc_set_foreground(sLabelSelection.gc, sLabelSelection.color); label=XMdcGetImageLabelTimes(nr); gdk_draw_string(widget->window, sfixed, sLabelSelection.gc, 2, 10, label); gdk_colormap_free_colors(map,sLabelSelection.color,1); gdk_gc_destroy(sLabelSelection.gc); } void XMdcLabelSelCallbackApply(GtkWidget *widget, gpointer data) { gint color=XMDC_LABEL_YELLOW, state=MDC_YES, style=XMDC_LABEL_STYLE_PAGE; if (GTK_TOGGLE_BUTTON(sLabelSelection.On)->active) { MdcDebugPrint("labels: ON "); state = MDC_YES; }else if (GTK_TOGGLE_BUTTON(sLabelSelection.Off)->active) { MdcDebugPrint("labels: OFF "); state = MDC_NO; } MdcDebugPrint("label color: "); if (GTK_TOGGLE_BUTTON(sLabelSelection.Red)->active) { MdcDebugPrint("\tred"); color = XMDC_LABEL_RED; }else if (GTK_TOGGLE_BUTTON(sLabelSelection.Green)->active) { MdcDebugPrint("\tgreen"); color = XMDC_LABEL_GREEN; }else if (GTK_TOGGLE_BUTTON(sLabelSelection.Blue)->active) { MdcDebugPrint("\tblue"); color = XMDC_LABEL_BLUE; }else if (GTK_TOGGLE_BUTTON(sLabelSelection.Yellow)->active) { MdcDebugPrint("\tyellow"); color = XMDC_LABEL_YELLOW; } MdcDebugPrint("label number: "); if (GTK_TOGGLE_BUTTON(sLabelSelection.NrAbsolute)->active) { MdcDebugPrint("\tabsolute"); style = XMDC_LABEL_STYLE_ABS; }else if (GTK_TOGGLE_BUTTON(sLabelSelection.NrInPage)->active) { MdcDebugPrint("\tin page"); style = XMDC_LABEL_STYLE_PAGE; }else if (GTK_TOGGLE_BUTTON(sLabelSelection.NrEcat)->active) { MdcDebugPrint("\tecat"); style = XMDC_LABEL_STYLE_ECAT; } if (state!=sLabelSelection.CurState || color!=sLabelSelection.CurColor || style!=sLabelSelection.CurStyle) { sLabelSelection.CurState = state; sLabelSelection.CurColor = color; sLabelSelection.CurStyle = style; } /* MARK: need some kind of refresh signal here */ XMdcMainWidgetsInsensitive(); XMdcMainWidgetsResensitive(); } void XMdcSensitiveColNumFrames(GtkWidget *widget, gpointer data) { gtk_widget_set_sensitive(GTK_WIDGET(colFrame),TRUE); gtk_widget_set_sensitive(GTK_WIDGET(numFrame),TRUE); } void XMdcUnsensitiveColNumFrames(GtkWidget *widget, gpointer data) { gtk_widget_set_sensitive(GTK_WIDGET(colFrame),FALSE); gtk_widget_set_sensitive(GTK_WIDGET(numFrame),FALSE); } void XMdcLabelSel(void) { GtkWidget *box1; GtkWidget *box2; GtkWidget *box3; GtkWidget *box4; GtkWidget *frame; GtkWidget *button; GtkWidget *separator; GSList *group; if (wlabel == NULL) { wlabel = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_signal_connect(GTK_OBJECT(wlabel),"destroy", GTK_SIGNAL_FUNC(XMdcMedconQuit), NULL); gtk_signal_connect(GTK_OBJECT(wlabel),"delete_event", GTK_SIGNAL_FUNC(XMdcHandlerToHide), NULL); gtk_window_set_title(GTK_WINDOW(wlabel),"Label Selection"); gtk_container_set_border_width(GTK_CONTAINER(wlabel),0); box1 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(wlabel),box1); gtk_widget_show(box1); /* create upper box - label */ box2 = gtk_vbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(box1),box2,TRUE,TRUE,0); gtk_container_set_border_width(GTK_CONTAINER(box2), 5); gtk_widget_show(box2); box3 = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(box2),box3,TRUE,TRUE,0); gtk_widget_show(box3); /* create label ON/OFF frame */ frame = gtk_frame_new("Label"); gtk_box_pack_start(GTK_BOX(box3),frame,TRUE,TRUE,0); gtk_widget_show(frame); box4 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),box4); gtk_container_set_border_width(GTK_CONTAINER(box4),5); gtk_widget_show(box4); /* create radiobuttons */ button = gtk_radio_button_new_with_label(NULL,"ON"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); if (sLabelSelection.CurState == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); #ifdef GTKONE gtk_signal_connect(GTK_OBJECT(button),"button-release-event", GTK_SIGNAL_FUNC(XMdcSensitiveColNumFrames),NULL); #else gtk_signal_connect(GTK_OBJECT(button),"toggled", GTK_SIGNAL_FUNC(XMdcSensitiveColNumFrames),NULL); #endif gtk_widget_show(button); sLabelSelection.On = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"OFF"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); if (sLabelSelection.CurState == MDC_NO) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); #ifdef GTKONE gtk_signal_connect(GTK_OBJECT(button),"button-release-event", GTK_SIGNAL_FUNC(XMdcUnsensitiveColNumFrames),NULL); #else gtk_signal_connect(GTK_OBJECT(button),"toggled", GTK_SIGNAL_FUNC(XMdcUnsensitiveColNumFrames),NULL); #endif gtk_widget_show(button); sLabelSelection.Off = button; /* create label colors frame */ frame = gtk_frame_new("Color"); colFrame = frame; gtk_box_pack_start(GTK_BOX(box3),frame,TRUE,TRUE,0); gtk_widget_show(frame); box4 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),box4); gtk_container_set_border_width(GTK_CONTAINER(box4), 10); gtk_widget_show(box4); /* create radiobuttons */ button = gtk_radio_button_new_with_label(NULL,"Red"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); if (sLabelSelection.CurColor == XMDC_LABEL_RED) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sLabelSelection.Red = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"Green"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); if (sLabelSelection.CurColor == XMDC_LABEL_GREEN) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sLabelSelection.Green = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"Blue"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); if (sLabelSelection.CurColor == XMDC_LABEL_BLUE) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sLabelSelection.Blue = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"Yellow"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); if (sLabelSelection.CurColor == XMDC_LABEL_YELLOW) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sLabelSelection.Yellow = button; /* create label style frame */ frame = gtk_frame_new("Numbering"); numFrame = frame; gtk_box_pack_start(GTK_BOX(box3),frame,TRUE,TRUE,0); gtk_widget_show(frame); box4 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),box4); gtk_container_set_border_width(GTK_CONTAINER(box4), 10); gtk_widget_show(box4); /* create radiobuttons */ button = gtk_radio_button_new_with_label(NULL,"Absolute"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); if (sLabelSelection.CurStyle == XMDC_LABEL_STYLE_ABS) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sLabelSelection.NrAbsolute = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"In Page"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); if (sLabelSelection.CurStyle == XMDC_LABEL_STYLE_PAGE) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sLabelSelection.NrInPage = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"Ecat/Matrix"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); if (sLabelSelection.CurStyle == XMDC_LABEL_STYLE_ECAT) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sLabelSelection.NrEcat = button; /* create horizontal separator */ separator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(box1),separator, FALSE, FALSE, 0); gtk_widget_show(separator); /* create bottom button box */ box2 = gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(box1),box2,TRUE,TRUE,2); gtk_widget_show(box2); button = gtk_button_new_with_label("Apply"); gtk_box_pack_start(GTK_BOX(box2),button,TRUE,TRUE,2); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(wlabel)); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcLabelSelCallbackApply), NULL); gtk_widget_show(button); button = gtk_button_new_with_label("Cancel"); gtk_box_pack_start(GTK_BOX(box2),button,TRUE,TRUE,2); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide),GTK_OBJECT(wlabel)); gtk_widget_show(button); }else{ /* set buttons to appropriate state */ GtkWidget *b1, *b2, *b3, *b4; gtk_widget_hide(wlabel); b1 = sLabelSelection.On; b2 = sLabelSelection.Off; if (sLabelSelection.CurState == MDC_YES) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),TRUE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),FALSE); }else{ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),TRUE); } b1 = sLabelSelection.Red; b2 = sLabelSelection.Green; b3 = sLabelSelection.Blue; b4 = sLabelSelection.Yellow; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b4),FALSE); switch (sLabelSelection.CurColor) { case XMDC_LABEL_RED : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),TRUE); break; case XMDC_LABEL_GREEN : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),TRUE); break; case XMDC_LABEL_BLUE : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3),TRUE); break; case XMDC_LABEL_YELLOW: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b4),TRUE); break; } b1 = sLabelSelection.NrAbsolute; b2 = sLabelSelection.NrInPage; b3 = sLabelSelection.NrEcat; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3),FALSE); switch (sLabelSelection.CurStyle) { case XMDC_LABEL_STYLE_ABS : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),TRUE); break; case XMDC_LABEL_STYLE_PAGE: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),TRUE); break; case XMDC_LABEL_STYLE_ECAT: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3),TRUE); break; } } if (sLabelSelection.CurState == MDC_NO) { XMdcUnsensitiveColNumFrames(NULL,NULL); }else{ XMdcSensitiveColNumFrames(NULL,NULL); } XMdcShowWidget(wlabel); } xmedcon-0.14.1/source/xcolmap.c0000644000175000017510000005015612636253502013276 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xcolmap.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : colormap changing * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcRemovePreviousColorMap() - Hide previous colormap * * XMdcApplyNewColorMap() - Apply new selected map * * XMdcColorMapCallbackClicked() - Clicked colormap * * XMdcColorMapSelCallbackApply() - Apply callback * * XMdcColorMapSel() - Select map & colors * * XMdcColorMapCallbackExpose() - Expose callback * * XMdcApplyMapPlace() - Apply new placement * * XMdcMapPlaceSel() - Select map placement * * XMdcMapPlaceSelCallbackApply() - Apply place selection * * XMdcBuildColorMap() - Build the colormap * * XMdcLoadLUT() - Load the LUT file * * XMdcChangeLUT() - Load another LUT file * * XMdcMapNotAllowed() - Not allowed on colorfile* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xcolmap.c,v 1.39 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "xmedcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ static GtkWidget *wcolor=NULL; static GtkWidget *wplace=NULL; Uint8 XMDC_CMAP_PLACE = MDC_RIGHT; /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcRemovePreviousColorMap(void) { g_object_unref(my.imcmap); } void XMdcApplyNewColorMap(int map) { gtk_widget_set_sensitive(my.viewwindow,FALSE); XMdcRemovePreviousColorMap(); XMdcRemovePreviousImages(); XMdcColorMapReset(map); XMdcBuildColorMap(); XMdcBuildCurrentImages(); gtk_widget_set_sensitive(my.viewwindow,TRUE); } gboolean XMdcColorMapCallbackClicked(GtkWidget *widget, GdkEventButton *button, gpointer data) { if (button->button == 1) { /* select color map */ XMdcColorMapSel(); } if (button->button == 2) { /* select color map */ XMdcColorMapSel(); } if (button->button == 3) { /* placement color map */ XMdcMapPlaceSel(); } return(TRUE); } void XMdcColorMapSelCallbackApply (GtkWidget *widget, gpointer data) { gint map=MDC_MAP_GRAY; if (XMdcMapNotAllowed() == TRUE) return; MdcDebugPrint("colormap type: "); if (GTK_TOGGLE_BUTTON(sColormapSelection.Gray)->active) { MdcDebugPrint("\tgray normal"); map = MDC_MAP_GRAY; }else if (GTK_TOGGLE_BUTTON(sColormapSelection.Inverted)->active) { MdcDebugPrint("\tgray invers"); map = MDC_MAP_INVERTED; }else if (GTK_TOGGLE_BUTTON(sColormapSelection.Rainbow)->active) { MdcDebugPrint("\trainbow"); map = MDC_MAP_RAINBOW; }else if (GTK_TOGGLE_BUTTON(sColormapSelection.Combined)->active) { MdcDebugPrint("\tcombined"); map = MDC_MAP_COMBINED; }else if (GTK_TOGGLE_BUTTON(sColormapSelection.Hotmetal)->active) { MdcDebugPrint("\thotmetal"); map = MDC_MAP_HOTMETAL; }else if (GTK_TOGGLE_BUTTON(sColormapSelection.Loaded)->active) { MdcDebugPrint("\tloaded"); map = MDC_MAP_LOADED; } if (map == MDC_MAP_LOADED) { XMdcLutSelOpen(NULL,NULL); return; } if (map != sColormapSelection.CurMap) { sColormapSelection.CurMap = map; MDC_COLOR_MAP = map; if (XMDC_FILE_OPEN == MDC_YES) XMdcApplyNewColorMap(map); else XMdcColorMapReset(map); } } gboolean XMdcColorMapSel(void) { GtkWidget *box1; GtkWidget *box2; GtkWidget *box3; GtkWidget *box4; GtkWidget *frame; GtkWidget *button; GtkWidget *separator; GSList *group; if (XMdcMapNotAllowed() == TRUE) return(TRUE); if (wcolor == NULL) { wcolor = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_signal_connect(GTK_OBJECT(wcolor),"destroy", GTK_SIGNAL_FUNC(XMdcMedconQuit),NULL); gtk_signal_connect(GTK_OBJECT(wcolor),"delete_event", GTK_SIGNAL_FUNC(XMdcHandlerToHide),NULL); gtk_window_set_title(GTK_WINDOW(wcolor),"Palette Selection"); gtk_container_set_border_width (GTK_CONTAINER (wcolor), 0); box1 = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (wcolor), box1); gtk_widget_show(box1); /* create upper box - colormap */ box2 = gtk_vbox_new (FALSE, 5); gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER(box2), 5); gtk_widget_show(box2); box3 = gtk_hbox_new (FALSE, 5); gtk_box_pack_start(GTK_BOX(box2), box3, TRUE, TRUE, 0); gtk_widget_show(box3); /* create colormap frame */ frame = gtk_frame_new("Color Map"); gtk_box_pack_start(GTK_BOX (box3), frame, TRUE, TRUE, 0); gtk_widget_show(frame); box4 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), box4); gtk_container_set_border_width(GTK_CONTAINER(box4), 5); gtk_widget_show(box4); /* create radiobuttons */ button = gtk_radio_button_new_with_label (NULL, "Gray Normal"); gtk_box_pack_start (GTK_BOX (box4), button, TRUE, TRUE, 0); if (sColormapSelection.CurMap == MDC_MAP_GRAY) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_widget_show (button); sColormapSelection.Gray = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group, "Gray Invers"); gtk_box_pack_start (GTK_BOX (box4), button, TRUE, TRUE, 0); if (sColormapSelection.CurMap == MDC_MAP_INVERTED) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_widget_show (button); sColormapSelection.Inverted = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group, "Rainbow"); gtk_box_pack_start (GTK_BOX (box4), button, TRUE, TRUE, 0); if (sColormapSelection.CurMap == MDC_MAP_RAINBOW) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_widget_show (button); sColormapSelection.Rainbow = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group, "Combined"); gtk_box_pack_start (GTK_BOX (box4), button, TRUE, TRUE, 0); if (sColormapSelection.CurMap == MDC_MAP_COMBINED) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_widget_show (button); sColormapSelection.Combined = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group, "Hotmetal"); gtk_box_pack_start (GTK_BOX (box4), button, TRUE, TRUE, 0); if (sColormapSelection.CurMap == MDC_MAP_HOTMETAL) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_widget_show (button); sColormapSelection.Hotmetal = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group, "LUT loaded ..."); gtk_box_pack_start (GTK_BOX (box4), button, TRUE, TRUE, 0); if (sColormapSelection.CurMap == MDC_MAP_LOADED) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_widget_show (button); sColormapSelection.Loaded = button; /* create horizontal separator */ separator = gtk_hseparator_new (); gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, FALSE, 0); gtk_widget_show (separator); /* create bottom button box */ box2 = gtk_hbox_new (FALSE, 0); gtk_box_pack_start(GTK_BOX(box1), box2, TRUE, TRUE, 2); gtk_widget_show(box2); button = gtk_button_new_with_label("Apply"); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 2); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide),GTK_OBJECT(wcolor)); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcColorMapSelCallbackApply), NULL); gtk_widget_show(button); button = gtk_button_new_with_label ("Cancel"); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 2); gtk_signal_connect_object(GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide),GTK_OBJECT(wcolor)); gtk_widget_show(button); }else{ /* set buttons to appropriate state */ GtkWidget *b1, *b2, *b3, *b4, *b5, *b6; gtk_widget_hide(wcolor); b1 = sColormapSelection.Gray; b2 = sColormapSelection.Inverted; b3 = sColormapSelection.Rainbow; b4 = sColormapSelection.Combined; b5 = sColormapSelection.Hotmetal; b6 = sColormapSelection.Loaded; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b4),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b5),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b6),FALSE); switch (sColormapSelection.CurMap) { case MDC_MAP_GRAY : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),TRUE); break; case MDC_MAP_INVERTED: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),TRUE); break; case MDC_MAP_RAINBOW : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3),TRUE); break; case MDC_MAP_COMBINED: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b4),TRUE); break; case MDC_MAP_HOTMETAL: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b5),TRUE); break; case MDC_MAP_LOADED: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b6),TRUE); } } XMdcShowWidget(wcolor); return(TRUE); } gboolean XMdcColorMapCallbackExpose(GtkWidget *widget,GdkEventExpose *event,gpointer data) { GdkGC *gc = widget->style->white_gc; gint /*w,*/ h; gdk_window_set_back_pixmap(widget->window, NULL, FALSE); /*w = my.cmap_w;*/ h = my.cmap_h; gdk_pixbuf_render_to_drawable(my.imcmap,widget->window,gc, 0,0,0,0,25,h, sRenderSelection.Dither,0,0); return(TRUE); } void XMdcApplyMapPlace(int place) { GtkWidget *parent=NULL; if (XMDC_FILE_OPEN == MDC_YES) { parent = my.cmapbox->parent; switch (place) { case MDC_LEFT : gtk_box_reorder_child(GTK_BOX(parent),my.cmapbox,0); gtk_box_reorder_child(GTK_BOX(parent),my.imgsbox,2); break; case MDC_RIGHT: gtk_box_reorder_child(GTK_BOX(parent),my.cmapbox,2); gtk_box_reorder_child(GTK_BOX(parent),my.imgsbox,0); break; } } } void XMdcMapPlaceSelCallbackApply (GtkWidget *widget, gpointer data) { MdcDebugPrint("colormap location: "); if (GTK_TOGGLE_BUTTON(sMapPlaceSelection.Left)->active) { MdcDebugPrint("\tleft"); XMDC_CMAP_PLACE = MDC_LEFT; }else if (GTK_TOGGLE_BUTTON(sMapPlaceSelection.Right)->active) { MdcDebugPrint("\tright"); XMDC_CMAP_PLACE = MDC_RIGHT; } XMdcApplyMapPlace(XMDC_CMAP_PLACE); } gboolean XMdcMapPlaceSel(void) { GtkWidget *box1; GtkWidget *box2; GtkWidget *box3; GtkWidget *box4; GtkWidget *frame; GtkWidget *button; GtkWidget *separator; GSList *group; if (wplace == NULL) { wplace = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_signal_connect(GTK_OBJECT(wplace),"destroy", GTK_SIGNAL_FUNC(XMdcMedconQuit),NULL); gtk_signal_connect(GTK_OBJECT(wplace),"delete_event", GTK_SIGNAL_FUNC(XMdcHandlerToHide),NULL); gtk_window_set_title(GTK_WINDOW(wplace),"Placement Selection"); gtk_container_set_border_width (GTK_CONTAINER (wplace), 0); box1 = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (wplace), box1); gtk_widget_show(box1); /* create upper box - placement */ box2 = gtk_vbox_new (FALSE, 5); gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER(box2), 5); gtk_widget_show(box2); box3 = gtk_hbox_new (FALSE, 5); gtk_box_pack_start(GTK_BOX(box2), box3, TRUE, TRUE, 0); gtk_widget_show(box3); /* create placement frame */ frame = gtk_frame_new("Placement"); gtk_box_pack_start(GTK_BOX (box3), frame, TRUE, TRUE, 0); gtk_widget_show(frame); box4 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), box4); gtk_container_set_border_width(GTK_CONTAINER(box4), 5); gtk_widget_show(box4); /* create radiobuttons */ button = gtk_radio_button_new_with_label (NULL, "Left side"); gtk_box_pack_start (GTK_BOX (box4), button, TRUE, TRUE, 0); if (XMDC_CMAP_PLACE == MDC_LEFT) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_widget_show (button); sMapPlaceSelection.Left = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group, "Right side"); gtk_box_pack_start (GTK_BOX (box4), button, TRUE, TRUE, 0); if (XMDC_CMAP_PLACE == MDC_RIGHT) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); gtk_widget_show (button); sMapPlaceSelection.Right = button; /* create horizontal separator */ separator = gtk_hseparator_new (); gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, FALSE, 0); gtk_widget_show (separator); /* create bottom button box */ box2 = gtk_hbox_new (FALSE, 0); gtk_box_pack_start(GTK_BOX(box1), box2, TRUE, TRUE, 2); gtk_widget_show(box2); button = gtk_button_new_with_label("Apply"); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 2); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide),GTK_OBJECT(wplace)); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcMapPlaceSelCallbackApply), NULL); gtk_widget_show(button); button = gtk_button_new_with_label ("Cancel"); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 2); gtk_signal_connect_object(GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide),GTK_OBJECT(wplace)); gtk_widget_show(button); }else{ /* set buttons to appropriate state */ GtkWidget *b1, *b2; gtk_widget_hide(wplace); b1 = sMapPlaceSelection.Left; b2 = sMapPlaceSelection.Right; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),FALSE); switch (XMDC_CMAP_PLACE) { case MDC_LEFT : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),TRUE); break; case MDC_RIGHT: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),TRUE); break; } } XMdcShowWidget(wplace); return(TRUE); } void XMdcBuildColorMap(void) { Uint8 *imgRGB, rr, gg, bb; Uint32 pix, i, r, c; MdcDebugPrint("Building colormap ..."); imgRGB = (Uint8 *)malloc((unsigned)(my.cmap_w * my.cmap_h * 3)); if (imgRGB == NULL) XMdcDisplayFatalErr(MDC_BAD_ALLOC,"Couldn't alloc colormap imgRGB"); pix=0; i=0; for (r=my.cmap_h ; r>0; r--) { i = (255 * r) / my.cmap_h; for (c=0; cpalette[i * 3 + 0]; gg = my.fi->palette[i * 3 + 1]; bb = my.fi->palette[i * 3 + 2]; imgRGB[pix * 3 + 0] = sGbc.mod.vgbc[rr]; imgRGB[pix * 3 + 1] = sGbc.mod.vgbc[gg]; imgRGB[pix * 3 + 2] = sGbc.mod.vgbc[bb]; } } my.imcmap=gdk_pixbuf_new_from_data(imgRGB,GDK_COLORSPACE_RGB,FALSE,8 ,my.cmap_w,my.cmap_h,3*my.cmap_w ,XMdcFreeRGB,NULL); /* add the colormap image to page layout */ if (my.cmap == NULL ) { my.cmap = gtk_drawing_area_new(); gtk_widget_set_events(my.cmap, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK); gtk_container_add(GTK_CONTAINER(my.cmapbox), my.cmap); gtk_signal_connect(GTK_OBJECT(my.cmap),"button_press_event", GTK_SIGNAL_FUNC(XMdcColorMapCallbackClicked), NULL); gtk_signal_connect(GTK_OBJECT(my.cmap),"expose_event", GTK_SIGNAL_FUNC(XMdcColorMapCallbackExpose), NULL); } gtk_drawing_area_size(GTK_DRAWING_AREA(my.cmap), my.cmap_w, my.cmap_h); if (my.fi->type != COLRGB) gtk_widget_show(my.cmap); } int XMdcLoadLUT(const gchar *lutname) { if (MdcLoadLUT(lutname) == MDC_YES) { sColormapSelection.CurMap = MDC_MAP_LOADED; MDC_COLOR_MAP = MDC_MAP_LOADED; if (XMDC_FILE_OPEN == MDC_YES) XMdcApplyNewColorMap(MDC_COLOR_MAP); }else{ /* XMdcDisplayWarn("Couldn't load specified LUT file");*/ return(MDC_NO); } return(MDC_YES); } gboolean XMdcChangeLUT(GtkWidget *spinner, gpointer data) { int nr; gchar lutname[10]; GtkSpinButton *spin = GTK_SPIN_BUTTON(spinner); if (XMdcMapNotAllowed() == MDC_YES) return(TRUE); nr = gtk_spin_button_get_value_as_int(spin); if (nr == sColormapSelection.Nr) return(TRUE); /* make appropriate path name */ sprintf(lutname,"ct%03d.lut",nr); if (XMEDCONLUT != NULL) { strncpy(xmdcstr,XMEDCONLUT,MDC_1KB_OFFSET); xmdcstr[strlen(xmdcstr)]='\0'; if (xmdcstr[strlen(xmdcstr)-1] != MDC_PATH_DELIM_CHR) strcat(xmdcstr,MDC_PATH_DELIM_STR); }else{ /* installation dir */ strncpy(xmdcstr,XMDCLUT,MDC_1KB_OFFSET); xmdcstr[strlen(xmdcstr)]='\0'; } sprintf(lutname,"ct%03d.lut",nr); strcat(xmdcstr,lutname); if (XMdcLoadLUT(xmdcstr) == MDC_YES) { /* set to new LUT number */ sColormapSelection.Nr = nr; } gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinner) ,(gfloat)sColormapSelection.Nr); return(TRUE); } /* prevent gray maps on colored images */ gboolean XMdcMapNotAllowed(void) { /* no file opened, can select grayscale colormap */ if (XMDC_FILE_OPEN == MDC_NO) return(FALSE); /* no grayscale colormap selection for colored files */ if ((MDC_MAKE_GRAY == MDC_NO) && (my.fi->map == MDC_MAP_PRESENT)) { XMdcDisplayWarn("Grayscale tables not available for colored images.\n"\ "Otherwise force remap to grayscale in\n"\ "Options || MedCon || Slices"); return(TRUE); } /* default allow grayscale colormap selection */ return(FALSE); } xmedcon-0.14.1/source/xerror.h0000644000175000017510000000443712636253502013162 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xerror.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xerror.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xerror.h,v 1.19 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XERROR_H__ #define __XERROR_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcFatalErrorKill(GtkWidget *button, int *code); void *XMdcDisplayDialog(int code, char *windowtitle, char *info); void *XMdcDisplayWarn(char *fmt, ...); void *XMdcDisplayMesg(char *fmt, ...); void *XMdcDisplayErr(char *fmt, ...); void XMdcDisplayFatalErr(int code, char *fmt, ...); void XMdcLogHandler(const gchar *domain, GLogLevelFlags level, const gchar *message, gpointer user_data); void XMdcCreateLogConsole(void); void XMdcShowLogConsole(void); void XMdcClearLogConsole(void); #endif xmedcon-0.14.1/source/m-progress.h0000644000175000017510000000345712636253502013740 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-progress.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-progress.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-progress.h,v 1.13 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_PROGRESS_H__ #define __M_PROGRESS_H__ #define MDC_PROGRESS_BEGIN 1 #define MDC_PROGRESS_SET 2 #define MDC_PROGRESS_INCR 3 #define MDC_PROGRESS_END 4 extern int MDC_PROGRESS; extern void (*MdcProgress)(int type, float value, char *label); #endif xmedcon-0.14.1/source/m-png.c0000644000175000017510000004545112636253502012653 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-png.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : read and write PNG files * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcPngErr() - PNG Error message routine * * MdcPngWarn() - PNG Warn message routine * * MdcCheckPNG() - Check for PNG format * * MdcReadPNG() - Read PNG format * * MdcWritePNG() - Write PNG format * * * * Notes : code fragments from 'example.c' included with PNG lib * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-png.c,v 1.45 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #include "medcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ /**************************************************************************** F U N C T I O N S ****************************************************************************/ static void MdcPngErr(png_structp png_ptr, png_const_charp error_msg) { MdcPrntWarn("PNG %s\n",error_msg); if (!png_ptr) return; longjmp(png_jmpbuf(png_ptr), 1); } static void MdcPngWarn(png_structp png_ptr, png_const_charp warning_msg) { if (!png_ptr) return; MdcPrntWarn("PNG %s\n",warning_msg); } int MdcCheckPNG(FILEINFO *fi) { unsigned char buf[MDC_PNG_BYTES_TO_CHECK]; /* read in some of the signature bytes */ if (fread(buf, 1, MDC_PNG_BYTES_TO_CHECK, fi->ifp) != MDC_PNG_BYTES_TO_CHECK) return(MDC_BAD_READ); /* compare the first MDC_PNG_BYTES_TO_CHECK bytes of the signature */ /* png_sig_cmp() returns zero if image is a PNG and nonzero if it isn't */ if (png_sig_cmp(buf,(png_size_t)0,MDC_PNG_BYTES_TO_CHECK)) return(MDC_FRMT_NONE); return(MDC_FRMT_PNG); } char *MdcReadPNG(FILEINFO *fi) { png_structp png_ptr; png_infop info_ptr; png_uint_32 width, height, rowbytes; png_colorp palette; png_bytepp row_pointers; Uint32 i, commentsize; int bit_depth, color_type, transform, num_palette; Uint8 *imgRGB, *pbuf; IMG_DATA *id; int num_text; png_textp text_ptr; if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Reading PNG:"); if (MDC_VERBOSE) MdcPrntMesg("PNG Reading <%s> ...",fi->ifname); /* put some defaults we use */ fi->endian = MDC_FILE_ENDIAN=MDC_BIG_ENDIAN; /* always for a PNG */ fi->dim[0] = 4; fi->dim[4]=1; /* Create and initialize the png_struct with the desired error handler */ /* functions. If you want to use the default stderr and longjump method, */ /* you can supply NULL for the last three parameters. We also supply the */ /* the compiler header file version, so that we know if the application */ /* was compiled with a compatible version of the library. REQUIRED */ png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING , NULL, MdcPngErr, MdcPngWarn); if (png_ptr == NULL) return("PNG Couldn't create read struct"); /* allocate/initialize the memory for image information. REQUIRED. */ info_ptr = png_create_info_struct(png_ptr); if (info_ptr == NULL) { png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL); return("PNG Couldn't create read info struct"); } /* Set error handling if you are using the setjmp/longjmp method (this is */ /* the normal method of doing things with libpng). REQUIRED unless you */ /* set up your own error handlers in the png_create_read_struct() earlier.*/ if (setjmp(png_jmpbuf(png_ptr))) { /* free all of the memory associated with the png_ptr and info_ptr */ png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); /* if we get here, we had a problem reading the file */ return("PNG Unexpected file reading error"); } /* I/O initialization with standard C streams */ png_init_io(png_ptr, fi->ifp); /* only allow 8bit or 24bit images */ transform = PNG_TRANSFORM_PACKING | PNG_TRANSFORM_STRIP_16 | PNG_TRANSFORM_STRIP_ALPHA; if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_SET,0.3,NULL); /* read image, the hilevel way */ png_read_png(png_ptr, info_ptr , transform, NULL); if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_SET,0.6,NULL); /* get image information */ width = png_get_image_width(png_ptr, info_ptr); height = png_get_image_height(png_ptr, info_ptr); bit_depth = png_get_bit_depth(png_ptr, info_ptr); color_type = png_get_color_type(png_ptr, info_ptr); if (png_get_valid(png_ptr, info_ptr, PNG_INFO_PLTE)) { png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette); } /* get comment */ png_get_text(png_ptr,info_ptr,&text_ptr,&num_text); if(num_text > 0) { commentsize = 1; for(i = 0; i < num_text; i++) commentsize += strlen(text_ptr[i].key) + 1 + text_ptr[i].text_length + 2; if ((fi->comment = malloc(commentsize)) == NULL) { MdcPngWarn(png_ptr,"PNG Can't malloc comment string"); }else{ fi->comment[0] = '\0'; for (i = 0; i < num_text; i++) { strcat(fi->comment, text_ptr[i].key); strcat(fi->comment, "::"); strcat(fi->comment, text_ptr[i].text); strcat(fi->comment, "\n"); } } } if (MDC_INFO) { MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("Short PNG Information (ver %s)\n",png_get_libpng_ver(png_ptr)); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("image width : %u\n",width); MdcPrntScrn("image height : %u\n",height); MdcPrntScrn("bit depth : %u\n",bit_depth); MdcPrntScrn("color type : %u\n",color_type); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("comment block :\n\n%s\n",fi->comment); MdcPrintLine('-',MDC_HALF_LENGTH); } /* preset FILEINFO info */ fi->mwidth = width; fi->mheight = height; fi->bits = 8; fi->type = BIT8_U; if (!MdcGetStructID(fi,1)) { png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); return("PNG Bad malloc IMG_DATA struct"); } id = (IMG_DATA *)&fi->image[0]; id->width = fi->mwidth; id->height= fi->mheight; id->bits = fi->bits; id->type = fi->type; id->buf = MdcGetImgBuffer(width * height); if (id->buf == NULL) { png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); return("PNG Bad malloc image buffer"); } /* get images: png_destroy will free this one later */ row_pointers = png_get_rows(png_ptr, info_ptr); if (row_pointers == NULL) { png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); return("PNG Unexpected error retrieving row_pointers"); } rowbytes = png_get_rowbytes(png_ptr, info_ptr); switch(color_type) { case PNG_COLOR_TYPE_PALETTE: /* copy image rows */ if (rowbytes != width) { png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); return("PNG Unexpected number of bytes per row"); } for (i=0; ibuf + (i*width); memcpy(pbuf,row_pointers[i],width); } /* copy color palette */ for (i=0; i < num_palette; i++) { fi->palette[i * 3 + 0] = (Uint8) palette[i].red; fi->palette[i * 3 + 1] = (Uint8) palette[i].green; fi->palette[i * 3 + 2] = (Uint8) palette[i].blue; } fi->map = MDC_MAP_PRESENT; break; case PNG_COLOR_TYPE_GRAY: /* copy image rows */ if (rowbytes != width) { png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); return("PNG Unexpeted number of bytes per row"); } for (i=0; ibuf + (i*rowbytes); memcpy(pbuf,row_pointers[i],rowbytes); } fi->map = MDC_MAP_GRAY; break; case PNG_COLOR_TYPE_GRAY_ALPHA: png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); return("PNG Color type GRAY + ALPHA unsupported"); break; case PNG_COLOR_TYPE_RGB: /* get contiguous RGB memory block */ imgRGB = malloc(height * rowbytes); if (imgRGB == NULL) { png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); return("PNG Couldn't allocate RGB buffer"); } for (i=0; imap = MDC_MAP_PRESENT; fi->type = COLRGB; fi->bits = 24; id->type = COLRGB; id->bits = 24; id->buf = imgRGB; break; case PNG_COLOR_TYPE_RGB_ALPHA: png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); return("PNG Color type RGB + ALPHA unsupported"); break; default: return("PNG Unsupported color type"); } /* finishing up */ png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_SET,1.0,NULL); return(NULL); } char *MdcWritePNG(FILEINFO *fi) { char suffix[11], *pext; png_structp png_ptr; png_infop info_ptr; png_colorp palette; png_bytepp row_pointers; png_text text_ptr[3]; IMG_DATA *id; Uint32 n, i, width, height, length, row_bytes; Uint8 *pbuf, FREE = MDC_NO; int bit_depth, color_type, interlace, compression, filter; MDC_FILE_ENDIAN = MDC_BIG_ENDIAN; /* always for a PNG */ if ((MDC_FILE_STDOUT == MDC_YES) && (fi->number > 1)) return("PNG Output to stdout not appropriate for multiple images"); if (XMDC_GUI == MDC_NO) { MdcDefaultName(fi,MDC_FRMT_PNG,fi->ofname,fi->ifname); } if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Writing PNG:"); if (MDC_VERBOSE) MdcPrntMesg("PNG Writing <%s> ...",fi->ofname); /* desktop output - no use of 16 bit feature */ if (MDC_FORCE_INT != MDC_NO) { if (MDC_FORCE_INT != BIT8_U) { MdcPrntWarn("PNG Only Uint8 pixels supported"); } } /* check supported things */ if (MDC_QUANTIFY || MDC_CALIBRATE) { MdcPrntWarn("PNG Normalization loses quantified values!"); } if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_SET,0.0,NULL); length = strlen(fi->ofname); pext = strrchr(fi->ofname,'.'); if (pext == NULL) pext = &fi->ofname[length]; /* split up in separate files */ /* PNG is a single image format */ for (n=0; n < fi->number; n++) { /* add slice number to filename */ if (fi->number > 1) { sprintf(suffix,"-%.5u.%.3s",n+1,FrmtExt[MDC_FRMT_PNG]); strcpy(pext,suffix); } if ((MDC_FILE_STDOUT == MDC_YES) && (fi->number == 1)) { fi->ofp = stdout; }else{ if (MdcKeepFile(fi->ofname)) return("PNG File exists!!"); if ( (fi->ofp=fopen(fi->ofname,"wb")) == NULL ) return ("PNG Couldn't open file"); } /* set some defaults */ id = &fi->image[n]; width = id->width; height= id->height; bit_depth = 8; if (fi->type == COLRGB) { /* true color */ color_type = PNG_COLOR_TYPE_RGB; row_bytes = width * 3; }else{ /* indexed */ if (fi->map == MDC_MAP_GRAY) { /* gray */ color_type = PNG_COLOR_TYPE_GRAY; row_bytes = width; }else{ /* color */ color_type = PNG_COLOR_TYPE_PALETTE; row_bytes = width; } } compression = PNG_COMPRESSION_TYPE_BASE; interlace = PNG_INTERLACE_NONE; filter = PNG_FILTER_TYPE_BASE; /* Create and initialize the png_struct with the desired error handler */ /* functions. If you want to use the default stderr and longjump method, */ /* you can supply NULL for the last three parameters. We also check that */ /* the library version is compatible with the one used at compile time, */ /* in case we are using dynamically linked libraries. REQUIRED. */ png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING , NULL, MdcPngErr, MdcPngWarn); if (png_ptr == NULL) return("PNG Couldn't create write struct"); /* allocate/initialize the image information data. REQUIRED */ info_ptr = png_create_info_struct(png_ptr); if (info_ptr == NULL) { png_destroy_write_struct(&png_ptr, (png_infopp)NULL); return ("PNG Couldn't create write info struct"); } /* Set error handling. REQUIRED if you aren't supplying your own */ /* error handling functions in the png_create_write_struct() call. */ if (setjmp(png_jmpbuf(png_ptr))) { /* if we get here, we had a problem writing the file */ png_destroy_write_struct(&png_ptr, &info_ptr); return ("PNG Unexpected fire write error"); } /* set up the output control using standard C streams */ png_init_io(png_ptr, fi->ofp); /* can't write hilevel way, so here goes the hard way */ /* Set the image information here. Width and height are up to 2^31, */ /* bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on */ /* the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY, */ /* PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB, */ /* or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or */ /* PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST */ /* currently be PNG_COMPRESSION_TYPE_BASE & PNG_FILTER_TYPE_BASE. REQUIRED */ png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, color_type , interlace, compression, filter); /* set the palette if there is one. REQUIRED for indexed-color images */ palette = (png_colorp)png_malloc(png_ptr, 256 * sizeof (png_color)); if (color_type == PNG_COLOR_TYPE_PALETTE) { for (i=0; i<256; i++) { palette[i].red = fi->palette[i*3 + 0]; palette[i].green = fi->palette[i*3 + 1]; palette[i].blue = fi->palette[i*3 + 2]; } png_set_PLTE(png_ptr, info_ptr, palette, 256); } /* You must not free palette here, because png_set_PLTE only makes a link */ /* to the palette that you malloced. Wait until you are about to destroy */ /* the png structure. */ /* optional significant bit chunk */ /* if we are dealing with a grayscale image then */ /* sig_bit.gray = true_bit_depth; */ /* otherwise, if we are dealing with a color image then */ /* sig_bit.red = true_bit_depth; */ /* sig_bit.green = true_bit_depth; */ /* sig_bit.blue = true_bit_depth; */ /* if the image has an alpha channel then */ /* sig_bit.alpha = true_bit_depth; */ /* png_set_sBIT(png_ptr, info_ptr, sig_bit); */ /* Optional gamma chunk is strongly suggested if you have any guess */ /* as to the correct gamma of the image. */ /* png_set_gAMA(png_ptr, info_ptr, gamma); */ /* Optionally write comments into the image */ mdcbufr[0] = '\0'; if ( fi->acquisition_type != MDC_ACQUISITION_UNKNOWN ) { if ( !MdcMakeScanInfoStr(fi)) mdcbufr[0]='\0'; } text_ptr[0].key = "Program"; text_ptr[0].text = XMEDCON_PRGR; text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE; text_ptr[1].key = "Version"; text_ptr[1].text = XMEDCON_VERSION; text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE; text_ptr[2].key = "Information"; text_ptr[2].text = mdcbufr; text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt; #ifdef PNG_iTXt_SUPPORTED text_ptr[0].lang = NULL; text_ptr[1].lang = NULL; text_ptr[2].lang = NULL; #endif png_set_text(png_ptr, info_ptr, text_ptr, 3); /* other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs, */ /* note that if sRGB is present the gAMA and cHRM chunks must be ignored */ /* on read and must be written in accordance with the sRGB profile */ /* write the file header information. REQUIRED */ png_write_info(png_ptr, info_ptr); /* get 8bits image */ if ((id->type != COLRGB) && (id->type != BIT8_U)) { if ((pbuf = MdcGetImgBIT8_U(fi, n)) == NULL) { png_free(png_ptr, palette); png_destroy_write_struct(&png_ptr, &info_ptr); return("PNG Bad malloc new image buffer"); } FREE = MDC_YES; }else{ pbuf = id->buf; FREE = MDC_NO; } /* allocate pointers to rows */ row_pointers = (png_bytepp)malloc(sizeof(png_bytep) * height); if (row_pointers == NULL) { if (FREE == MDC_YES) MdcFree(pbuf); png_free(png_ptr, palette); png_destroy_write_struct(&png_ptr, &info_ptr); return("PNG Couldn't alloc row_pointers table"); } for (i=0; inumber,NULL); MdcCloseFile(fi->ofp); } return(NULL); } xmedcon-0.14.1/source/m-xtract.c0000644000175000017510000002666212636253502013377 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-xtract.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : extract specified images * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcGetImagesToExtract() - Ask images to extract * * MdcExtractImages() - Extract/Reorder the images * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-xtract.c,v 1.42 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "medcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ MdcExtractInputStruct mdcextractinput; /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcGetImagesToExtract(FILEINFO *fi, MdcExtractInputStruct *input) { Uint32 images=1; Uint32 *frames, *planes, *gates, *beds; Uint32 p,f,g,b; Uint32 it, bt; char *msg; /* initialize the extract input structure */ input->style = MDC_INPUT_NORM_STYLE; input->inrs = NULL; input->num_p = 1; input->num_f = 1; input->num_g = 1; input->num_b = 1; if (input->INTERACTIVE == MDC_YES) { MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("\tEXTRACT IMAGES\t\tFILE: %s\n",fi->ifname); MdcPrintLine('-',MDC_FULL_LENGTH); input->style = MdcGetSelectionType(); } if ( input->style == MDC_INPUT_ECAT_STYLE ) { /* ecat input type */ if (input->INTERACTIVE == MDC_NO) return(MDC_NO); MdcPrntScrn("\n\n\t"); MdcPrntScrn("Input notes: a) Any number must be one-based (0 = All)"); MdcPrntScrn("\n\t"); MdcPrntScrn(" b) Syntax of range : X...Y or X-Y"); MdcPrntScrn("\n\t"); MdcPrntScrn(" c) Syntax of interval: X:S:Y (S = step)"); MdcPrntScrn("\n\t"); MdcPrntScrn(" d) Just type for entire range\n"); MdcPrntScrn("\n\t"); MdcPrntScrn("Example : 1 3 5...10 12:2:20\n"); if ( (planes=(Uint32 *)malloc((fi->dim[3]+1)*sizeof(Uint32)))==NULL ) { MdcPrntWarn("Couldn't allocate planes buffer"); return(MDC_NO); } memset(planes,0,(fi->dim[3]+1)*sizeof(Uint32)); if ( (frames=(Uint32 *)malloc((fi->dim[4]+1)*sizeof(Uint32)))==NULL ) { MdcPrntWarn("Couldn't allocate frames buffer"); MdcFree(planes); return(MDC_NO); } memset(frames,0,(fi->dim[4]+1)*sizeof(Uint32)); if ( (gates=(Uint32 *)malloc((fi->dim[5]+1)*sizeof(Uint32)))==NULL ) { MdcPrntWarn("Couldn't allocate gates buffer"); MdcFree(planes); MdcFree(frames); return(MDC_NO); } memset(gates,0,(fi->dim[5]+1)*sizeof(Uint32)); if ( (beds=(Uint32 *)malloc((fi->dim[6]+1)*sizeof(Uint32)))==NULL ) { MdcPrntWarn("Couldn't allocate beds buffer"); MdcFree(planes); MdcFree(frames); MdcFree(gates); return(MDC_NO); } memset(beds,0,(fi->dim[6]+1)*sizeof(Uint32)); MdcPrntScrn("\n\tGive planes list [1...%u]: ",fi->dim[3]); MdcGetStrInput(mdcbufr,MDC_2KB_OFFSET); if ((msg=MdcHandleEcatList(mdcbufr,&planes,(Uint32)fi->dim[3])) != NULL) { MdcFree(planes); MdcFree(frames); MdcFree(gates); MdcFree(beds); MdcPrntWarn(msg); return(MDC_BAD_CODE); } MdcPrntScrn("\n\tGive frames list [1...%u]: ",fi->dim[4]); MdcGetStrInput(mdcbufr,MDC_2KB_OFFSET); if ((msg=MdcHandleEcatList(mdcbufr,&frames,(Uint32)fi->dim[4])) != NULL) { MdcFree(planes); MdcFree(frames); MdcFree(gates); MdcFree(beds); MdcPrntWarn(msg); return(MDC_BAD_CODE); } MdcPrntScrn("\n\tGive gates list [1...%u]: ",fi->dim[5]); MdcGetStrInput(mdcbufr,MDC_2KB_OFFSET); if ((msg=MdcHandleEcatList(mdcbufr,&gates,(Uint32)fi->dim[5])) != NULL) { MdcFree(planes); MdcFree(frames); MdcFree(gates); MdcFree(beds); MdcPrntWarn(msg); return(MDC_BAD_CODE); } MdcPrntScrn("\n\tGive beds list [1...%u]: ",fi->dim[6]); MdcGetStrInput(mdcbufr,MDC_2KB_OFFSET); if ((msg=MdcHandleEcatList(mdcbufr,&beds,(Uint32)fi->dim[6])) != NULL) { MdcFree(planes); MdcFree(frames); MdcFree(gates); MdcFree(beds); MdcPrntWarn(msg); return(MDC_BAD_CODE); } images*=planes[0]*frames[0]*gates[0]*beds[0]; input->num_p = planes[0]; input->num_f = frames[0]; input->num_g = gates[0]; input->num_b = beds[0]; if ((input->inrs=(Uint32 *)malloc((images+1)*sizeof(Uint32)))==NULL) { MdcFree(planes); MdcFree(frames); MdcFree(gates); MdcFree(beds); MdcPrntWarn("Couldn't malloc images number buffer"); return(MDC_BAD_ALLOC); } /* get sequential image numbers (like normal selection) */ it = 1; for (b=1; b<=fi->dim[6];b++) if (beds[b]) for (g=1; g<=fi->dim[5];g++) if (gates[g]) for (f=1; f<=fi->dim[4];f++) if (frames[f]) for (p=1; p<=fi->dim[3];p++) if (planes[p]) { images = p + /* the image number */ fi->dim[3]*( (f-1) + fi->dim[4]*( (g-1) + fi->dim[5]*( (b-1) ) ) ); input->inrs[it++]=images; } MdcFree(planes); MdcFree(frames); MdcFree(gates); MdcFree(beds); }else{ /* normal input type */ if ((input->inrs=(Uint32 *)malloc(MDC_BUF_ITMS*sizeof(Uint32)))==NULL) { MdcPrntWarn("Couldn't allocate images number buffer"); return(MDC_BAD_ALLOC); } if (input->INTERACTIVE == MDC_YES) { MdcPrntScrn("\n\t"); MdcPrntScrn("Input notes: a) Any number must be one-based "); MdcPrntScrn("(0 = All reversed)"); MdcPrntScrn("\n\t"); MdcPrntScrn(" b) Syntax of range : X...Y or X-Y"); MdcPrntScrn("\n\t"); MdcPrntScrn(" c) Syntax of interval: X:S:Y (S = step)"); MdcPrntScrn("\n\t"); MdcPrntScrn(" d) The list is sequence sensitive!"); MdcPrntScrn("\n\t"); MdcPrntScrn(" e) Just type for all reversed\n"); MdcPrntScrn("\n\t"); MdcPrntScrn("Example : 1 3 4:2:11 12...6\n"); MdcPrntScrn("\n\t"); MdcPrntScrn("Your input [1...%u]: ",fi->number); MdcGetStrInput(input->list,MDC_MAX_LIST); } it = 1; bt = 2; msg = MdcHandleNormList(input->list,&input->inrs,&it,&bt,fi->number); if (msg != NULL) { MdcFree(input->inrs); MdcPrntWarn(msg); return(MDC_BAD_CODE); } } input->inrs[0] = it - 1; if (input->INTERACTIVE == MDC_YES) MdcPrintLine('-',MDC_FULL_LENGTH); if (input->inrs[0] == 0) { MdcPrntWarn("No images specified!"); MdcFree(input->inrs); return(MDC_BAD_CODE); } return(MDC_YES); } char *MdcExtractImages(FILEINFO *fi) { MdcExtractInputStruct *input = &mdcextractinput; Uint32 i, j, bytes; char *msg=NULL; IMG_DATA id_tmp, *new_image; IMG_DATA *id_src, *id_dest; int error; if (MDC_FILE_STDIN == MDC_YES) return(NULL); /* stdin already in use */ /* in GUI skip command-line questions */ if (XMDC_GUI == MDC_NO) { error=MdcGetImagesToExtract(fi,input); if (error != MDC_YES) return("Failure retrieving images to extract"); } /* free obsolete data structs */ MdcFreeODs(fi); /* handle image extractions */ if (input->inrs[1] == 0) { /* * reverse images */ for (i=0; i < (fi->number/2); i++) { memcpy(&id_tmp,&fi->image[i],sizeof(IMG_DATA)); memcpy(&fi->image[i],&fi->image[fi->number-1-i],sizeof(IMG_DATA)); memcpy(&fi->image[fi->number-1-i],&id_tmp,sizeof(IMG_DATA)); } }else{ /* * extract/reorder images */ /* handle new IMG_DATA structs */ new_image = (IMG_DATA *)malloc(input->inrs[0]*sizeof(IMG_DATA)); if (new_image == NULL) { MdcFree(input->inrs); return("Couldn't alloc new IMG_DATA array"); } for (i=1; i<=input->inrs[0]; i++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)input->inrs[0],NULL); id_dest = &new_image[i-1]; id_src = &fi->image[input->inrs[i]-1]; bytes = id_src->width * id_src->height * MdcType2Bytes(id_src->type); /* copy IMG_DATA struct */ memcpy((Uint8 *)id_dest,(Uint8 *)id_src,sizeof(IMG_DATA)); /* copy fresh image buffer */ id_dest->buf = MdcGetImgBuffer(bytes); if (id_dest->buf == NULL) { /* free up previous allocated resources */ for (j=0; j < i-1; j++) MdcFree(new_image[j].buf); MdcFree(new_image); MdcFree(input->inrs); return("Couldn't alloc new image buffer"); }else{ memcpy(id_dest->buf,id_src->buf,bytes); } } /* remove all previous images */ for (i=0; inumber; i++) MdcFree(fi->image[i].buf); /* re-init FI */ MdcFree(fi->image); fi->number = input->inrs[0]; if (input->style == MDC_INPUT_ECAT_STYLE) { /* preserve ECAT style image */ fi->dim[0] = 6; fi->dim[3] = input->num_p; fi->dim[4] = input->num_f; fi->dim[5] = input->num_g; fi->dim[6] = input->num_b; }else{ fi->dim[0] = 3; fi->dim[3] = fi->number; for (i=4; i < MDC_MAX_DIMS; i++) fi->dim[i] = 1; } fi->image = new_image; if (fi->acquisition_type == MDC_ACQUISITION_DYNAMIC) { if (fi->dim[4] > 1) { fi->acquisition_type = MDC_ACQUISITION_DYNAMIC; }else{ fi->acquisition_type = MDC_ACQUISITION_TOMO; } } fi->endian = MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; msg=MdcImagesPixelFiddle(fi); } MdcFree(input->inrs); if (msg != NULL) return(msg); return(NULL); } xmedcon-0.14.1/source/xresize.h0000644000175000017510000000367212636253502013332 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xresize.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xresize.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xresize.h,v 1.17 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XRESIZE_H__ #define __XRESIZE_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ Uint32 XMdcResize(Uint32 dim); void XMdcResizeSelCallbackApply(GtkWidget *widget, gpointer data); void XMdcResizeSel(void); void XMdcResizeNeeded(void); #endif xmedcon-0.14.1/source/m-pixels.h0000644000175000017510000000414712636253502013375 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-pixels.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-pixels.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-pixels.h,v 1.16 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_PIXELS_H__ #define __M_PIXELS_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void MdcDisplayPixels(FILEINFO *fi); int MdcAskPixels(FILEINFO *fi, Uint32 *img[], Uint32 *col[], Uint32 *row[]); void MdcGetPixels(FILEINFO *fi, Uint32 img[], Uint32 col[], Uint32 row[]); double MdcGetOnePixel(IMG_DATA *id, Uint32 i, Uint32 x, Uint32 y); void MdcPrintPixel(IMG_DATA *id, Uint32 i, Uint32 x, Uint32 y); #endif xmedcon-0.14.1/source/m-color.c0000644000175000017510000001600012636253501013170 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-color.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : make color palettes * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcLoadLUT() - Load LUT file into RGB array * * MdcGrayScale() - Make gray palette * * MdcInvertedScale() - Make inverted gray palette * * MdcRainbowScale() - Make rainbow palette * * MdcCombinedScale() - Make combined palette * * MdcHotmetalScale() - Make hotmetal palette * * MdcGetColorMap() - Get the specified palette * * MdcSetPresentMap() - Preserve colormap in colored file * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-color.c,v 1.24 2015/12/22 13:59:29 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "m-defs.h" #include "m-global.h" #include "m-color.h" /**************************************************************************** D E F I N E S ****************************************************************************/ static Uint8 loaded_map[768], LOADED = MDC_NO; static Uint8 present_map[768]; /* map from file */ /* cti source */ struct {int n,r,g,b,dr,dg,db; } bitty[] = { {32,0,0,0,2,0,4}, /* violet to indigo */ {32,64,0,128,-2,0,4}, /* indigo to blue */ {32,0,0,255,0,8,-8}, /* blue to green */ {64,0,255,0,4,0,0}, /* green to yellow */ {32,255,255,0,0,-2,0}, /* yellow to orange */ {64,255,192,0,0,-3,0} }; /* orange to red */ /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcLoadLUT(const char *lutname) { FILE *fp; int s; LOADED = MDC_NO; if ((fp=fopen(lutname,"rb")) == NULL) return(MDC_NO); LOADED = MDC_YES; /* get red values */ for (s=0; s<768; s+=3) loaded_map[s] = (Uint8)fgetc(fp); /* get green values */ for (s=1; s<768; s+=3) loaded_map[s] = (Uint8)fgetc(fp); /* get blue values */ for (s=2; s<768; s+=3) loaded_map[s] = (Uint8)fgetc(fp); fclose(fp); return(MDC_YES); } void MdcGrayScale(Uint8 *palette) { int i; Uint8 gray; for (i=0; i<256; i++) { gray = (Uint8)i; palette[i*3]=palette[i*3+1]=palette[i*3+2]=gray; } } void MdcInvertedScale(Uint8 *palette) { int i; Uint8 gray; for (i=0; i<256; i++) { gray = 255 - (Uint8)i; palette[i*3]=palette[i*3+1]=palette[i*3+2]=gray; } } void MdcRainbowScale(Uint8 *palette) { int p=0,i,j,r,g,b; for (j=0;j<6;j++) { palette[p++]=r=bitty[j].r; palette[p++]=g=bitty[j].g; palette[p++]=b=bitty[j].b; for (i=1;i header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `isinf' function. */ #undef HAVE_ISINF /* Define to 1 if you have the `isnan' function. */ #undef HAVE_ISNAN /* Define to 1 if you have the `localtime_r' function. */ #undef HAVE_LOCALTIME_R /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strptime' function. */ #undef HAVE_STRPTIME /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG /* The size of `short', as computed by sizeof. */ #undef SIZEOF_SHORT /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Define to empty if `const' does not conform to ANSI C. */ #undef const xmedcon-0.14.1/source/xdefs.h0000644000175000017510000002426212636253502012750 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xdefs.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xdefs.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xdefs.h,v 1.70 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XDEFS_H__ #define __XDEFS_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ /* file types */ /* unsaved status > 128*/ #define XMDC_RAW 255 #define XMDC_PREDEF 254 #define XMDC_EXTRACT 253 #define XMDC_RESLICE 252 #define XMDC_TRANSF 251 #define XMDC_EDITFI 250 #define XMDC_UNSAVED 128 /* saved status < 128 */ #define XMDC_SAVED 2 #define XMDC_NORMAL 1 #define XMDC_FREE_BORDER 125 #define XMDC_COLORMAP_WIDTH 25 #define XMDC_COLORMAP_HEIGHT 48 #define XMDC_LABEL_RED 1 #define XMDC_LABEL_GREEN 2 #define XMDC_LABEL_BLUE 3 #define XMDC_LABEL_YELLOW 4 #define XMDC_LABEL_STYLE_ABS 1 #define XMDC_LABEL_STYLE_PAGE 2 #define XMDC_LABEL_STYLE_ECAT 3 #define XMDC_ZOOM_FACTOR 1 #define XMDC_ZOOM_IN XMDC_ZOOM_FACTOR /* incr */ #define XMDC_ZOOM_OUT -(XMDC_ZOOM_FACTOR) /* decr */ #define XMDC_ZOOM_NONE 0 #define XMDC_RESIZE_FOURTH -4 /* 1:4 */ #define XMDC_RESIZE_THIRD -3 /* 1:3 */ #define XMDC_RESIZE_HALF -2 /* 1:2 */ #define XMDC_RESIZE_ORIGINAL 1 /* 1:1 */ #define XMDC_RESIZE_DOUBLE 2 /* 2:1 */ #define XMDC_RESIZE_TRIPLE 3 /* 3:1 */ #define XMDC_PAGES_FRAME_BY_FRAME 0 /* frame by frame */ #define XMDC_PAGES_SLICE_BY_SLICE 1 /* slice by slice */ #define XMDC_PAGES_SCREEN_FULL 2 /* screen full */ #define XMDC_DEFAULT_FRMT MDC_FRMT_RAW /* default save format (enabled!?) */ #define XMDC_MAX_LOADABLE_LUTS 125 /* maximum external LUTs available */ #ifdef _WIN32 #define MDC_USE_SIGNAL_BLOCKER 1 #endif typedef struct SignalBlocker_t{ guint id; gboolean blocked; }SignalBlocker; typedef struct OptionsMedConStruct_t { GtkWidget *PixPositives; GtkWidget *PixNegatives; GtkWidget *PixNoQuant; GtkWidget *PixQuantify; GtkWidget *PixCalibrate; GtkWidget *PixTypeNONE; GtkWidget *PixTypeBIT8_U; GtkWidget *PixTypeBIT16_S; GtkWidget *BitsUsed12; GtkWidget *FileTypeLITTLE; GtkWidget *FileTypeBIG; GtkWidget *FlipHoriz; GtkWidget *FlipVert; GtkWidget *SortReverse; GtkWidget *SortCine; GtkWidget *SortCineApply; GtkWidget *SortCineUndo; GtkWidget *MakeSqrNo; GtkWidget *MakeSqr1; GtkWidget *MakeSqr2; GtkWidget *NormOverFrames; GtkWidget *NormOverAll; GtkWidget *FallbackNONE; GtkWidget *FallbackANLZ; GtkWidget *FallbackCONC; GtkWidget *FallbackECAT; GtkWidget *FallbackDICM; GtkWidget *SplitNone; GtkWidget *SplitFrames; GtkWidget *SplitSlices; GtkWidget *ColorModeIndexed; GtkWidget *ColorMakeGray; GtkWidget *ColorDither; GtkWidget *PadAround; GtkWidget *PadTopLeft; GtkWidget *PadBottomRight; GtkWidget *NameAlias; GtkWidget *NameNoPrefix; GtkWidget *DicmMosaicEnabled; GtkWidget *DicmMosaicForced; GtkWidget *DicmMosaicWidth; GtkWidget *DicmMosaicHeight; GtkWidget *DicmMosaicNumber; GtkWidget *DicmMosaicDoInterl; GtkWidget *DicmMosaicFixVoxel; GtkWidget *DicmTrueGap; GtkWidget *DicmContrast; GtkWidget *DicmWriteImplicit; GtkWidget *DicmWriteNoMeta; GtkWidget *AnlzSPM; GtkWidget *IntfSkip1; GtkWidget *IntfNoPath; GtkWidget *IntfSingleFile; GtkWidget *EcatSortAnatom; GtkWidget *EcatSortByFrame; }OptionsMedConStruct; typedef struct MyMainStruct_t { GtkWidget *mainwindow; GtkWidget *viewwindow; GtkWidget *viewbox; GtkWidget *pagemenu; GtkWidget *imgsbox; GtkWidget *imgstable; GtkWidget *cmapbox; GtkWidget **image; GtkWidget *cmap; GdkPixbuf **im, *imcmap; GdkInterpType interp; GdkRgbDither dither; SignalBlocker *sblkr; gint cmap_w, cmap_h; FILEINFO *fi; Uint32 curpage, prevpage; Uint32 number_of_pages, images_per_page; Uint32 images_horizontal, images_vertical; Uint32 startimage, real_images_on_page; Uint32 *pagenumber, *imagenumber, *realnumber; Int8 RESIZE; float scale_width, scale_height; }MyMainStruct; typedef struct ColormapSelectionStruct_t { gint Nr; gint CurMap; GtkWidget *Gray; GtkWidget *Inverted; GtkWidget *Rainbow; GtkWidget *Combined; GtkWidget *Hotmetal; GtkWidget *Loaded; }ColormapSelectionStruct; typedef struct MapPlaceSelectionStruct_t { GtkWidget *Right; GtkWidget *Left; }MapPlaceSelectionStruct; typedef struct LabelSelectionStruct_t { gint CurState; gint CurColor; gint CurStyle; GdkGC *gc; GdkColor *color; GtkWidget *On; GtkWidget *Off; GtkWidget *Red; GtkWidget *Blue; GtkWidget *Green; GtkWidget *Yellow; GtkWidget *NrAbsolute; GtkWidget *NrInPage; GtkWidget *NrEcat; }LabelSelectionStruct; typedef struct RenderSelectionStruct_t { GdkRgbDither Dither; GdkInterpType Interp; GtkWidget *InterpNearest; GtkWidget *InterpTiles; GtkWidget *InterpBilinear; GtkWidget *InterpHyper; GtkWidget *DitherNone; GtkWidget *DitherNormal; GtkWidget *DitherMax; }RenderSelectionStruct; typedef struct ExtractSelectionStruct_t { GtkWidget *NormStyle; GtkWidget *EcatStyle; GtkWidget *InputPlanes; GtkWidget *InputFrames; GtkWidget *InputGates; GtkWidget *InputBeds; MdcExtractInputStruct *input; }ExtractSelectionStruct; typedef struct RawReadSelectionStruct_t { GtkWidget *HdrInfoWindow; GtkWidget *NrImages; GtkWidget *GenOffset; GtkWidget *ImgOffset; GtkWidget *AbsOffset; GtkWidget *IhdrRep, *PixSwap, *ImgSame; GtkWidget *ImgWidth, *ImgHeight; GtkWidget *typeBIT1, *typeASCII; GtkWidget *typeBIT8_S, *typeBIT8_U; GtkWidget *typeBIT16_S, *typeBIT16_U; GtkWidget *typeBIT32_S, *typeBIT32_U; GtkWidget *typeBIT64_S, *typeBIT64_U; GtkWidget *typeFLT32, *typeFLT64; GtkWidget *typeCOLRGB; Uint32 ImgCounter; }RawReadSelectionStruct; typedef struct ResizeSelectionStruct_t { Int8 CurType; GtkWidget *Original; GtkWidget *Fourth; GtkWidget *Third; GtkWidget *Half; GtkWidget *Double; GtkWidget *Triple; }ResizeSelectionStruct; typedef struct PagesSelectionStruct_t{ Int8 CurType; GtkWidget *FrameByFrame; GtkWidget *SliceBySlice; GtkWidget *ScreenFull; }PagesSelectionStruct; typedef struct SliderValueStruct_t { GtkObject *adj; GtkWidget *range; int *value; }SliderValueStruct; typedef struct ColorModifier_t{ guint gamma, brightness, contrast; Uint8 vgbc[256]; }ColorModifier; typedef struct ColGbcCorrectStruct_t { GtkWidget *area; GdkPixmap *brightness_pmap, *brightness_mask; GdkPixmap *contrast_pmap, *contrast_mask; GdkPixmap *gamma_pmap, *gamma_mask; GdkPixbuf *im; ColorModifier mod; Uint32 i, nr, w, h, rw, rh; Int16 t; Uint8 *img8, vgbc[256]; }ColGbcCorrectStruct; typedef struct EditFileInfoStruct_t { int CurModality; GtkWidget *PatSliceOrient[MDC_MAX_ORIENT]; GtkWidget *PixelSize; GtkWidget *SliceWidth; GtkWidget *SliceSpacing; GtkWidget *FrameDuration; GtkWidget *NrDimPlanes; GtkWidget *NrDimFrames; GtkWidget *NrDimGates; GtkWidget *NrDimBeds; GtkWidget *NrDimWindows; GtkWidget *Reconstructed; GtkWidget *Planar; GtkWidget *ModalityNM; GtkWidget *ModalityPT; GtkWidget *ModalityCT; GtkWidget *ModalityMR; GtkWidget *ModalityCurrent; GtkWidget *AcquisitionType[MDC_MAX_ACQUISITIONS]; }EditFileInfoStruct; extern Uint8 XMDC_FILE_OPEN; extern Uint8 XMDC_FILE_TYPE; extern Uint8 XMDC_IMAGE_BORDER; extern Uint8 XMDC_CMAP_PLACE; extern Uint8 XMDC_DOBAR; extern GdkColor Red; extern GdkColor Green; extern GdkColor Blue; extern GdkColor Yellow; extern GdkCursor *handcursor; extern GdkCursor *fleurcursor; extern GdkFont *sfixed; extern MyMainStruct my; extern OptionsMedConStruct sOptionsMedCon; extern ColormapSelectionStruct sColormapSelection; extern MapPlaceSelectionStruct sMapPlaceSelection; extern LabelSelectionStruct sLabelSelection; extern RenderSelectionStruct sRenderSelection; extern ExtractSelectionStruct sExtractSelection; extern RawReadSelectionStruct sRawReadSelection; extern ResizeSelectionStruct sResizeSelection; extern PagesSelectionStruct sPagesSelection; extern ColGbcCorrectStruct sGbc; extern EditFileInfoStruct sEditFI; extern char labelindex[25]; extern char labeltimes[50]; extern Uint32 write_counter; extern char xmdcstr[MDC_2KB_OFFSET]; extern char *XMEDCONLUT; extern char *XMEDCONRPI; #endif xmedcon-0.14.1/source/m-config.h.in0000644000175000017510000000644312636253502013744 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-config.h.in * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : (X)MedCon template configuration header (configure) * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-config.h.in,v 1.27 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_CONFIG_H__ #define __M_CONFIG_H__ /* Define some version variables */ #define XMEDCON_MAJOR "@XMEDCON_MAJOR@" #define XMEDCON_MINOR "@XMEDCON_MINOR@" #define XMEDCON_MICRO "@XMEDCON_MICRO@" #define XMEDCON_PRGR "@XMEDCON_PRGR@" #define XMEDCON_DATE "@XMEDCON_DATE@" #define XMEDCON_VERSION "@XMEDCON_VERSION@" #define XMEDCON_LIBVERS "@XMEDCON_LIBVERS@" /* Define if format enabled */ #define MDC_INCLUDE_ACR @ENABLE_ACR@ #define MDC_INCLUDE_GIF @ENABLE_GIF@ #define MDC_INCLUDE_INW @ENABLE_INW@ #define MDC_INCLUDE_ANLZ @ENABLE_ANLZ@ #define MDC_INCLUDE_CONC @ENABLE_CONC@ #define MDC_INCLUDE_ECAT @ENABLE_ECAT@ #define MDC_INCLUDE_INTF @ENABLE_INTF@ #define MDC_INCLUDE_DICM @ENABLE_DICM@ #define MDC_INCLUDE_PNG @ENABLE_PNG@ #define MDC_INCLUDE_NIFTI @ENABLE_NIFTI@ #define MDC_INCLUDE_TPC @ENABLE_TPC@ /* TPC ecat7 write */ /* Define some machine dependencies */ #define MDC_WORDS_BIGENDIAN @mdc_cv_bigendian@ #define MDC_SIZEOF_SHORT @ac_cv_sizeof_short@ #define MDC_SIZEOF_INT @ac_cv_sizeof_int@ #define MDC_SIZEOF_LONG @ac_cv_sizeof_long@ #define MDC_ENABLE_LONG_LONG @mdc_cv_enable_lnglng@ #if MDC_ENABLE_LONG_LONG #define MDC_SIZEOF_LONG_LONG @ac_cv_sizeof_long_long@ #endif /* Define decompression program */ #define MDC_DECOMPRESS "@DECOMPRESS@" /* Define GLIB related stuff */ #define GLIBSUPPORTED @GLIBSUPPORTED@ /* Define XMedCon related stuff */ #define GTKSUPPORTED @GTKSUPPORTED@ #if GTKSUPPORTED # define XMDCHELP "http://xmedcon.sourceforge.net" # ifdef _WIN32 # define XMDCLUT "C:\\Program Files\\XMedCon\\etc\\" # define XMDCRC "C:\\Program Files\\XMedCon\\etc\\xmedconrc" # else # define XMDCLUT "@XMDCETC@/" # define XMDCRC "@XMDCETC@/xmedconrc" # endif #endif #endif xmedcon-0.14.1/source/xextract.h0000644000175000017510000000436012636253502013476 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xextract.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xextract.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xextract.h,v 1.17 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XEXTRACT_H__ #define __XEXTRACT_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ gboolean XMdcExtractNotBussy(GtkWidget *widget, gpointer data); void XMdcExtractImages(void); int XMdcHandleEcatList(char *S,Uint32 **list,Uint32 max); int XMdcHandleNormList(char *s,Uint32 **inrs,Uint32 *it,Uint32 *bt,Uint32 max); void XMdcGetImagesCallbackApply(GtkWidget *widget, gpointer data); void XMdcGetImages(void); void XMdcExtractStyleSelCallbackApply(GtkWidget *widget, gpointer data); void XMdcExtractStyleSel(GtkWidget *widget, gpointer data); #endif xmedcon-0.14.1/source/m-getopt.c0000644000175000017510000013717112636253502013372 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-getopt.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : routines for handling the command-line options * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcPrintGlobalOptions() - Print only global option usage * * MdcPrintLocalOptions() - Print only local option usage * * MdcPrintShortInfo() - Print info to get more help * * MdcPrintUsage() - Print usage of medcon options * * MdcHandleArgs() - Handle the arguments * * MdcApplyReadOptions() - Apply read options * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-getopt.c,v 1.149 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "medcon.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ /* options useful for derived programs */ void MdcPrintGlobalOptions(void) { if (XMDC_GUI == MDC_NO) { MdcPrntScrn("\ \n -c, --convert give list of conversion \"\" strings:\n" ); MdcPrntScrn("\n"); MdcPrntScrn("\t\t\"ascii\" = %s (.%s)\n", FrmtString[MDC_FRMT_ASCII], FrmtExt[MDC_FRMT_ASCII]); MdcPrntScrn("\t\t\"bin\" = %s (.%s)\n", FrmtString[MDC_FRMT_RAW], FrmtExt[MDC_FRMT_RAW]); #if MDC_INCLUDE_ACR MdcPrntScrn("\t\t\"acr\" = %s (.%s)\n", FrmtString[MDC_FRMT_ACR], FrmtExt[MDC_FRMT_ACR]); #endif #if MDC_INCLUDE_ANLZ MdcPrntScrn("\t\t\"anlz\" = %s (.%s)+(.img)\n", FrmtString[MDC_FRMT_ANLZ], FrmtExt[MDC_FRMT_ANLZ]); #endif #if MDC_INCLUDE_CONC MdcPrntScrn("\t\t\"conc\" = %s (.%s)\n", FrmtString[MDC_FRMT_CONC], FrmtExt[MDC_FRMT_CONC]); #endif #if MDC_INCLUDE_DICM MdcPrntScrn("\t\t\"dicom\" = %s (.%s)\n", FrmtString[MDC_FRMT_DICM], FrmtExt[MDC_FRMT_DICM]); #endif #if MDC_INCLUDE_ECAT MdcPrntScrn("\t\t\"ecat6\" = %s (.%s)\n", FrmtString[MDC_FRMT_ECAT6], FrmtExt[MDC_FRMT_ECAT6]); #if MDC_INCLUDE_TPC MdcPrntScrn("\t\t\"ecat7\" = %s (.%s)\n", FrmtString[MDC_FRMT_ECAT7], FrmtExt[MDC_FRMT_ECAT7]); #endif #endif #if MDC_INCLUDE_GIF MdcPrntScrn("\t\t\"gif\" = %s (.%s)\n", FrmtString[MDC_FRMT_GIF], FrmtExt[MDC_FRMT_GIF]); #endif #if MDC_INCLUDE_INTF MdcPrntScrn("\t\t\"intf\" = %s (.%s)+(.i33)\n", FrmtString[MDC_FRMT_INTF], FrmtExt[MDC_FRMT_INTF]); #endif #if MDC_INCLUDE_INW MdcPrntScrn("\t\t\"inw\" = %s (.%s)\n", FrmtString[MDC_FRMT_INW], FrmtExt[MDC_FRMT_INW]); #endif #if MDC_INCLUDE_NIFTI MdcPrntScrn("\t\t\"nifti\" = %s (.%s)\n", FrmtString[MDC_FRMT_NIFTI], FrmtExt[MDC_FRMT_NIFTI]); #endif #if MDC_INCLUDE_PNG MdcPrntScrn("\t\t\"png\" = %s (.%s)\n", FrmtString[MDC_FRMT_PNG], FrmtExt[MDC_FRMT_PNG]); #endif } MdcPrntScrn("\n\ Pixels: [-n] [-nf] [-qs|-qc|-q] [-b8|-b16[.12]] [-big|little]\n\ [-si=:] [-cw=:]\n\ \n -n, --negatives enable negative pixels\ \n -nf, --norm-over-frames normalize values over each frames\ \n -q, --quantitation quantitation using all factors (-qc)\ \n -qs, --quantification quantification (use one scale factor )\ \n -qc, --calibration calibration (use two scale factors)"); MdcPrntScrn("\ \n -b8, --unsigned-char write unsigned char pixels (8 bits)\ \n -b16, --signed-short write signed short integers (16 bits)\ \n -b16.12 write unsigned shorts, only 12 bits used\ \n -big, --big-endian write files in big endian\ \n -little, --little-endian write files in little endian\ \n -si force slope/intercept rescaling\ \n -cw force specified contrast remapping\ \n"); MdcPrntScrn("\n\ Fallback Read Format: [-fb-none|-fb-anlz|-fb-conc|-fb-ecat|fb-dicom]\n\ \n -fb-none, --without-fallback fallback disabled"); MdcPrntScrn("\ \n -fb-anlz, --fallback-analyze "); #if MDC_INCLUDE_ANLZ MdcPrntScrn("fallback on Analyze (SPM)"); #else MdcPrntScrn("(*unused*)"); #endif MdcPrntScrn("\ \n -fb-conc, --fallback-concorde "); #if MDC_INCLUDE_CONC MdcPrntScrn("fallback on Concorde uPET"); #else MdcPrntScrn("(*unused*)"); #endif MdcPrntScrn("\ \n -fb-ecat, --fallback-ecat "); #if MDC_INCLUDE_ECAT MdcPrntScrn("fallback on ECAT 6.4"); #else MdcPrntScrn("(*unused*)"); #endif MdcPrntScrn("\ \n -fb-dicom, --fallback-dicom "); #if MDC_INCLUDE_DICM MdcPrntScrn("fallback on DICOM 3.0"); #else MdcPrntScrn("(*unused*)"); #endif MdcPrntScrn("\n\n\ Slices Transform: [-fh -fv] [-rs -cs -cu] [-sqr | -sqr2] [-crop=:::]\n\t\t[-pad | -padtl | -padbr]\ \n -fh, --flip-horizontal flip images horizontally (along x-axis)\ \n -fv, --flip-vertical flip images vertically (along y-axis)\ \n -sqr, --make-square make square images (largest dimension)\ \n -sqr2, --make-square-two make square images (nearest power)"); MdcPrntScrn("\ \n -crop, --crop-images crop image dimensions\ \n -rs, --reverse-slices reverse slices sequence\ \n -cs, --cine-sorting apply cine sorting\ \n -cu, --cine-undo undo cine sorting\ \n -pad, --pad-around padding symmetrical around image\ \n -padtl, --pad-top-left padding before first row and column\ \n -padbr, --pad-bottom-right padding after last row and column (default)\ \n"); MdcPrntScrn("\n\ Color Remap: [-24 | -8 [-g -dith -mh|-mr|-mi|-mc|-lut ]]\n\ \n -24, --true-color color mode of 24 bits RGB triplets\ \n -8, --indexed-color color mode of 8 bits indexed colormap\ \n -dith, --dither-color apply dithering on color reduction\n\ \n -g, --make-gray remap images to grayscale"); MdcPrntScrn("\ \n -mh, --map-hotmetal load colormap hotmetal\ \n -mr, --map-rainbow load colormap rainbow\ \n -mi, --map-inverted load colormap gray inverted\ \n -mc, --map-combined load colormap combined (gray/rainbow)\ \n -lut, --load-lut load specified LUT colormap\ \n"); MdcPrntScrn("\n\ Extras: [-alias -noprefix -preacq -preser -uin]\ \n [[-splits | -splitf] | [-stacks | -stackf]]\n\ \n -alias, --alias-naming output name based on patient/study id's\ \n -noprefix, --without-prefix output name without default prefix\ \n -preacq, --prefix-acquisition use acquisition number as filename prefix\ \n -preser, --prefix-series use series number as filename prefix\ \n -uin, --use-institution-name override default name of institution"); MdcPrntScrn("\n\ \n -split3d, --split-slices split single image slices in separate files\ \n -split4d, --split-frames split volume time frames in separate files\ \n -stack3d, --stack-slices stack single image slices into one 3D file\ \n -stack4d, --stack-frames stack volume time frames into one 4D file\ \n"); #if MDC_INCLUDE_ECAT MdcPrntScrn("\n\ Format Ecat/Matrix: [-byframe]\n\ \n -byframe, --sort-by-frame sort ECAT images by frame (not anatomical)\ \n"); /*MdcWaitForEnter(0);*/ #endif #if MDC_INCLUDE_ANLZ MdcPrntScrn("\n\ Format Analyze: [-spm -optspm]\n\ \n -spm, --analyze-spm use analyze format for SPM software\ \n"); if (XMDC_GUI == MDC_NO) { MdcPrntScrn("\ \n -optspm, --options-spm ask for SPM related options\ \n"); } #endif #if (MDC_INCLUDE_DICM || MDC_INCLUDE_ACR) MdcPrntScrn("\n\ Format DICOM:\n\ \n a) general: [-cw=
:]\n\ [-contrast] [-gap] [-implicit] [-nometa]\n\ \n -contrast, --enable-contrast enable support for contrast changes\ \n -gap, --spacing-true-gap slice spacing is true gap or overlap"); MdcPrntScrn("\ \n -implicit, --write-implicit output file as implicit little endian\ \n -nometa, --write-without-meta output file without (part 10) meta header\ \n -cw force window center/width contrast"); MdcPrntScrn("\n\ \n b) mosaic: [-mosaic | -fmosaic=xx [-interl] [-mfixv]]\n\ \n -mosaic, --enable-mosaic enable mosaic by \"detected\" stamps layout\ \n -fmosaic, --force-mosaic force mosaic by predefined stamps layout\ \n -mfixv, --mosaic-fix-voxel rescale voxel sizes by mosaic factor\ \n -interl, --mosaic-interlaced consider mosaic stamp slices as interlaced\ \n"); #endif #if MDC_INCLUDE_GIF MdcPrntScrn("\n\ \nFormat Gif89a: [-optgif]\n"); if (XMDC_GUI == MDC_NO) { MdcPrntScrn("\ \n -optgif, --options-gif ask for GIF related options\ \n"); }else{ MdcPrntScrn("\ \n \ \n"); } #endif #if MDC_INCLUDE_INTF MdcPrntScrn("\ \nFormat InterFile: [-skip1 -nopath -one]\n\ \n -skip1, --skip-preview-slice skip first preview slice\ \n -nopath, --ignore-path ignore path in \'name of data file\' key\ \n -one, --single-file write header and image to same file\ \n"); #endif if (XMDC_GUI == MDC_YES) MdcPrntScrn("\n"); } /* options for MedCon in particular */ void MdcPrintLocalOptions(void) { MdcPrntScrn("\n\n\ Patient/Slice/Study: [-anon|-ident] [-vifi]\n\ \n -anon, --anonymous make patient/study anonymous\ \n -ident, --identify ask for patient/study information\ \n -vifi, --edit-fileinfo edit internal entries (images/slice/origent)\ \n"); MdcPrntScrn("\n\ Reslicing: [-tra|-sag|-cor]\n\ \n -tra, --tranverse reslice images transverse\ \n -sag, --sagittal reslice images sagittal\ \n -cor, --coronal reslice images coronal\ \n"); MdcPrntScrn("\n\ Debug/Mode: [-d -v -db -hackacr -ean]\n\ \n -d, --debug give debug information (printout FI)\ \n -s, --silent force silent mode, suppress all messages\ \n -v, --verbose run in verbose mode\ \n -db, --database print database info\ \n -ean, --echo-alias-name echo alias name on screen\ \n"); #if MDC_INCLUDE_ACR MdcPrntScrn("\ \n -hackacr, --hack-acrtags try to locate and interpret acr tags in file\ \n"); #endif MdcPrntScrn("\n"); } void MdcPrintShortInfo(void) { if (XMDC_GUI == MDC_YES) { MdcPrntScrn("\nGUI X Window System"); }else{ MdcPrntScrn("\nCLI"); } MdcPrntScrn(" Medical Image Conversion Utility\n"); MdcPrntScrn("(X)MedCon %s\n",MdcGetLibShortVersion()); MdcPrntScrn("Copyright (C) 1997-2016 by Erik Nolf\n\n"); if (XMDC_GUI == MDC_YES) { MdcPrntScrn("Try \'xmedcon --help\' for more information.\n\n"); }else{ MdcPrntScrn("Try \'medcon --help\' for more information.\n\n"); #ifdef _WIN32 fflush(NULL); MdcWaitForEnter(-1); #endif } } void MdcPrintUsage(char *pgrname) { /* allow usage info to stdout */ /* |more only catches stdout */ MDC_FILE_STDOUT = MDC_NO; if (pgrname == NULL) { /* usage for MedCon in particular */ MdcPrintShortInfo(); MdcPrntScrn("\nUsage:\n\n"); MdcPrntScrn(" medcon [options] -f ...\n"); MdcPrntScrn("\n"); MdcPrntScrn("Flags:\n\n"); MdcPrntScrn(" -f, --file, --files file or list of files to handle\n"); MdcPrntScrn("\n"); MdcPrntScrn("General: [-i -e -r -w] [-p -pa|-c ...] "); MdcPrntScrn("[-o ]\n"); MdcPrntScrn("\n"); MdcPrntScrn(" -e, --extract extract images from file\n"); MdcPrntScrn(" -i, --interactive read raw files after user input\n"); MdcPrntScrn(" -o, --output-name output name set from command-line\n"); MdcPrntScrn(" -p, --print-values print values of specified pixels\n"); MdcPrntScrn(" -pa, --print-all-values print all values without asking\n"); MdcPrntScrn(" -r, --rename-file rename file after user input\n"); MdcPrntScrn(" -w, --overwrite-files always overwrite files\n"); MdcPrintGlobalOptions(); MdcPrintLocalOptions(); }else{ /* usage for any derived program */ MdcPrntScrn("\nUsage:\n\n"); MdcPrntScrn(" %s [options] -f ...\n",pgrname); if (XMDC_GUI == MDC_NO) { MdcPrntScrn("\n"); MdcPrntScrn("Options: General: [-c ...] [-o ]\n"); } MdcPrintGlobalOptions(); } exit(0); } int MdcHandleArgs(FILEINFO *fi, int argc, char *argv[], int MAXFILES) { int a,ARG=-1, DO_STDIN=MDC_NO; char **files = mdc_arg_files; int *convs = mdc_arg_convs; int *total = mdc_arg_total; char *pset = NULL; MdcExtractInputStruct *input = &mdcextractinput; /* limit number of files */ if (MAXFILES > MDC_MAX_FILES || MAXFILES <= 0) MAXFILES = MDC_MAX_FILES; fi->map = MDC_MAP_GRAY; /* default color map */ if ( argc == 1 ) return(MDC_BAD_CODE); /* initialize some stuff */ files[0]=NULL; memset(convs,0,sizeof(int)*MDC_MAX_FRMTS); memset(total,0,sizeof(int)*2); mdcbufr[0]='\0'; for (a=1; aINTERACTIVE = MDC_YES; input->list[0]='\0'; } continue; }else if ( (strcasecmp(argv[a],"-db") == 0) || (strcasecmp(argv[a],"--database") == 0) ) { if (XMDC_GUI == MDC_NO) { MDC_INFO_DB = MDC_YES; MDC_INFO = MDC_NO; } continue; }else if ( (strcasecmp(argv[a],"-alias") == 0) || (strcasecmp(argv[a],"--alias-naming") == 0) ) { MDC_ALIAS_NAME = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-ean") == 0) || (strcasecmp(argv[a],"--echo-alias-name") == 0) ) { if (XMDC_GUI == MDC_NO) { MDC_ECHO_ALIAS = MDC_YES; MDC_INFO = MDC_NO; if (MDC_BLOCK_MESSAGES == MDC_NO) MDC_BLOCK_MESSAGES = MDC_LEVEL_WARN; } continue; }else if ( (strcasecmp(argv[a],"-noprefix") == 0) || (strcasecmp(argv[a],"--without-prefix") == 0) ) { MDC_PREFIX_DISABLED = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-preacq") == 0) || (strcasecmp(argv[a],"--prefix-acquisition") == 0) ) { MDC_PREFIX_ACQ = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-preser") == 0) || (strcasecmp(argv[a],"--prefix-series") == 0) ) { MDC_PREFIX_SER = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-uin") == 0) || (strcasecmp(argv[a],"--use-institution-name") == 0) ) { a+=1; if (a < argc) MdcStringCopy(MDC_INSTITUTION,argv[a],strlen(argv[a])); continue; }else if ( (strcasecmp(argv[a],"-splits") == 0) || (strcasecmp(argv[a],"-split3d") == 0) || (strcasecmp(argv[a],"-split3D") == 0) || (strcasecmp(argv[a],"--split-slices") == 0) ) { MDC_FILE_SPLIT = MDC_SPLIT_PER_SLICE; continue; }else if ( (strcasecmp(argv[a],"-splitf") == 0) || (strcasecmp(argv[a],"-split4d") == 0) || (strcasecmp(argv[a],"-split4D") == 0) || (strcasecmp(argv[a],"--split-frames") == 0) ) { MDC_FILE_SPLIT = MDC_SPLIT_PER_FRAME; continue; }else if ( (strcasecmp(argv[a],"-stacks") == 0) || (strcasecmp(argv[a],"-stack3d") == 0) || (strcasecmp(argv[a],"-stack3D") == 0) || (strcasecmp(argv[a],"--stack-slices") == 0) ) { MDC_FILE_STACK = MDC_STACK_SLICES; continue; }else if ( (strcasecmp(argv[a],"-stackf") == 0) || (strcasecmp(argv[a],"-stack4d") == 0) || (strcasecmp(argv[a],"-stack4D") == 0) || (strcasecmp(argv[a],"--stack-frames") == 0) ) { MDC_FILE_STACK = MDC_STACK_FRAMES; continue; }else if ( (strcasecmp(argv[a],"-anon") == 0) || (strcasecmp(argv[a],"--anonymous") == 0) ) { if (XMDC_GUI == MDC_NO) { MDC_PATIENT_ANON = MDC_YES; } continue; }else if ( (strcasecmp(argv[a],"-ident") == 0) || (strcasecmp(argv[a],"--identify") == 0) ) { if (XMDC_GUI == MDC_NO) { MDC_PATIENT_IDENT = MDC_YES; } continue; }else if ( (strcasecmp(argv[a],"-o") == 0) || (strcasecmp(argv[a],"--output-name") == 0) ) { a+=1; if ((XMDC_GUI == MDC_NO) && (a < argc)) mdcbasename = argv[a]; continue; }else if ( (strcasecmp(argv[a],"-p") == 0) || (strcasecmp(argv[a],"--print-values") == 0) ) { if (XMDC_GUI == MDC_NO) { MDC_PIXELS=MDC_YES; MDC_INFO=MDC_NO; MDC_NEGATIVE=MDC_YES; MDC_CALIBRATE=MDC_YES; } continue; }else if ( (strcasecmp(argv[a],"-pa") == 0) || (strcasecmp(argv[a],"--print-all-values") == 0) ) { if (XMDC_GUI == MDC_NO) { MDC_PIXELS=MDC_YES; MDC_INFO=MDC_NO; MDC_NEGATIVE=MDC_YES; MDC_CALIBRATE=MDC_YES; MDC_PIXELS_PRINT_ALL=MDC_YES; } continue; }else if ( (strcasecmp(argv[a],"-r") == 0) || (strcasecmp(argv[a],"--rename-file") == 0) ) { if (XMDC_GUI == MDC_NO) { MDC_RENAME = MDC_YES; } continue; }else if ( (strcasecmp(argv[a],"-w") == 0) || (strcasecmp(argv[a],"--overwrite-files") == 0) ) { if (XMDC_GUI == MDC_NO) { MDC_FILE_OVERWRITE = MDC_YES; } continue; }else if ( (strcasecmp(argv[a],"-f") == 0) || (strcasecmp(argv[a],"--file") == 0) || (strcasecmp(argv[a],"--files") == 0)) {/* begin list of files */ ARG=MDC_ARG_FILE; continue; }else if ( (strcasecmp(argv[a],"-n") == 0) || (strcasecmp(argv[a],"--negatives") == 0) ) { MDC_NEGATIVE=MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-q") == 0) || (strcasecmp(argv[a],"--quantitation") == 0)) { MDC_CALIBRATE=MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-qs") == 0) || (strcasecmp(argv[a],"--quantification") == 0) ) { MDC_QUANTIFY=MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-qc") == 0) || (strcasecmp(argv[a],"--calibration") == 0) ) { MDC_CALIBRATE=MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-24") == 0) || (strcasecmp(argv[a],"--true-color") == 0) ) { MDC_COLOR_MODE = MDC_COLOR_RGB; continue; }else if ( (strcasecmp(argv[a],"-8") == 0) || (strcasecmp(argv[a],"--indexed-color") == 0) ) { MDC_COLOR_MODE = MDC_COLOR_INDEXED; continue; }else if ( (strcasecmp(argv[a],"-mr") == 0) || (strcasecmp(argv[a],"--map-rainbow") == 0) ) { MDC_COLOR_MAP = MDC_MAP_RAINBOW; MDC_MAKE_GRAY = MDC_YES; MDC_COLOR_MODE = MDC_COLOR_INDEXED; continue; }else if ( (strcasecmp(argv[a],"-mc") == 0) || (strcasecmp(argv[a],"--map-combined") == 0) ) { MDC_COLOR_MAP = MDC_MAP_COMBINED; MDC_MAKE_GRAY = MDC_YES; MDC_COLOR_MODE = MDC_COLOR_INDEXED; continue; }else if ( (strcasecmp(argv[a],"-mh") == 0) || (strcasecmp(argv[a],"--map-hotmetal") == 0) ) { MDC_COLOR_MAP = MDC_MAP_HOTMETAL; MDC_MAKE_GRAY = MDC_YES; MDC_COLOR_MODE = MDC_COLOR_INDEXED; continue; }else if ( (strcasecmp(argv[a],"-mi") == 0) || (strcasecmp(argv[a],"--map-inverted") == 0) ) { MDC_COLOR_MAP = MDC_MAP_INVERTED; MDC_MAKE_GRAY = MDC_YES; MDC_COLOR_MODE = MDC_COLOR_INDEXED; continue; }else if ( (strcasecmp(argv[a],"-g") == 0) || (strcasecmp(argv[a],"--make-gray") == 0) ) { MDC_COLOR_MAP = MDC_MAP_GRAY; MDC_MAKE_GRAY = MDC_YES; MDC_COLOR_MODE = MDC_COLOR_INDEXED; continue; }else if ( (strcasecmp(argv[a],"-dith") == 0) || (strcasecmp(argv[a],"--dither-color") == 0) ) { MDC_DITHER_COLOR = MDC_YES; MDC_COLOR_MODE = MDC_COLOR_INDEXED; continue; }else if ( (strcasecmp(argv[a],"-lut") == 0) || (strcasecmp(argv[a],"--load-lut") == 0) ) { a+=1; if ((a < argc) && (MdcLoadLUT(argv[a]) == MDC_YES)) { MDC_COLOR_MAP = MDC_MAP_LOADED; MDC_MAKE_GRAY = MDC_YES; MDC_COLOR_MODE = MDC_COLOR_INDEXED; } continue; #if MDC_INCLUDE_GIF }else if ( (strcasecmp(argv[a],"-optgif") == 0) || (strcasecmp(argv[a],"--options-gif") == 0) ) { MDC_GIF_OPTIONS = MDC_YES; continue; #endif #if MDC_INCLUDE_ACR }else if ( (strcasecmp(argv[a],"-hackacr") == 0) || (strcasecmp(argv[a],"--hack-acrtags") == 0) ) { MDC_HACK_ACR = MDC_YES; continue; #endif #if MDC_INCLUDE_ANLZ }else if ( (strcasecmp(argv[a],"-spm") == 0) || (strcasecmp(argv[a],"--analyze-spm") == 0) ) { MDC_ANLZ_SPM = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-optspm") == 0) || (strcasecmp(argv[a],"--options-spm") == 0) ) { MDC_ANLZ_OPTIONS = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-fb-anlz") == 0) || (strcasecmp(argv[a],"--fallback-analyze") == 0) ) { MDC_FALLBACK_FRMT = MDC_FRMT_ANLZ; continue; #endif #if MDC_INCLUDE_CONC }else if ( (strcasecmp(argv[a],"-fb-conc") == 0) || (strcasecmp(argv[a],"--fallback-concorde") == 0) ) { MDC_FALLBACK_FRMT = MDC_FRMT_CONC; continue; #endif #if MDC_INCLUDE_ECAT }else if ( (strcasecmp(argv[a],"-fb-ecat") == 0) || (strcasecmp(argv[a],"--fallback-ecat") == 0) ) { MDC_FALLBACK_FRMT = MDC_FRMT_ECAT6; continue; }else if ( (strcasecmp(argv[a],"-byframe") == 0) || (strcasecmp(argv[a],"--sort-by-frame") == 0) ) { MDC_ECAT6_SORT = MDC_BYFRAME; continue; #endif #if MDC_INCLUDE_DICM }else if ( (strcasecmp(argv[a],"-fb-dicom") == 0) || (strcasecmp(argv[a],"--fallback-dicom") == 0) ) { MDC_FALLBACK_FRMT = MDC_FRMT_DICM; continue; }else if ( strstr(argv[a],"-si=") != NULL ) { MDC_FORCE_RESCALE = MDC_YES; MDC_CALIBRATE = MDC_YES; sscanf(argv[a],"-si=%f:%f",&mdc_si_slope,&mdc_si_intercept); continue; }else if ( strstr(argv[a],"-cw=") != NULL ) { MDC_FORCE_CONTRAST = MDC_YES; MDC_CONTRAST_REMAP = MDC_YES; sscanf(argv[a],"-cw=%f:%f",&mdc_cw_centre,&mdc_cw_width); continue; }else if ( (strcasecmp(argv[a],"-mosaic") == 0) || (strcasecmp(argv[a],"--enable-mosaic") == 0) ) { MDC_DICOM_MOSAIC_ENABLED = MDC_YES; continue; }else if ((pset=strstr(argv[a],"-fmosaic=")) != NULL) { MDC_DICOM_MOSAIC_ENABLED = MDC_YES; MDC_DICOM_MOSAIC_FORCED = MDC_YES; MdcLowStr(pset); sscanf(pset,"-fmosaic=%ux%ux%u",&mdc_mosaic_width ,&mdc_mosaic_height ,&mdc_mosaic_number); continue; }else if ((pset=strstr(argv[a],"--force-mosaic=")) != NULL) { MDC_DICOM_MOSAIC_ENABLED = MDC_YES; MDC_DICOM_MOSAIC_FORCED = MDC_YES; MdcLowStr(pset); sscanf(pset,"--force-mosaic=%ux%ux%u",&mdc_mosaic_width ,&mdc_mosaic_height ,&mdc_mosaic_number); continue; }else if ( (strcasecmp(argv[a],"-mfixv") == 0) || (strcasecmp(argv[a],"--mosaic-fix-voxel") == 0) ) { MDC_DICOM_MOSAIC_FIX_VOXEL = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-interl") == 0) || (strcasecmp(argv[a],"--mosaic-interlaced") == 0) ) { MDC_DICOM_MOSAIC_DO_INTERL = MDC_YES; mdc_mosaic_interlaced = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-gap") == 0) || (strcasecmp(argv[a],"--spacing-true-gap") == 0) ) { MDC_TRUE_GAP = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-contrast") == 0) || (strcasecmp(argv[a],"--enable-contrast") == 0) ) { MDC_CONTRAST_REMAP = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-implicit") == 0) || (strcasecmp(argv[a],"--write-implicit") == 0) ) { MDC_DICOM_WRITE_IMPLICIT = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-nometa") == 0) || (strcasecmp(argv[a],"--write-without-meta") == 0) ) { MDC_DICOM_WRITE_NOMETA = MDC_YES; continue; #endif }else if ( (strcasecmp(argv[a],"-fb-none") == 0) || (strcasecmp(argv[a],"--without-fallback") == 0) ) { MDC_FALLBACK_FRMT = MDC_FRMT_NONE; continue; }else if ( (strcasecmp(argv[a],"-d") == 0) || (strcasecmp(argv[a],"--debug") == 0) ) { MDC_DEBUG = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-nf") == 0) || (strcasecmp(argv[a],"--norm-over-frames") == 0) ) { MDC_NORM_OVER_FRAMES = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-v") == 0) || (strcasecmp(argv[a],"--verbose") == 0) ) { MDC_VERBOSE = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-b8") == 0) || (strcasecmp(argv[a],"--unsigned-char") == 0) ) { MDC_FORCE_INT = BIT8_U; continue; }else if ( (strcasecmp(argv[a],"-b16") == 0) || (strcasecmp(argv[a],"--signed-short") == 0) ) { MDC_FORCE_INT = BIT16_S; MDC_INT16_BITS_USED=16; continue; }else if ( strcasecmp(argv[a],"-b16.12") == 0 ) { MDC_FORCE_INT = BIT16_S; MDC_INT16_BITS_USED=12; continue; }else if ( strcasecmp(argv[a],"-debuging") == 0 ) { /* undocumented */ MDC_MY_DEBUG = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-vifi") == 0) || (strcasecmp(argv[a],"--edit-fileinfo") == 0) ) { MDC_EDIT_FI = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-big") == 0) || (strcasecmp(argv[a],"--big-endian") == 0) ) { MDC_WRITE_ENDIAN=MDC_BIG_ENDIAN; continue; }else if ( (strcasecmp(argv[a],"-little") == 0) || (strcasecmp(argv[a],"--little-endian") == 0) ) { MDC_WRITE_ENDIAN=MDC_LITTLE_ENDIAN; continue; }else if ( (strcasecmp(argv[a],"-skip1") == 0) || (strcasecmp(argv[a],"--skip-preview-slice") == 0) ) { MDC_SKIP_PREVIEW=MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-nopath") == 0) || (strcasecmp(argv[a],"--ignore-path") == 0) ) { MDC_IGNORE_PATH=MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-one") == 0) || (strcasecmp(argv[a],"--single-file") == 0) ) { MDC_SINGLE_FILE=MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-tra") == 0) || (strcasecmp(argv[a],"--transverse") == 0) ) { MDC_RESLICE = MDC_TRANSAXIAL; continue; }else if ( (strcasecmp(argv[a],"-sag") == 0) || (strcasecmp(argv[a],"--sagittal") == 0) ) { MDC_RESLICE = MDC_SAGITTAL; continue; }else if ( (strcasecmp(argv[a],"-cor") == 0) || (strcasecmp(argv[a],"--coronal") == 0) ) { MDC_RESLICE = MDC_CORONAL; continue; }else if ( (strcasecmp(argv[a],"-fh") == 0) || (strcasecmp(argv[a],"--flip-horizontal") == 0) ) { MDC_FLIP_HORIZONTAL = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-fv") == 0) || (strcasecmp(argv[a],"--flip-vertical") == 0) ) { MDC_FLIP_VERTICAL = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-rs") == 0) || (strcasecmp(argv[a],"--reverse-slices") == 0) ) { MDC_SORT_REVERSE = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-cs") == 0) || (strcasecmp(argv[a],"--cine-sorting") == 0) ) { MDC_SORT_CINE_APPLY = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-cu") == 0) || (strcasecmp(argv[a],"--cine-undo") == 0) ) { MDC_SORT_CINE_UNDO = MDC_YES; continue; }else if ( (strcasecmp(argv[a],"-sqr") == 0) || (strcasecmp(argv[a],"--make-square") == 0) ) { MDC_MAKE_SQUARE = MDC_TRANSF_SQR1; continue; }else if ( (strcasecmp(argv[a],"-sqr2") == 0) || (strcasecmp(argv[a],"--make-square-two") == 0) ) { MDC_MAKE_SQUARE = MDC_TRANSF_SQR2; continue; }else if ( (strcasecmp(argv[a],"-pad") == 0) || (strcasecmp(argv[a],"--pad-around") == 0) ) { MDC_PADDING_MODE = MDC_PAD_AROUND; continue; }else if ( (strcasecmp(argv[a],"-padtl") == 0) || (strcasecmp(argv[a],"--pad-top-left") == 0) ) { MDC_PADDING_MODE = MDC_PAD_TOP_LEFT; continue; }else if ( (strcasecmp(argv[a],"-padbr") == 0) || (strcasecmp(argv[a],"--pad-bottom-right") == 0) ) { MDC_PADDING_MODE = MDC_PAD_BOTTOM_RIGHT; continue; }else if ((pset=strstr(argv[a],"-crop=")) != NULL) { MDC_CROP_IMAGES = MDC_YES; MdcLowStr(pset); sscanf(pset,"-crop=%u:%u:%u:%u",&mdc_crop_xoffset ,&mdc_crop_yoffset ,&mdc_crop_width ,&mdc_crop_height); continue; }else if ((pset=strstr(argv[a],"--crop-images=")) != NULL) { MDC_CROP_IMAGES = MDC_YES; MdcLowStr(pset); sscanf(pset,"--crop-images=%u:%u:%u:%u",&mdc_crop_xoffset ,&mdc_crop_yoffset ,&mdc_crop_width ,&mdc_crop_height); continue; }else if ( (strcasecmp(argv[a],"-s") == 0) || (strcasecmp(argv[a],"--silent") == 0) ) { MDC_BLOCK_MESSAGES = MDC_LEVEL_ALL; continue; } if ( ARG == -1 ) return(MDC_BAD_CODE); /* no '-c' or '-f' */ switch (ARG) { case MDC_ARG_CONV: if ( strcasecmp(argv[a],"ascii")== 0) { convs[MDC_FRMT_ASCII]+=1; total[MDC_CONVS]+=1; }else if ( strcasecmp(argv[a],"bin") == 0) { convs[MDC_FRMT_RAW]+=1; total[MDC_CONVS]+=1; }else #if MDC_INCLUDE_ACR if ( strcasecmp(argv[a],"acr") == 0 ) { convs[MDC_FRMT_ACR]+=1; total[MDC_CONVS]+=1; }else #endif #if MDC_INCLUDE_GIF if ( strcasecmp(argv[a],"gif") == 0 ) { convs[MDC_FRMT_GIF]+=1; total[MDC_CONVS]+=1; }else #endif #if MDC_INCLUDE_INW if ( strcasecmp(argv[a],"inw") == 0 ) { convs[MDC_FRMT_INW]+=1; total[MDC_CONVS]+=1; }else #endif #if MDC_INCLUDE_CONC if ( strcasecmp(argv[a],"conc") == 0 ) { convs[MDC_FRMT_CONC]+=1; total[MDC_CONVS]+=1; }else #endif #if MDC_INCLUDE_ECAT if ( strcasecmp(argv[a],"ecat") == 0 || strcasecmp(argv[a],"ecat6") == 0 ) { convs[MDC_FRMT_ECAT6]+=1; total[MDC_CONVS]+=1; }else #if MDC_INCLUDE_TPC if ( strcasecmp(argv[a],"ecat7") == 0 ) { convs[MDC_FRMT_ECAT7]+=1; total[MDC_CONVS]+=1; }else #endif #endif #if MDC_INCLUDE_INTF if ( strcasecmp(argv[a],"intf") == 0 ) { convs[MDC_FRMT_INTF]+=1; total[MDC_CONVS]+=1; }else #endif #if MDC_INCLUDE_ANLZ if ( strcasecmp(argv[a],"anlz") == 0 ) { convs[MDC_FRMT_ANLZ]+=1; total[MDC_CONVS]+=1; }else #endif #if MDC_INCLUDE_DICM if ( strcasecmp(argv[a],"dicom") == 0) { convs[MDC_FRMT_DICM]+=1; total[MDC_CONVS]+=1; }else #if MDC_INCLUDE_PNG if ( strcasecmp(argv[a],"png") == 0) { convs[MDC_FRMT_PNG]+=1; total[MDC_CONVS]+=1; }else #endif #if MDC_INCLUDE_NIFTI if ( strcasecmp(argv[a],"nifti") == 0) { convs[MDC_FRMT_NIFTI]+=1; total[MDC_CONVS]+=1; }else #endif #endif if ( strcasecmp(argv[a],"-") == 0) { MDC_FILE_STDOUT = MDC_YES; }else MdcPrntErr(MDC_BAD_CODE,"Unsupported conversion \"%s\"",argv[a]); break; case MDC_ARG_FILE: if (MDC_FILE_STDIN == MDC_NO) { /* input from files */ if ( total[MDC_FILES] == MAXFILES) MdcPrntErr(MDC_OVER_FLOW,"Too many files specified (max=%d)" ,MAXFILES); else files[total[MDC_FILES]]=argv[a]; total[MDC_FILES]+=1; }else{ /* input from stdin */ /* format specification of stdin file so no MdcCheckFrmt() needed */ /* otherwise a seek is needed, thus eleminating pipes support */ #if MDC_INCLUDE_ACR if ( strcasecmp(argv[a],"acr") == 0 ) { MdcPrntErr(MDC_NO_CODE,"ACR is unsupported in pipes (seek)"); DO_STDIN = MDC_YES; MDC_FRMT_INPUT = MDC_FRMT_ACR; }else #endif #if MDC_INCLUDE_GIF if ( strcasecmp(argv[a],"gif") == 0 ) { DO_STDIN = MDC_YES; MDC_FRMT_INPUT = MDC_FRMT_GIF; }else #endif #if MDC_INCLUDE_INW if ( strcasecmp(argv[a],"inw") == 0 ) { DO_STDIN = MDC_YES; MDC_FRMT_INPUT = MDC_FRMT_INW; }else #endif #if MDC_INCLUDE_CONC if ( strcasecmp(argv[a],"conc") == 0) { DO_STDIN = MDC_YES; MDC_FRMT_INPUT = MDC_FRMT_CONC; }else #endif #if MDC_INCLUDE_ECAT if ( strcasecmp(argv[a],"ecat") == 0 || strcasecmp(argv[a],"ecat6") == 0 ) { MdcPrntErr(MDC_NO_CODE,"ECAT6 is unsupported in pipes (seek)"); DO_STDIN = MDC_YES; MDC_FRMT_INPUT = MDC_FRMT_ECAT6; }else #if MDC_INCLUDE_TPC if ( strcasecmp(argv[a],"ecat7") == 0) { MdcPrntErr(MDC_NO_CODE,"ECAT7 is unsupported in pipes"); DO_STDIN = MDC_YES; MDC_FRMT_INPUT = MDC_FRMT_ECAT7; }else #endif #endif #if MDC_INCLUDE_INTF if ( strcasecmp(argv[a],"intf") == 0) { DO_STDIN = MDC_YES; MDC_FRMT_INPUT = MDC_FRMT_INTF; }else #endif #if MDC_INCLUDE_ANLZ if ( strcasecmp(argv[a],"anlz") == 0) { MdcPrntErr(MDC_NO_CODE,"ANLZ is unsupported in pipes (seek)"); DO_STDIN = MDC_YES; MDC_FRMT_INPUT = MDC_FRMT_ANLZ; }else #endif #if MDC_INCLUDE_DICM if ( strcasecmp(argv[a],"dicom") == 0) { MdcPrntErr(MDC_NO_CODE,"DICOM is unsupported in pipes (seek)"); DO_STDIN = MDC_YES; MDC_FRMT_INPUT = MDC_FRMT_DICM; }else #endif #if MDC_INCLUDE_PNG if ( strcasecmp(argv[a],"png") == 0) { DO_STDIN = MDC_YES; MDC_FRMT_INPUT = MDC_FRMT_PNG; }else #endif #if MDC_INCLUDE_NIFTI if ( strcasecmp(argv[a],"nifti") == 0) { DO_STDIN = MDC_YES; MDC_FRMT_INPUT = MDC_FRMT_NIFTI; }else #endif { DO_STDIN = MDC_NO; MDC_FRMT_INPUT = MDC_FRMT_NONE; } } if (strcmp(argv[a],"-") == 0) DO_STDIN = MDC_YES; if (DO_STDIN == MDC_YES) { files[0]=argv[a]; total[MDC_FILES] = 1; DO_STDIN = MDC_NO; MDC_FILE_STDIN = MDC_YES; } break; case MDC_ARG_EXTRACT: if (isdigit((int)argv[a][0])) { if (strlen(input->list) + strlen(argv[a]) < MDC_MAX_LIST) { strcat(input->list,argv[a]); strcat(input->list," "); }else{ MdcPrntErr(MDC_NO_CODE,"Extraction list too big for buffer"); } input->INTERACTIVE = MDC_NO; }else{ ARG = MDC_ARG_FILE; } break; } } /* options shown but not available for GUI front-end */ if (XMDC_GUI == MDC_YES) { if (MDC_FILE_STACK != MDC_NO) { MdcPrntWarn("Options '-stack' not available to GUI front-end"); } if ((MDC_GIF_OPTIONS == MDC_YES) || (MDC_ANLZ_OPTIONS == MDC_YES)) { MdcPrntWarn("Options '-opt***' not available to GUI front-end"); } } /* split / stack mutually exclusive */ if ((MDC_FILE_STACK != MDC_NO) && (MDC_FILE_SPLIT != MDC_NO)) { MdcPrntErr(MDC_NO_CODE,"Options '-stack' and '-split' mutually exclusive"); } /* stack only in true color */ if ((MDC_FILE_STACK != MDC_NO) && (MDC_COLOR_MODE == MDC_COLOR_INDEXED)) { MdcPrntErr(MDC_NO_CODE,"Stacking only supported for true color or gray"); } /* print database info; legacy option, just used within ECAT */ if (MDC_INFO_DB == MDC_YES) { if (total[MDC_FILES] > 1) MdcPrntErr(MDC_NO_CODE,"Option '-db' only usefull one file at a time"); if (MDC_CONVERT == MDC_YES) MdcPrntErr(MDC_NO_CODE,"Option '-db' useless with '-c' conversion"); } /* echo alias name; single option allowed */ if (MDC_ECHO_ALIAS == MDC_YES) { if (total[MDC_FILES] > 1) MdcPrntErr(MDC_NO_CODE,"Option '-ean' only usefull one file at a time"); if (MDC_CONVERT == MDC_YES) MdcPrntErr(MDC_NO_CODE,"Option '-ean' useless with '-c' conversion"); } /* useless sorting selections */ if ((MDC_SORT_CINE_APPLY == MDC_YES) && (MDC_SORT_CINE_UNDO == MDC_YES)) { MDC_SORT_CINE_APPLY = MDC_NO; MDC_SORT_CINE_UNDO = MDC_NO; } /* in case of alias filenaming, disable other options */ if (MDC_ALIAS_NAME == MDC_YES) { MDC_RENAME = MDC_NO; mdcbasename = NULL; } /* need an image file, except for XMedCon GUI */ if ( (total[MDC_FILES] == 0) && (XMDC_GUI == MDC_NO) ) MdcPrntErr(MDC_NO_CODE,"No files specified"); /* checks related to file writing to stdout */ if (MDC_FILE_STDOUT == MDC_YES) { if (MDC_VERBOSE == MDC_YES) MdcPrntErr(MDC_NO_CODE,"Option '-v' disallowed with stdout file writing"); if ((total[MDC_FILES] > 1) && (MDC_FILE_STACK == MDC_NO)) MdcPrntErr(MDC_NO_CODE,"Only one file supported when writing to stdout"); if (total[MDC_CONVS] > 1) MdcPrntErr(MDC_NO_CODE,"Only one format allowed when writing to stdout"); if (MDC_INTERACTIVE == MDC_YES) MdcPrntErr(MDC_NO_CODE,"Interactive read impossible with stdout"); if (MDC_SINGLE_FILE == MDC_YES) MdcPrntErr(MDC_NO_CODE,"Single file output unsupported with stdout"); } /* checks related to file input from stdin */ if (MDC_FILE_STDIN == MDC_YES) { if (MDC_HACK_ACR == MDC_YES) MdcPrntErr(MDC_NO_CODE,"Hack ACR from stdin not allowed"); if (MDC_INTERACTIVE == MDC_YES) MdcPrntErr(MDC_NO_CODE,"Interactive read impossible from stdin"); } /* quantification troubles */ if (MDC_INFO == MDC_YES) { if (MDC_QUANTIFY == MDC_YES) { MDC_NEGATIVE=MDC_YES; MDC_CALIBRATE=MDC_NO; }else{ MDC_NEGATIVE=MDC_YES; MDC_CALIBRATE=MDC_YES; } } if ((MDC_ANLZ_SPM == MDC_YES) && (MDC_QUANTIFY == MDC_NO) && (MDC_CALIBRATE == MDC_NO) ) MdcPrntWarn("For SPM scaling you should select a quantification option"); if (MDC_INTERACTIVE == MDC_YES) { MdcPrntWarn("Enabling negative pixels & disabling quantification"); MDC_NEGATIVE = MDC_YES; MDC_QUANTIFY = MDC_NO; MDC_CALIBRATE = MDC_NO; } if ( (MDC_PIXELS == MDC_YES) && (MDC_QUANTIFY == MDC_YES) ) MDC_CALIBRATE = MDC_NO; /* conversion related issues */ if ((MDC_CONVERT == MDC_YES) || (XMDC_GUI == MDC_YES)) { /* with output file */ if (XMDC_GUI == MDC_NO) { if ( total[MDC_CONVS] == 0 ) MdcPrntErr(MDC_NO_CODE,"No conversion formats specified"); if (MDC_PIXELS == MDC_YES) MdcPrntErr(MDC_NO_CODE,"Options '-c' & '-p(a)' are mutually exclusive"); } }else{ /* without output file */ if (MDC_RENAME == MDC_YES) MdcPrntErr(MDC_NO_CODE,"Option '-r' requires '-c' conversion specified"); if (MDC_EXTRACT == MDC_YES) MdcPrntErr(MDC_NO_CODE,"Option '-e' requires '-c' conversion specified"); } /* study identification */ if ( (MDC_PATIENT_ANON == MDC_YES) && (MDC_PATIENT_IDENT == MDC_YES) ) MdcPrntErr(MDC_NO_CODE,"Options '-anon' & '-ident' are mutually exclusive"); /* the must do FINAL quantification/calibration check */ if ( (MDC_QUANTIFY == MDC_YES) && (MDC_CALIBRATE == MDC_YES) ) MdcPrntErr(MDC_NO_CODE,"Options '-qs' & '-qc' are mutually exclusive"); /* some checks on mosaic settings */ if ( (MDC_DICOM_MOSAIC_DO_INTERL == MDC_YES) && (MDC_DICOM_MOSAIC_FORCED == MDC_NO) ) MdcPrntWarn("Option '-interl' requires mosaic forced"); /* color */ if (MDC_COLOR_MODE == MDC_COLOR_RGB) { if (MDC_MAKE_GRAY == MDC_YES) MdcPrntWarn("Option -24 overrides -g option"); if (MDC_DITHER_COLOR == MDC_YES) MdcPrntWarn("Option -24 overrides -dith option"); } /* giving an overview of settings */ if (MDC_VERBOSE ) { if (MDC_WRITE_ENDIAN == MDC_LITTLE_ENDIAN) MdcPrntMesg("Writing in little endian as default"); else MdcPrntMesg("Writing in big endian as default"); switch (MDC_FALLBACK_FRMT) { case MDC_FRMT_ANLZ: MdcPrntMesg("Read fallback format Analyze (SPM)"); break; case MDC_FRMT_DICM: MdcPrntMesg("Read fallback format DICOM 3.0"); break; case MDC_FRMT_CONC: MdcPrntMesg("Read fallback format Concorde/uPET"); break; case MDC_FRMT_ECAT6: MdcPrntMesg("Read fallback format ECAT 6.4"); break; } /* flags */ if (MDC_FILE_OVERWRITE == MDC_YES) MdcPrntMesg("Files overwrite is ON"); if (MDC_FILE_STDIN == MDC_YES) MdcPrntMesg("Input from stdin is ON"); if (MDC_FILE_STDOUT == MDC_YES) MdcPrntMesg("Output to stdout is ON"); if (MDC_QUANTIFY == MDC_YES) MdcPrntMesg("Quantification is ON (ECAT units=[counts/second/pixel])"); if (MDC_CALIBRATE == MDC_YES) MdcPrntMesg("Calibration is ON (ECAT units=[uCi/ml])"); if (MDC_NEGATIVE == MDC_YES) MdcPrntMesg("Negative pixels is ON"); if (MDC_CONTRAST_REMAP == MDC_YES) MdcPrntMesg("Contrast remapping is ON"); if (MDC_ANLZ_SPM == MDC_YES) MdcPrntMesg("Analyze for SPM is ON"); if (MDC_DICOM_MOSAIC_ENABLED == MDC_YES) MdcPrntMesg("Mosaic support is ON"); if (MDC_DICOM_MOSAIC_FORCED == MDC_YES) MdcPrntMesg("Mosaic forced is ON"); if (MDC_DICOM_MOSAIC_FIX_VOXEL == MDC_YES) MdcPrntMesg("Mosaic fix voxel is ON"); if (MDC_TRUE_GAP == MDC_YES) MdcPrntMesg("True gap/overlap is ON"); if (MDC_DICOM_WRITE_IMPLICIT == MDC_YES) MdcPrntMesg("Dicom implicit is ON"); if (MDC_DICOM_WRITE_NOMETA == MDC_YES) MdcPrntMesg("Dicom no meta is ON"); if (MDC_NORM_OVER_FRAMES == MDC_YES) MdcPrntMesg("Norm over frames is ON"); if (MDC_SKIP_PREVIEW == MDC_YES) MdcPrntMesg("Skip preview slice is ON"); if (MDC_IGNORE_PATH == MDC_YES) MdcPrntMesg("Ignore path fname is ON"); if (MDC_ALIAS_NAME == MDC_YES) MdcPrntMesg("Alias file name is ON"); if (MDC_PREFIX_DISABLED == MDC_YES) MdcPrntMesg("Disable prefix is ON"); if (MDC_FLIP_HORIZONTAL == MDC_YES) MdcPrntMesg("Flip horizontal is ON"); if (MDC_FLIP_VERTICAL == MDC_YES) MdcPrntMesg("Flip vertical is ON"); if (MDC_SORT_REVERSE == MDC_YES) MdcPrntMesg("Sort reverse is ON"); if (MDC_SORT_CINE_APPLY == MDC_YES) MdcPrntMesg("Sort cine apply is ON"); if (MDC_SORT_CINE_UNDO == MDC_YES) MdcPrntMesg("Sort cine undo is ON"); if (MDC_MAKE_SQUARE == MDC_TRANSF_SQR1) MdcPrntMesg("Make square images is ON"); if (MDC_MAKE_SQUARE == MDC_TRANSF_SQR2) MdcPrntMesg("Make square pwr2 is ON"); if (MDC_FORCE_CONTRAST == MDC_YES) MdcPrntMesg("DICOM contrast is ON"); if (MDC_FORCE_RESCALE == MDC_YES) MdcPrntMesg("DICOM rescale is ON"); if (MDC_COLOR_MODE == MDC_COLOR_RGB) MdcPrntMesg("Color 24 bits RGB is ON"); if (MDC_COLOR_MODE == MDC_COLOR_INDEXED) MdcPrntMesg("Color 8 bits map is ON"); if (MDC_DITHER_COLOR == MDC_YES) MdcPrntMesg("Color dithering is ON"); if (MDC_MAKE_GRAY == MDC_YES) MdcPrntMesg("Color to gray is ON"); if (MDC_FORCE_INT != MDC_NO) { switch (MDC_FORCE_INT) { case BIT8_U : MdcPrntMesg("Writing Uint8 pixs is ON (quantified values lost!)"); break; case BIT16_S: MdcPrntMesg("Writing Int16 pixs is ON (quantified values lost!)"); break; default : MdcPrntMesg("Writing Int16 pixs is ON (quantified values lost!)"); } if (MDC_INT16_BITS_USED == 12) MdcPrntMesg("Using only 12 bits is ON"); } } return(MDC_OK); } char *MdcApplyReadOptions(FILEINFO *fi) { char *msg=NULL; /* anonymize patient information */ if (MDC_PATIENT_ANON) MdcMakePatAnonymous(fi); /* ask for patient information */ if (MDC_PATIENT_IDENT) MdcGivePatInformation(fi); /* edit the FILEINFO structure */ if (MDC_EDIT_FI) { if ((msg = MdcEditFI(fi)) != NULL) return(msg); } /* print FILEINFO structure */ if (MDC_DEBUG) MdcPrintFI(fi); /* print out pixel requested values */ if (MDC_PIXELS) MdcDisplayPixels(fi); /* extract some images */ if (MDC_EXTRACT) { if ((msg = MdcExtractImages(fi)) != NULL) return(msg); } /* reslice images as specified */ if (MDC_RESLICE != MDC_NO) { if ((msg = MdcResliceImages(fi, MDC_RESLICE)) != NULL) return(msg); } /* rename base filename */ if (MDC_RENAME) MdcRenameFile(fi->ifname); return(NULL); } xmedcon-0.14.1/source/m-transf.c0000644000175000017510000003523512636253502013363 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-transf.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : simple slice transformation routines * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcFlipImgHorizontal() - Flip image horizontally (X) * * MdcFlipImgVertical() - Flip image vertically (Y) * * MdcFlipHorizontal() - Flip all horizontally (X) * * MdcFlipVertical() - Flip all vertically (Y) * * MdcSortReverse() - Reverse sorting * * MdcSortCineApply() - Apply cine sorting * * MdcSortCineUndo() - Undo cine sorting * * MdcMakeSquare() - Make all square * * MdcCropImages() - Crop image dimensions * * MdcMakeGray() - Make all gray scale * * MdcHandleColor() - Handle color images * * MdcContrastRemap() - Apply contrast remapping * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-transf.c,v 1.43 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "medcon.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcFlipImgHorizontal(IMG_DATA *id) { Uint8 *pix1, *pix2, *temp; Uint32 h, w, bytes; bytes = MdcType2Bytes(id->type); if ((temp=(Uint8 *)malloc(bytes)) == NULL) return(MDC_BAD_ALLOC); for (h=0; h < id->height; h++) { pix1 = &id->buf[bytes * ( h * id->width)]; pix2 = &id->buf[bytes * (((h+1) * id->width) - 1)]; for (w=0; w < (id->width/2); w++) { memcpy(temp,pix1,bytes); memcpy(pix1,pix2,bytes); memcpy(pix2,temp,bytes); pix1+=bytes; pix2-=bytes; } } MdcFree(temp); return(MDC_OK); } int MdcFlipImgVertical(IMG_DATA *id) { Uint8 *pix1, *pix2, *temp; Uint32 h, w, bytes, linebytes; bytes = MdcType2Bytes(id->type); if ((temp=(Uint8 *)malloc(bytes)) == NULL) return(MDC_BAD_ALLOC); linebytes = bytes * id->width; for (w=0; w < linebytes; w+=bytes) { pix1 = &id->buf[w]; pix2 = &id->buf[((id->height - 1) * linebytes) + w]; for (h=0; h < (id->height/2); h++) { memcpy(temp,pix1,bytes); memcpy(pix1,pix2,bytes); memcpy(pix2,temp,bytes); pix1+=linebytes; pix2-=linebytes; } } MdcFree(temp); return(MDC_OK); } char *MdcFlipHorizontal(FILEINFO *fi) { Uint32 i; int err; for (i=0; i < fi->number; i++) { err = MdcFlipImgHorizontal(&fi->image[i]); if (err != MDC_OK) return("FlipH - Couldn't malloc temp pixel"); } return(NULL); } char *MdcFlipVertical(FILEINFO *fi) { Uint32 i; int err; for (i=0; i < fi->number; i++) { err = MdcFlipImgVertical(&fi->image[i]); if (err != MDC_OK) return("FlipV - Couldn't malloc temp pixel"); } return(NULL); } char *MdcSortReverse(FILEINFO *fi) { IMG_DATA *id1, *id2, *tmp; Uint32 i, size, f, frames=1; if (fi->number == 1) return(NULL); size = sizeof(IMG_DATA); if ((tmp = (IMG_DATA *)malloc(size)) == NULL) return("SortRev - Couldn't malloc IMG_DATA tmp"); for (f=4; f <= fi->dim[0]; f++) frames*=fi->dim[f]; /* just reverse images within (time) frames */ for (f=0; f < frames; f++) for (i=0; i < (fi->dim[3]/2); i++) { id1 = &fi->image[i + fi->dim[3]*f]; id2 = &fi->image[fi->dim[3]*(f+1) - (i+1)]; memcpy(tmp,id1,size); memcpy(id1,id2,size); memcpy(id2,tmp,size); } MdcFree(tmp); return(NULL); } char *MdcSortCineApply(FILEINFO *fi) { IMG_DATA *tmp; Uint32 c, n, i, size; if (fi->number == fi->dim[3]) return(NULL); size = sizeof(IMG_DATA); if ((tmp = (IMG_DATA *)malloc(size * fi->number)) == NULL) return("SortCine - Couldn't malloc temporary IMG_DATA array"); for (c=0,n=0,i=0; i < fi->number; i++, n+=fi->dim[3]) { if (n >= fi->number) { c+=1; n = c; } memcpy(&tmp[i],&fi->image[n],size); } for (i=0; i < fi->number; i++) { memcpy(&fi->image[i],&tmp[i],size); } MdcFree(tmp); return(NULL); } char *MdcSortCineUndo(FILEINFO *fi) { IMG_DATA *tmp; Uint32 c, n, i, size; if (fi->dim[3] == fi->number) return(NULL); size = sizeof(IMG_DATA); if ((tmp = (IMG_DATA *)malloc(size * fi->number)) == NULL) return("SortNoCine - Couldn't malloc temporary IMG_DATA array"); for (c=0,n=0,i=0; i < fi->number; i++, n+=fi->dim[3]) { if (n >= fi->number) { c+=1; n = c; } memcpy(&tmp[n],&fi->image[i],size); } for (i=0; i < fi->number; i++) { memcpy(&fi->image[i],&tmp[i],size); } MdcFree(tmp); return(NULL); } char *MdcMakeSquare(FILEINFO *fi, int SQR_TYPE) { IMG_DATA *id; Uint32 i, dim; Uint8 *sqrbuf; /* get largest dim */ dim = (fi->mwidth > fi->mheight) ? fi->mwidth : fi->mheight; /* dims as a power of two */ if (SQR_TYPE == MDC_TRANSF_SQR2) dim = MdcCeilPwr2(dim); /* set to new dimensions */ fi->mwidth = dim; fi->mheight = dim; fi->dim[1] = dim; fi->dim[2] = dim; /* make square images */ for (i=0; inumber; i++) { id = &fi->image[i]; sqrbuf = MdcGetResizedImage(fi,id->buf,id->type,i); if (sqrbuf == NULL) return("Square - Couldn't create squared image"); id->width = dim; id->height = dim; MdcFree(id->buf); id->buf = sqrbuf; } /* finish settings */ fi->diff_size = MDC_NO; return(NULL); } char *MdcCropImages(FILEINFO *fi, MDC_CROP_INFO *ecrop) { MDC_CROP_INFO icrop, *crop; FILEINFO fi_tmp, *new=&fi_tmp, *cur=fi; IMG_DATA *newid, *curid; Uint8 *curbuf, *newbuf; Uint32 i, r, pixelbytes, curlinebytes, newlinebytes, newimgbytes; char *msg; /* initialize crop settings */ if (ecrop == NULL ) { crop = &icrop; crop->xoffset = mdc_crop_xoffset; crop->yoffset = mdc_crop_yoffset; crop->width = mdc_crop_width; crop->height = mdc_crop_height; }else{ crop = ecrop; } /* some sanity checks */ if ((cur == NULL) || (crop == NULL)) return(NULL); if (cur->diff_size == MDC_YES) return("Crop - Different sized slices unsupported"); if ((crop->width == 0) || (crop->height == 0)) return("Crop - Improper crop zero values"); if ((crop->xoffset >= cur->mwidth) || (crop->yoffset >= cur->mheight)) return("Crop - Improper crop offset values"); /* cut off */ if ((crop->xoffset + crop->width) > cur->mwidth ) crop->width = cur->mwidth - crop->xoffset; if ((crop->yoffset + crop->height) > cur->mheight) crop->height = cur->mheight - crop->yoffset; /* copy cur -> new */ MdcCopyFI(new,cur,MDC_NO,MDC_YES); /* set global parameters */ new->number = cur->number; new->mwidth = crop->width; new->dim[1] = crop->width; new->mheight= crop->height; new->dim[2] = crop->height; if (!MdcGetStructID(new,new->number)) { MdcCleanUpFI(new); return("Crop - Bad malloc IMG_DATA structs"); } /* crop image matrices */ for (i=0; inumber; i++) { newid = &new->image[i]; curid = &cur->image[i]; /* copy all image data */ MdcCopyID(newid,curid,MDC_YES); /* set new dimensions */ newid->width = crop->width; newid->height= crop->height; /* get some bytes values */ pixelbytes = MdcType2Bytes(newid->type); newlinebytes = pixelbytes * newid->width; newimgbytes = newlinebytes * newid->height; curlinebytes = pixelbytes * curid->width; /* set buffer pointers */ newbuf = newid->buf; curbuf = curid->buf; /* init and skip */ curbuf += crop->yoffset*curlinebytes + crop->xoffset*pixelbytes; for (r=0; r < newid->height; r++) { memcpy(newbuf,curbuf,newlinebytes); newbuf += newlinebytes; curbuf += curlinebytes; } /* realloc cropped buffer */ newid->buf = (Uint8 *)realloc(newid->buf,newimgbytes); if (newid->buf == NULL) { MdcCleanUpFI(new); return("Crop - Bad realloc cropped buffer"); } } /* check integrity */ if ((msg = MdcImagesPixelFiddle(new)) != NULL) { MdcCleanUpFI(new); return(msg); } /* remove cur */ MdcCleanUpFI(cur); /* copy new -> cur */ MdcCopyFI(cur,new,MDC_NO,MDC_YES); /* just rehook image pointer */ cur->number = new->number; cur->image = new->image; /* and mask new image pointer */ new->number = 0; new->image = NULL; /* now safely cleanup new */ MdcCleanUpFI(new); return(NULL); } char *MdcMakeGray(FILEINFO *fi) { IMG_DATA *id; Uint32 i, p, pixels; Uint8 *img8, rd=0, gr=0, bl=0, v; /* no color file */ if (fi->map != MDC_MAP_PRESENT) return(NULL); if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Grayscaling images: "); for (i=0; inumber; i++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); id = &fi->image[i]; pixels = id->width * id->height; img8 = malloc(pixels); if (img8 == NULL) return("Couldn't malloc gray buffer"); for (p=0; ptype == COLRGB) { /* rgb */ rd = id->buf[p * 3 + 0]; gr = id->buf[p * 3 + 1]; bl = id->buf[p * 3 + 2]; }else if (id->type == BIT8_U) { /* indexed */ v = id->buf[p]; rd = fi->palette[v * 3 + 0]; gr = fi->palette[v * 3 + 1]; bl = fi->palette[v * 3 + 2]; } img8[p] = (Uint8) MdcGRAY(rd,gr,bl); } /* free color images */ MdcFree(id->buf); /* replace with gray */ id->buf = img8; id->type = BIT8_U; id->bits = 8; } MdcGetColorMap(MDC_COLOR_MAP,fi->palette); fi->map = MDC_COLOR_MAP; fi->type = BIT8_U; fi->bits = 8; return(NULL); } char *MdcHandleColor(FILEINFO *fi) { char *msg=NULL; if (MDC_MAKE_GRAY == MDC_YES) { msg = MdcMakeGray(fi); }else if (MDC_COLOR_MODE == MDC_COLOR_INDEXED) { msg = MdcReduceColor(fi); } return(msg); } /* see also DICOM standards: PS 3.3 - 2001 Page 505 */ char *MdcContrastRemap(FILEINFO *fi) { IMG_DATA *id; double wc, ww, rs, ri; double xval, yval; double ymax, ymin; Uint8 *pix; Uint32 i, p, n; Int16 *newbuf, newtype=BIT16_S, pix16; Int16 max=0, min=0, glmax=0, glmin=0; /* handle window centre/width */ if (MDC_FORCE_CONTRAST == MDC_YES) { /* apply user specified values */ wc = (double)mdc_cw_centre; ww = (double)mdc_cw_width; }else{ /* apply file specified values */ wc = (double)fi->window_centre; ww = (double)fi->window_width; } if (ww == 0.) return(NULL); for (i=0; i < fi->number; i++) { id = &fi->image[i]; if (id->type == COLRGB) continue; newbuf = (Int16 *)malloc(id->width*id->height*MdcType2Bytes(newtype)); if (newbuf == NULL) return("Couldn't malloc contrast remaped image"); /* get slope/intercept, even without quantitation */ rs = (double)id->quant_scale; ri = (double)id->intercept; /* prevent division by zero */ if (rs == 0.) rs = 1.; /* rescale window towards pixel values */ wc = (wc - ri) / rs; ww = (ww / rs); /* prepare range value: [0 -> +max] */ ymin = 0.; ymax = (float)MDC_MAX_BIT16_S; n = id->width * id->height; for (pix=id->buf, p=0; p < n; p++, pix+=MdcType2Bytes(id->type)) { /* get pixel value */ xval = MdcGetDoublePixel(pix,id->type); /* apply window centre/width */ if ( xval <= wc - 0.5 - ((ww-1.)/2.)) { yval = ymin; }else if ( xval > wc - 0.5 + ((ww-1.)/2.)) { yval = ymax; }else{ yval = ((((xval-(wc-0.5))/(ww-1.))+0.5) * (ymax-ymin)) + ymin; } /* save in new type */ pix16 = (Int16) yval; /* keep new image max,min */ if (p == 0) { /* init for each image */ max = pix16; min = pix16; }else{ if (pix16 > max) max = pix16; if (pix16 < min) min = pix16; } /* keep new global max,min */ if ((i == 0) && (p == 0)) { /* init for first image */ glmax = pix16; glmin = pix16; }else{ if (pix16 > glmax) glmax = pix16; if (pix16 < glmin) glmin = pix16; } /* put value in new buffer */ newbuf[p] = (Int16)yval; } /* replace with new image buffer */ MdcFree(id->buf); id->buf = (Uint8 *)newbuf; /* replace image values */ id->max = id->qmax = max; id->min = id->qmin = min; id->fmax = id->qfmax = max; id->fmin = id->qfmin = min; id->rescale_slope = 1.; id->rescale_intercept = 1.; id->quant_scale = 1.; id->calibr_fctr = 1.; id->intercept = 0.; id->bits = MdcType2Bits(newtype); id->type = newtype; } /* replace global values */ fi->glmax = fi->qglmax = glmax; fi->glmin = fi->qglmin = glmin; fi->contrast_remapped = MDC_YES; fi->window_centre = 0.; fi->window_width = 0.; fi->bits = MdcType2Bits(newtype); fi->type = newtype; return(NULL); } xmedcon-0.14.1/source/m-split.c0000644000175000017510000002711512636253502013217 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-split.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : split file as specified * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcGetSplitAcqType() - Get new acquisition type * * MdcGetNrSplit() - Get current split index * * MdcGetSplitBaseName() - Get basename without prefix * * MdcUpdateSplitPrefix() - Update prefix for filename * * MdcCopySlice() - Copy specified slice in new FI * * MdcCopyFrame() - Copy specified frame in new FI * * MdcSplitSlices() - Write each slice to a file * * MdcSplitFrames() - Write each frame to a file * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-split.c,v 1.35 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "medcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ static Uint32 mdc_nrsplit=0; /**************************************************************************** F U N C T I O N S ****************************************************************************/ Int16 MdcGetSplitAcqType(FILEINFO *fi) { Int16 type = MDC_ACQUISITION_TOMO; /* default */ if (fi->planar && (fi->acquisition_type == MDC_ACQUISITION_STATIC)) type = MDC_ACQUISITION_STATIC; if (fi->planar && (fi->acquisition_type == MDC_ACQUISITION_DYNAMIC)) type = MDC_ACQUISITION_DYNAMIC; return(type); } Uint32 MdcGetNrSplit(void) { return(mdc_nrsplit); } char *MdcGetSplitBaseName(char *path) { char *p, *bname; /* terminate path */ p = MdcGetLastPathDelim(path); if (p != NULL) { p[0]='\0'; bname = p + 1; }else{ bname = path; } /* get pure basename without prefix we need to update */ if (bname[0]=='m' && bname[4]=='-' && bname[10]=='-' && (bname[5]=='s' || bname[5]=='f')) { bname += 11; } return(bname); } void MdcUpdateSplitPrefix(char *dpath, char *spath, char *bname, int nr ) { MdcPrefix(nr); strcpy(dpath,spath); strcat(dpath,MDC_PATH_DELIM_STR); strcat(dpath,prefix); strcat(dpath,bname); } /* copy a single image slice (zero-based number) */ char *MdcCopySlice(FILEINFO *ofi, FILEINFO *ifi, Uint32 slice0) { char *msg; IMG_DATA *idin, *idout; DYNAMIC_DATA *dd; Uint32 i; /* copy original FILEINFO struct */ msg = MdcCopyFI(ofi,ifi,MDC_NO,MDC_NO); if (msg != NULL) return(msg); /* preserve dynamic data of single slice */ idin = &ifi->image[slice0]; if (!MdcGetStructDD(ofi,1)) return("Couldn't malloc DYNAMIC_DATA struct"); dd = &ofi->dyndata[0]; dd->nr_of_slices = 1; dd->time_frame_start = idin->slice_start; dd->time_frame_duration = MdcSingleImageDuration(ifi,idin->frame_number-1); /* MARK: frame_delay as alternative for slice_start dd->time_frame_delay = idin->slice_start; */ /* single slice parameters */ ofi->dim[0]=3; ofi->pixdim[0]=3.; ofi->dim[3] = 1; ofi->pixdim[3] = 1.; for(i=4; idim[i]=1; ofi->pixdim[i]=1.; } ofi->acquisition_type = MdcGetSplitAcqType(ifi); /* get new IMG_DATA struct for slice */ ofi->image = NULL; if (!MdcGetStructID(ofi,1)) return("Couldn't malloc new IMG_DATA struct"); /* copy IMG_DATA struct */ idin = &ifi->image[slice0]; idout= &ofi->image[0]; msg = MdcCopyID(idout,idin,MDC_YES); if (msg != NULL) return(msg); idout->frame_number = 1; /* single frame */ /* integrity check of FILEINFO struct */ if ( (msg=MdcCheckFI(ofi)) != NULL) return(msg); return(NULL); } /* copy a (time) frame of images (zero-based number) */ char *MdcCopyFrame(FILEINFO *ofi, FILEINFO *ifi, Uint32 frame0) { char *msg; IMG_DATA *idin, *idout; DYNAMIC_DATA *dd; Uint32 i, begin, slices; /* copy FILEINFO struct */ msg = MdcCopyFI(ofi,ifi,MDC_NO,MDC_NO); if (msg != NULL) return(msg); /* preserve corresponding dynamic data */ if ((ifi->dynnr > 0) && (ifi->dyndata != NULL)) { if (frame0 < ifi->dynnr) { if (!MdcGetStructDD(ofi,1)) return("Couldn't malloc DYNAMIC_DATA struct"); MdcCopyDD(&ofi->dyndata[0],&ifi->dyndata[frame0]); } } /* get begin and total slices of frame */ if (ifi->planar && (ifi->acquisition_type == MDC_ACQUISITION_DYNAMIC)) { dd = &ifi->dyndata[frame0]; slices = (frame0dynnr) ? dd->nr_of_slices : ifi->dim[3]; for (begin=0, i=0; idyndata[i].nr_of_slices; }else{ slices = (Uint32)ifi->dim[3]; begin = slices * frame0; } /* set single frame parameters */ ofi->dim[0] = 3; ofi->pixdim[0]=3.; ofi->dim[3] = (Int16)slices; for(i=4; idim[i]=1; ofi->pixdim[i]=1.; } MdcDebugPrint("output slices = %d",slices); ofi->acquisition_type = MdcGetSplitAcqType(ifi); /* disable ACQ_DATA structs */ /* ofi->acqnr = 0; ofi->acqdata = NULL; */ /* get new IMG_DATA structs for slices */ ofi->image = NULL; if (!MdcGetStructID(ofi,slices)) return("Couldn't malloc new IMG_DATA structs"); /* copy IMG_DATA information */ for (i=0; i < slices; i++) { /* copy IMG_DATA struct */ idin = &ifi->image[begin+i]; idout= &ofi->image[i]; msg = MdcCopyID(idout,idin,MDC_YES); if (msg != NULL) return(msg); idout->frame_number = 1; /* single frame */ } /* integrity check of FILEINFO struct */ if ( (msg=MdcCheckFI(ofi)) != NULL) return(msg); return(NULL); } char *MdcSplitSlices(FILEINFO *fi, int format, int prefixnr) { FILEINFO *ofi; Uint32 nr_of_slices; Int32 instance=0, series=0; char *msg, *tpath=NULL, *bname=NULL; /* alloc temp struct, path */ ofi = (FILEINFO *)malloc(sizeof(FILEINFO)); if (ofi == NULL) return("Couldn't malloc output struct"); tpath = (char *)malloc(MDC_MAX_PATH); if (tpath == NULL) { MdcFree(ofi); return("Couldn't malloc tpath"); } if (XMDC_GUI == MDC_NO) { MdcGetSafeString(tpath,fi->ifname,strlen(fi->ifname),MDC_MAX_PATH); }else{ /* terminate path and get basename */ MdcGetSafeString(tpath,fi->ofname,strlen(fi->ofname),MDC_MAX_PATH); bname = MdcGetSplitBaseName(tpath); } /* preserve & initialize series number */ series = fi->nr_series; fi->nr_series = (Int32)prefixnr + 1; /* preserve & initialize instance number */ instance = fi->nr_instance; fi->nr_instance = 0; /* split up all slices */ nr_of_slices = fi->number; for (mdc_nrsplit=0; mdc_nrsplit < nr_of_slices; mdc_nrsplit++) { /* increment instance for each slice */ fi->nr_instance = (Int32)mdc_nrsplit + 1; msg = MdcCopySlice(ofi,fi,mdc_nrsplit); if (msg != NULL) { fi->nr_instance = instance; MdcCleanUpFI(ofi); MdcFree(ofi); MdcFree(tpath); return("Failure to copy slice"); } /* prepare filename */ if (XMDC_GUI == MDC_NO) { strcpy(ofi->ipath,tpath); ofi->ifname = ofi->ipath; }else{ MdcUpdateSplitPrefix(ofi->opath,tpath,bname,prefixnr); ofi->ofname = ofi->opath; } if (MdcWriteFile(ofi, format, prefixnr, NULL) != MDC_OK) { fi->nr_instance = instance; MdcCleanUpFI(ofi); MdcFree(ofi); MdcFree(tpath); return("Failure to write splitted slice"); } MdcCleanUpFI(ofi); } /* free mallocs */ MdcFree(ofi); MdcFree(tpath); /* restore series */ fi->nr_series = series; /* restore instance */ fi->nr_instance = instance; return(NULL); } char *MdcSplitFrames(FILEINFO *fi, int format, int prefixnr) { FILEINFO *ofi; Int32 instance=0, series=0; Uint32 i, nr_of_frames=1; char *msg, *tpath=NULL, *bname=NULL, *p=NULL; /* alloc temp struct, path */ ofi = (FILEINFO *)malloc(sizeof(FILEINFO)); if (ofi == NULL) return("Couldn't malloc output struct"); tpath = (char *)malloc(MDC_MAX_PATH); if (tpath == NULL) { MdcFree(ofi); return("Couldn't malloc tpath"); } if (XMDC_GUI == MDC_NO) { MdcGetSafeString(tpath,fi->ifname,strlen(fi->ifname),MDC_MAX_PATH); }else{ MdcGetSafeString(tpath,fi->ofname,strlen(fi->ofname),MDC_MAX_PATH); p = MdcGetLastPathDelim(tpath); if (p != NULL) { p[0]='\0'; bname = p + 1; }else{ bname = tpath; } /* get pure basename without prefix we need to update */ if (bname[0]=='m' && bname[4]=='-' && bname[10]=='-' && (bname[5]=='s' || bname[5]=='f')) { bname += 11; } } /* preserve & initialize series number */ series = fi->nr_series; fi->nr_series = (Int32)prefixnr + 1; /* preserve & initialize instance number */ instance = fi->nr_instance; fi->nr_instance = 0; if (fi->planar && (fi->acquisition_type == MDC_ACQUISITION_DYNAMIC)) { nr_of_frames = fi->dynnr; }else{ for (i=4; idim[i]; } /* split up all frames */ for (mdc_nrsplit=0; mdc_nrsplit < nr_of_frames; mdc_nrsplit++) { /* increment instance for each frame */ fi->nr_instance = (Int32)mdc_nrsplit + 1; msg = MdcCopyFrame(ofi,fi,mdc_nrsplit); if (msg != NULL) { fi->nr_instance = instance; MdcCleanUpFI(ofi); MdcFree(ofi); MdcFree(tpath); return("Failure to copy frame"); } /* prepare filename */ if (XMDC_GUI == MDC_NO) { strcpy(ofi->ipath,tpath); ofi->ifname = ofi->ipath; }else{ MdcUpdateSplitPrefix(ofi->opath,tpath,bname,prefixnr); ofi->ofname = ofi->opath; } if (MdcWriteFile(ofi, format, prefixnr, NULL) != MDC_OK) { fi->nr_instance = instance; MdcCleanUpFI(ofi); MdcFree(ofi); MdcFree(tpath); return("Failure to write splitted frame"); } MdcCleanUpFI(ofi); } /* free mallocs */ MdcFree(ofi); MdcFree(tpath); /* restore series */ fi->nr_series = series; /* restore instance */ fi->nr_instance = instance; return(NULL); } xmedcon-0.14.1/source/m-nifti.c0000644000175000017510000004507312636253502013200 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-nifti.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : read and write NIFTI files * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcCheckNIFTI() - Check NIFTI format * * MdcReadNIFTI() - Read NIFTI file * * MdcWriteNIFTI() - Write NIFTI file * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-nifti.c,v 1.34 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include /* #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #ifdef HAVE_UNISTD_H #include #endif */ #include "medcon.h" /**************************************************************************** D E F I N E S *****************************************************************************/ #define MDC_NIFTI_WRITE_QFORM 0 /* 0/1 write qform orientation & location */ /**************************************************************************** F U N C T I O N S *****************************************************************************/ int MdcCheckNIFTI(FILEINFO *fi) { int ret, FORMAT=MDC_FRMT_NONE; MdcMergePath(fi->ipath,fi->idir,fi->ifname); nifti_set_debug_level(0); ret = is_nifti_file(fi->ipath); nifti_set_debug_level(1); MdcSplitPath(fi->ipath,fi->idir,fi->ifname); switch (ret) { #if MDC_INCLUDE_ANLZ case 0: FORMAT = MDC_FRMT_NONE; /* check later as Analyze */ break; #else case 0: FORMAT = MDC_FRMT_NIFTI; /* use NIFTI reader */ break; #endif case 1: FORMAT = MDC_FRMT_NIFTI; /* NIFTI one file */ break; case 2: FORMAT = MDC_FRMT_NIFTI; /* NIFTI two files */ break; default: FORMAT = MDC_FRMT_NONE; /* unknown */ } return(FORMAT); } const char *MdcReadNIFTI(FILEINFO *fi) { nifti_1_header *nhdr; nifti_image *nim; Uint8 *pbuf=NULL; char *fname; int swap, dim[8]; float xyz_fctr, t_fctr; Uint32 i, number, f, bytes; IMG_DATA *id=NULL; DYNAMIC_DATA *dd=NULL; if (MDC_FILE_STDIN == MDC_YES) return("NIFTI File input from stdin unsupported"); if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Reading NIFTI:"); if (MDC_VERBOSE) MdcPrntMesg("NIFTI Reading <%s> ...",fi->ifname); MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; MdcMergePath(fi->ipath,fi->idir,fi->ifname); if (MDC_INFO) { nhdr = nifti_read_header(fi->ipath,&swap,MDC_YES); if (nhdr == NULL) { MdcSplitPath(fi->ipath,fi->idir,fi->ifname); return("NIFTI Failure reading header"); } disp_nifti_1_header("NIFTI", nhdr); MdcFree(nhdr); } fname = malloc(strlen(fi->ipath)+4); if (fname == NULL) { MdcSplitPath(fi->ipath,fi->idir,fi->ifname); return("NIFTI Failure to malloc filename path"); } strcpy(fname,fi->ipath); MdcSplitPath(fi->ipath,fi->idir,fi->ifname); if (fi->compression == MDC_GZIP) strcat(fname,".gz"); /* orig filename */ nim = nifti_image_read(fname, MDC_YES); MdcFree(fname); if (nim == NULL) { return("NIFTI Failure reading image"); } /* fill in FILEINFO */ fi->reconstructed = MDC_YES; fi->acquisition_type = MDC_ACQUISITION_TOMO; fi->endian = MDC_FILE_ENDIAN; MdcStringCopy(fi->study_descr,nim->descrip,80); if (MDC_ECHO_ALIAS == MDC_YES) { nifti_image_free(nim); MdcEchoAliasName(fi); return(NULL); } /* copy dim parameters */ for (i=0; i<8; i++) { fi->dim[i] = nim->dim[i]; fi->pixdim[i] = nim->pixdim[i]; if ((i > 0) && (fi->pixdim[i] > 0.)) fi->pixdim[0] = i; /* one-based */ } /* catch special case for single image */ if (fi->dim[0] == 2) fi->dim[0]=3; /* get unit rescale */ switch (nim->xyz_units) { case NIFTI_UNITS_METER : xyz_fctr = 1000.; break; case NIFTI_UNITS_MICRON: xyz_fctr = 1./1000.; break; case NIFTI_UNITS_MM : default : xyz_fctr = 1.; } switch (nim->time_units) { case NIFTI_UNITS_SEC : t_fctr = 1000.; break; case NIFTI_UNITS_USEC : t_fctr = 1./1000.; break; case NIFTI_UNITS_MSEC : default : t_fctr = 1.; } /* scale to internal units */ fi->pixdim[1] *= xyz_fctr; /* mm */ fi->pixdim[2] *= xyz_fctr; /* mm */ fi->pixdim[3] *= xyz_fctr; /* mm */ if (fi->dim[4] > 1) fi->pixdim[4] *= t_fctr; /* ms */ fi->mwidth = (Uint32) nim->nx; fi->mheight = (Uint32) nim->ny; for ( number=1, i=3; i<=nim->dim[0]; i++) number*=nim->dim[i]; if (number == 0) { nifti_image_free(nim); return("NIFTI No valid images specified"); } switch (nim->datatype) { case NIFTI_TYPE_UINT8 : fi->type=BIT8_U; fi->bits=8; break; case NIFTI_TYPE_INT16 : fi->type=BIT16_S; fi->bits=16; break; case NIFTI_TYPE_INT32 : fi->type=BIT32_S; fi->bits=32; break; case NIFTI_TYPE_FLOAT32 : fi->type=FLT32; fi->bits=32; break; case NIFTI_TYPE_FLOAT64 : fi->type=FLT64; fi->bits=64; break; case NIFTI_TYPE_RGB24 : fi->type=COLRGB; fi->bits=24; break; case NIFTI_TYPE_INT8 : fi->type=BIT8_S; fi->bits=8; break; case NIFTI_TYPE_UINT16 : fi->type=BIT16_U; fi->bits=16; break; case NIFTI_TYPE_UINT32 : fi->type=BIT32_U; fi->bits=32; break; case NIFTI_TYPE_INT64 : fi->type=BIT64_S; fi->bits=64; break; case NIFTI_TYPE_UINT64 : fi->type=BIT64_U; fi->bits=64; break; case NIFTI_TYPE_COMPLEX64 : case NIFTI_TYPE_FLOAT128 : case NIFTI_TYPE_COMPLEX128 : case NIFTI_TYPE_COMPLEX256 : default : nifti_image_free(nim); return("NIFTI Unsupported data type"); } /* read image data */ if (nifti_image_load(nim) < 0) { nifti_image_free(nim); return("NIFTI Failure loading data"); } /* get IMG_DATA structs */ if (!MdcGetStructID(fi,number)) { nifti_image_free(nim); return("NIFTI Bad malloc IMG_DATA structs"); } /* make sure indices are one-based */ if (nim->nw == 0) nim->nw = 1; if (nim->nv == 0) nim->nv = 1; if (nim->nu == 0) nim->nu = 1; if (nim->nt == 0) nim->nt = 1; if (nim->nz == 0) nim->nz = 1; /* fill in IMG_DATA structs */ bytes = fi->mwidth * fi->mheight * MdcType2Bytes(fi->type); pbuf = (Uint8 *)nim->data; i=0; dim[0]=7; for (dim[7]=0; dim[7] < nim->nw; dim[7]++ ) /* nw */ for (dim[6]=0; dim[6] < nim->nv; dim[6]++ ) /* nv */ for (dim[5]=0; dim[5] < nim->nu; dim[5]++ ) /* nu */ for (dim[4]=0; dim[4] < nim->nt; dim[4]++ ) /* nt */ for (dim[3]=0; dim[3] < nim->nz; dim[3]++, i++, pbuf+=bytes) { /* nz */ if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); if (i == fi->number) { nifti_image_free(nim); return("NIFTI Internal ERRRO"); } id = &fi->image[i]; id->width = fi->mwidth; id->height= fi->mheight; id->bits = fi->bits; id->type = fi->type; id->quant_scale = nim->scl_slope; if (id->quant_scale == 0.) id->quant_scale = 1.; id->intercept = nim->scl_inter; id->pixel_xsize = fi->pixdim[1]; id->pixel_ysize = fi->pixdim[2]; id->slice_width = fi->pixdim[3]; id->slice_spacing = id->slice_width; if ( (id->buf=MdcGetImgBuffer(bytes)) == NULL) { nifti_image_free(nim); return("NIFTI Bad malloc image buffer"); } memcpy(id->buf,pbuf,bytes); } /* check some final FILEINFO entries */ if (fi->dim[4] > 1) { fi->acquisition_type = MDC_ACQUISITION_DYNAMIC; /* fill in dynamic data struct */ if (!MdcGetStructDD(fi,(unsigned)fi->dim[4])) { nifti_image_free(nim); return("NIFTI Couldn't malloc DYNAMIC_DATA structs"); } for (f=0; f < fi->dynnr; f++) { dd = &fi->dyndata[f]; dd->nr_of_slices = fi->dim[3]; dd->time_frame_delay = nim->toffset * t_fctr; dd->time_frame_duration = fi->pixdim[4]; dd->time_frame_start = f * dd->time_frame_duration + dd->time_frame_delay; } } nifti_image_free(nim); return(NULL); } const char *MdcWriteNIFTI(FILEINFO *fi) { struct nifti_1_header nhdr; nifti_image *nim; znzFile fp=NULL; char *bname, *pext; int i, n, ret, nvox, FREE; IMG_DATA *id; Int8 saved_norm_over_frames=MDC_NORM_OVER_FRAMES; Uint8 *buf=NULL, *maxbuf, *rgbbuf, grval; Uint32 size; Int16 type; if (XMDC_GUI == MDC_NO) { MdcDefaultName(fi,MDC_FRMT_NIFTI,fi->ofname,fi->ifname); } if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Writing NIFTI:"); if (MDC_VERBOSE) MdcPrntMesg("NIFTI Writing <%s> ...",fi->ofname); if (MDC_FILE_STDOUT == MDC_YES) { return("NIFTI Writing to stdout currently unsupported"); } /* file endian */ if (MDC_WRITE_ENDIAN != MDC_HOST_ENDIAN) return("NIFTI Writing in different endianess yet unsupported"); /* get nifti_image struct */ nim = nifti_simple_init_nim(); if (nim == NULL) { return("NIFTI Couldn't init nifti_image struct"); } /* fill in header */ /* dimensions */ nim->ndim = fi->dim[0]; nim->nx = fi->dim[1]; nim->ny = fi->dim[2]; nim->nz = fi->dim[3]; nim->nt = fi->dim[4]; nim->nu = fi->dim[5]; nim->nv = fi->dim[6]; nim->nw = fi->dim[7]; for (i=0; i<8; i++) nim->dim[i] = fi->dim[i]; for (i=1,nvox=1; i<8; i++) nvox *= fi->dim[i]; nim->dx = fi->pixdim[1]; nim->dy = fi->pixdim[2]; nim->dz = fi->pixdim[3]; nim->dt = fi->pixdim[4]; nim->du = fi->pixdim[5]; nim->dv = fi->pixdim[6]; nim->dw = fi->pixdim[7]; for (i=0; i<8; i++) nim->pixdim[i] = fi->pixdim[i]; #ifdef MDC_USE_SLICE_SPACING if (fi->number > 1) { nim->dz = fi->image[0].slice_spacing; nim->pixdim[3] = nim->dz; } #endif nim->xyz_units = NIFTI_UNITS_MM; nim->time_units = NIFTI_UNITS_MSEC; #if MDC_NIFTI_WRITE_QFORM /* orientation and location */ id = &fi->image[0]; nim->qform_code = NIFTI_XFORM_SCANNER_ANAT; nim->qoffset_x = - id->image_pos_pat[0]; nim->qoffset_y = - id->image_pos_pat[1]; nim->qoffset_z = + id->image_pos_pat[2]; nim->qto_xyz = nifti_make_orthog_mat44(- id->image_pos_pat[0], - id->image_pos_pat[1], + id->image_pos_pat[2], - id->image_pos_pat[3], - id->image_pos_pat[4], + id->image_pos_pat[5], 0,0,0); nifti_mat44_to_quatern(nim->qto_xyz, &nim->quatern_b, &nim->quatern_c, &nim->quatern_c, NULL,NULL,NULL,NULL,NULL,NULL,&nim->qfac); #endif /* single file output */ nim->nifti_type = 1; sprintf(nim->descrip,"%.35s",fi->study_descr); bname = nifti_makebasename(fi->opath); if (bname == NULL) return("NIFTI Base filename allocation failed"); /* get rid of any extension left, like .img.hdr -> .img remains */ /* which would result in a misappropriate two file nifti output */ pext = strchr(bname,'.'); if (pext != NULL) pext[0]='\0'; if (MDC_FILE_OVERWRITE == MDC_YES) { ret = nifti_set_filenames(nim,bname,0,1); }else{ ret = nifti_set_filenames(nim,bname,1,1); } free(bname); if (ret < 0) { nifti_image_free(nim); return("NIFTI Filename creation failed"); } /* output pixel type */ if (fi->map == MDC_MAP_PRESENT) { /* colored */ nim->datatype = NIFTI_TYPE_RGB24; nim->nbyper = 3; }else{ /* grayscale */ if (MDC_FORCE_INT != MDC_NO) { switch (MDC_FORCE_INT) { case BIT8_U : nim->datatype = NIFTI_TYPE_UINT8; nim->nbyper = 1; break; case BIT16_S: default : nim->datatype = NIFTI_TYPE_INT16; nim->nbyper = 2; } }else if (fi->diff_type) { nim->datatype = NIFTI_TYPE_INT16; nim->nbyper = 2; }else if (fi->diff_scale) { nim->datatype = NIFTI_TYPE_FLOAT32; nim->nbyper = 4; }else{ nim->nbyper = MdcType2Bytes(fi->type); switch ( fi->type ) { case BIT8_S : nim->datatype = NIFTI_TYPE_INT8; break; case BIT8_U : nim->datatype = NIFTI_TYPE_UINT8; break; case BIT16_S: nim->datatype = NIFTI_TYPE_INT16; break; case BIT16_U: nim->datatype = NIFTI_TYPE_UINT16; break; case BIT32_S: nim->datatype = NIFTI_TYPE_INT32; break; case BIT32_U: nim->datatype = NIFTI_TYPE_UINT32; break; case BIT64_S: nim->datatype = NIFTI_TYPE_INT64; break; case BIT64_U: nim->datatype = NIFTI_TYPE_UINT64; break; case FLT32 : nim->datatype = NIFTI_TYPE_FLOAT32; break; case FLT64 : nim->datatype = NIFTI_TYPE_FLOAT64; break; case ASCII: case BIT1 : default : nifti_image_free(nim); return("NIFTI Unsupported datatype"); } } } /* initialize output file */ fp = nifti_image_write_hdr_img(nim,2,"wb"); /* keep lowlevel header */ nhdr = nifti_convert_nim2nhdr(nim); /* free nifti image struct */ nifti_image_free(nim); if (fp == NULL) return("NIFTI Writing header data failed"); /* rescale over all images for */ /* a single slope/intercept */ MDC_NORM_OVER_FRAMES = MDC_NO; /* write (addapted) image data */ for (i=0; inumber; i++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); id = &fi->image[i]; buf = id->buf; FREE = MDC_NO; type = id->type; if (fi->map != MDC_MAP_PRESENT) { /* grayscale */ if (MDC_FORCE_INT != MDC_NO) { switch (MDC_FORCE_INT) { case BIT8_U : buf = MdcGetImgBIT8_U(fi,i); type = BIT8_U; FREE=MDC_YES; break; case BIT16_S: buf = MdcGetImgBIT16_S(fi,i); type = BIT16_S; FREE=MDC_YES; break; default : buf = MdcGetImgBIT16_S(fi,i); type = BIT16_S; FREE=MDC_YES; } }else if (fi->diff_type) { switch (id->type) { case BIT16_S: buf = id->buf; type = BIT16_S; FREE=MDC_NO; break; default : buf = MdcGetImgBIT16_S(fi,i); type = BIT16_S; FREE=MDC_YES; } }else if (fi->diff_scale) { /* rescale to get single global factor */ buf = MdcGetImgFLT32(fi,i); type = FLT32; FREE=MDC_YES; }else{ /* all (or most) types supported */ buf = id->buf; FREE=MDC_NO; type = id->type; } } if (buf == NULL) { znzclose(fp); return("NIFTI Bad malloc image buffer"); } if (fi->diff_size) { maxbuf = MdcGetResizedImage(fi, buf, type, i); if (FREE) MdcFree(buf); if (maxbuf == NULL) { znzclose(fp); return("NIFTI Bad malloc maxbuf"); } FREE=MDC_YES; }else{ maxbuf = buf; } size = fi->mwidth * fi->mheight * MdcType2Bytes(type); if (fi->map == MDC_MAP_PRESENT) { if (type == COLRGB) { /* true color */ if (nifti_write_buffer(fp,(void *)maxbuf,size) != size) { if (FREE) MdcFree(maxbuf); znzclose(fp); return("NIFTI Bad write RGB buffer"); } }else{ /* indexed */ rgbbuf = malloc(size * 3); if (rgbbuf == NULL) { if (FREE) MdcFree(maxbuf); znzclose(fp); return("NIFTI Bad mallox indexed buffer"); } /* make true color */ for (n=0; n < size; n += MdcType2Bytes(type)) { grval = (Uint8)MdcGetDoublePixel((Uint8 *)&maxbuf[n],type); rgbbuf[n*3 + 0] = fi->palette[grval * 3 + 0]; /* red */ rgbbuf[n*3 + 1] = fi->palette[grval * 3 + 1]; /* green */ rgbbuf[n*3 + 2] = fi->palette[grval * 3 + 2]; /* blue */ } if (FREE) MdcFree(maxbuf); maxbuf = rgbbuf; FREE = MDC_YES; size *= 3; /* RGB triplets */ if (nifti_write_buffer(fp,(void *)maxbuf,size) != size) { if (FREE) MdcFree(maxbuf); znzclose(fp); return("NIFTI Writing indexed buffer failed"); } } }else{ /* grayscale */ if (nifti_write_buffer(fp,(void *)maxbuf,size) != size) { if (FREE) MdcFree(maxbuf); znzclose(fp); return("NIFTI Bad write image buffer"); } } if (FREE) MdcFree(maxbuf); } /* update (rescaled) slope/intercept */ if (fi->image[0].rescaled == MDC_YES) { nhdr.scl_slope = fi->image[0].rescaled_slope; nhdr.scl_inter = fi->image[0].rescaled_intercept; }else{ nhdr.scl_slope = fi->image[0].rescale_slope; nhdr.scl_inter = fi->image[0].rescale_intercept; } /* rewrite updated header */ znzseek(fp, 0L, SEEK_SET); if (znzwrite(&nhdr,1,sizeof(nhdr),fp) != sizeof(nhdr)) { znzclose(fp); return("NIFTI Failure to update header"); } /* close file */ znzclose(fp); /* restore original value */ MDC_NORM_OVER_FRAMES = saved_norm_over_frames; /* finish */ return(NULL); } xmedcon-0.14.1/source/xcolmap.h0000644000175000017510000000467212636253502013305 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xcolmap.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xcolmap.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xcolmap.h,v 1.22 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XCOLMAP_H__ #define __XCOLMAP_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcRemovePreviousColorMap(void); void XMdcApplyNewColorMap(int map); gboolean XMdcColorMapCallbackClicked(GtkWidget *widget, GdkEventButton *button, gpointer data); void XMdcColorMapSelCallbackApply(GtkWidget *widget, gpointer data); gboolean XMdcColorMapSel(void); gboolean XMdcColorMapCallbackExpose(GtkWidget *widget, GdkEventExpose *event, gpointer data); void XMdcApplyMapPlace(int place); void XMdcMapPlaceSelCallbackApply(GtkWidget *widget, gpointer data); gboolean XMdcMapPlaceSel(void); void XMdcBuildColorMap(void); int XMdcLoadLUT(const gchar *lutname); gboolean XMdcChangeLUT(GtkWidget *spinner, gpointer data); gboolean XMdcMapNotAllowed(void); #endif xmedcon-0.14.1/source/m-conc.c0000644000175000017510000033176112636253501013012 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-conc.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : Read and Write Siemens/Concorde format files * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcLoadPlaneCONC() - Load in 1 plane of file * * MdcLoadHeaderCONC() - Load in Concorde header info * * MdcLoadCONC() - Load Concorde file * * MdcSavePlaneCONC - Writeout one plane of file * * MdcSaveHeaderCONC - Writeout Concorde header info * * MdcSaveCONC() - Save Concorde file * * MdcCheckCONC() - Check for Concorde format * * MdcReadCONC() - Read Concorde file * * MdcWriteCONC() - Write Concorde file * * * * * * Author : Andy Loening * * * * Credits : * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-conc.c,v 1.103 2015/12/22 13:59:29 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #include #include #include #define __USE_XOPEN #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRPTIME #define __USE_XOPEN_EXTENDED #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #ifdef HAVE_UNISTD_H #include #endif #include "medcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ /* isotope_branching_fraction needed for activity concentration ?*/ #define MDC_ENABLE_ISOTOPE_BRANCHING_FRACTION 1 char * MdcConcModalityNames[MDC_CONC_NUM_MODALITIES] = { "Unknown acquisition modality", "PET acquisition", "CT acquisition", "SPECT acquisition" }; char * MdcConcFileTypeNames[MDC_CONC_NUM_FILE_TYPES] = { "Unknown", "List mode", "Sinogram", "Normalization", "Attenuation correction", "Image", "Blank", "Unknown/Reserved", "Mu map", "Scatter correction", "Crystal efficiency data", "Crystal interference correction", "Transaxial geometric correction", "Axial geometric correction", "CT projection data", "SPECT raw projection data", }; char * MdcConcAcqModeNames[MDC_CONC_NUM_ACQ_MODES] = { "Unknown", "Blank", "Emission", "Dynamic", "Gated", "Continous bed motion", "Singles transmission", "Windowed Coincidence transmission", "Non-windowed Coincidence transmission" }; char * MdcConcBedMotionNames[MDC_CONC_NUM_BED_MOTIONS] = { "Static or unknown bed motion", "Continous bed motion", "Multiple bed positions" }; char * MdcConcTXSrcNames[MDC_CONC_NUM_TX_SRC_TYPES] = { "Unknown TX source type", "TX point source", "TX line source" }; char * MdcConcDataTypeNames[MDC_CONC_NUM_DATA_TYPES] = { "Unknown", "Signed 8 bit", "Signed 16 bit integer, little endian (Intel, DEC)", "Signed 32 bit integer, little endian (Intel, DEC)", "IEEE Float (32 bit), little endian (Intel, DEC)", "IEEE Float (32 bit), big endian (IBM, Sun)", "Signed 16 bit integer, big endian (IBM, Sun)", "Signed 32 bit integer, big endian (IBM, Sun)" }; char * MdcConcOrderModeNames[MDC_CONC_NUM_ORDER_MODES] = { "Element/Axis/View/Ring_diff - view mode", "Element/View/Axis/Ring_Diff - sinogram mode" }; char * MdcConcRebinTypeNames[MDC_CONC_NUM_REBIN_TYPES] = { "Unknown, or no, algorith type", "Full 3D binning (span and ring difference)", "Single-Slice Rebinning", "Fourier Rebinning" }; char * MdcConcReconTypeNames[MDC_CONC_NUM_RECON_TYPES] = { "Unknown, or no, algorithm type", "Filtered Backprojection", "OSEM 2D", "unused", "unused", "unused", "OSEM 3D followed by MAP" }; char * MdcConcOSEM2DTypeNames[MDC_CONC_NUM_OSEM2D_TYPES] = { "Unweighted OSEM2D reconstruction", "Attenuation weighted OSEM2D reconstruction" }; /* deadtime correction applied to the data set */ char * MdcConcDeadCorrTypeNames[MDC_CONC_NUM_DEAD_CORR_TYPES] = { "No deadtime correction applied", "Global estimate based on singles", "CMS estimate based on singles" }; char * MdcConcAttnCorrNames[MDC_CONC_NUM_ATTN_CORR_TYPES] = { "No attenuation applied", "Point source in TX coincidence", "Point source singles based TX", "Segmented point source in TX coincidence", "Segmented point source singles based TX", "Calculated by geometry", "Non-positron source singles based TX" }; char * MdcConcScatterCorrNames[MDC_CONC_NUM_SCATTER_CORR_TYPES] = { "No scatter correction applied", "Fit of emission tail", "Monte Carlo of emission and transmission data", "Direct calculation from analytical formulas" }; char * MdcConcEventTypeNames[MDC_CONC_NUM_EVENT_TYPES] = { "Unknown event type", "Singles", "Prompt events (coincidences)", "Delay events", "Trues", "Energy Spectrum data", }; char * MdcConcFilterTypeNames[MDC_CONC_NUM_FILTER_TYPES] = { "No filter", "Ramp filter (backprojection) or no filter", "First-order Butterworth window", "Hanning window", "Hamming window", "Parzen window", "Shepp filter", "Second-order Butterworth window", }; char * MdcConcNormTypeNames[MDC_CONC_NUM_NORM_TYPES] = { "No normalization applied", "Point source inversion", "Point source component based", "Cylinder source inversion", "Cylinder source component based" }; char * MdcConcCalibUnitNames[MDC_CONC_NUM_CALIB_UNITS] = { "Unknown calibration units", "nanoCuries/cc", "bequerels/cc" }; char * MdcConcDoseUnitNames[MDC_CONC_NUM_DOSE_UNITS] = { "Unknown dose units", "mCi", "MBq" }; char * MdcConcSubjectOrientationNames[MDC_CONC_NUM_SUBJECT_ORIENTATIONS] = { "Unknown subject orientation", "Feet first, prone", "Head first, prone", "Feet first, supine", "Head first, supine", "Feet first, right", "Head first, right", "Feet first, left", "Head first, left", }; char * MdcConcLengthUnitNames[MDC_CONC_NUM_LENGTH_UNITS] = { "Unknown length units", "millimeters", "centimeters", "inches", }; char * MdcConcWeightUnitNames[MDC_CONC_NUM_WEIGHT_UNITS] = { "Unknown weight units", "grams", "ounces", "kilograms", "pounds", }; char * MdcConcHdrValueNames[MDC_CONC_NUM_HDR_VALUES] = { "version", "manufacturer", "model", "modality", "modality_configuration", "institution", "study", "file_name", "file_type", "acquisition_mode", "bed_control", "bed_motion", "number_of_bed_positions", "horizontal_bed_calibration", "vertical_bed_calibration", "total_frames", "time_frames", "isotope", "isotope_half_life", "isotope_branching_fraction", "transaxial_crystals_per_block", "axial_crystals_per_block", "intrinsic_crystal_offset", "transaxial_blocks", "axial_blocks", "transaxial_crystal_pitch", "axial_crystal_pitch", "radius", "radial_fov", "pt_src_radius", "src_radius", "src_cm_per_rev", "tx_src_type", "pt_src_steps_per_rev", "src_steps_per_rev", "default_projections", "default_transaxial_angles", "crystal_thickness", "depth_of_interaction", "transaxial_bin_size", "axial_plane_size", "number_detector_panels", "lld", "uld", "timing_window", "data_type", "data_order", "span", "ring_difference", "number_of_dimensions", "x_dimension", "y_dimension", "z_dimension", "w_dimension", "delta_elements", "x_filter", "y_filter", "z_filter", "histogram_version", "rebinning_type", "rebinning_version", "recon_algorithm", "recon_version", "map_subsets", "map_osem3d_iterations", "map_iterations", "map_beta", "map_blur_type", "map_prior_type", "map_blur_file", "map_pmatrix_file", "osem2d_method", "osem2d_subsets", "osem2d_iterations", "osem2d_em_iterations", "osem2d_map", "osem2d_x_offset", "osem2d_y_offset", "osem2d_zoom", "deadtime_correction_applied", "decay_correction_applied", "normalization_applied", "normalization_filename", "attenuation_applied", "attenuation_filename", "scatter_correction", "scatter_version", "arc_correction_applied", "rotation", "x_offset", "y_offset", "z_offset", "volume_origin_x", "volume_origin_y", "volume_origin_z", "registration_available", "transformation_matrix", "spatial_identifier", "zoom", "pixel_size", "pixel_size_x", "pixel_size_y", "pixel_size_z", "calibration_units", "calibration_factor", "calibration_branching_fraction", "number_of_singles_rates", "investigator", "operator", "study_identifier", "acquisition_user_id", "histogram_user_id", "reconstruction_user_id", "scatter_correction_user_id", "acquisition_notes", "scan_time", "gmt_scan_time", "injected_compound", "dose_units", "dose", "injection_time", "injection_decay_correction", "activity_units", "activity_before_injection", "activity_before_injection_time", "residual_activity", "residual_activity_time", "gate_inputs", "gate_bins", "gate_description", "subject_identifier", "subject_genus", "subject_orientation", "subject_length_units", "subject_length", "subject_weight_units", "subject_weight", "subject_phenotype", "study_model", "anesthesia", "analgesia", "other_drugs", "food_access", "water_access", "subject_date_of_birth", "subject_age", "subject_sex", "subject_scan_region", "subject_glucose_level", "subject_glucose_level_time", "acquisition_file_name", "gantry_rotation", "rotation_direction", "rotating_stage_start_position", "rotating_stage_stop_position", "number_of_projections", "gantry_revolutions", "ct_file_version", "ct_header_size", "ct_proj_size_transaxial", "ct_proj_size_axial", "ct_average_dark_projections", "ct_average_light_projections", "ct_light_calibration_projections", "ct_dependent_light_calibration_projections", "ct_xray_detector_offset", "ct_detector_transaxial_position", "ct_uncropped_transaxial_pixels", "ct_uncropped_axial_pixels", "ct_cropped_transaxial_pixels", "ct_cropped_axial_pixels", "ct_xray_detector_pitch", "ct_horiz_rot_axis_bed_angle", "ct_vert_rot_axis_bed_angle", "ct_exposure_time", "ct_scan_time", "ct_warping", "ct_defect_map_file_name", "ct_xray_voltage", "ct_anode_current", "ct_calibration_exposures", "ct_cone_angle", "ct_projection_interpolation", "ct_source_to_detector", "ct_source_to_crot", "ct_detector_vertical_offset", "ct_detector_horizontal_tilt", "ct_detector_vertical_tilt", "ct_transaxial_bin_factor", "ct_axial_bin_factor", "ct_gating", "ct_hounsfield_scale", "ct_hounsfield_offset", "ct_proj_downsample_factor", "ct_first_recon_proj", "ct_last_recon_proj", "ct_recon_every_nth_proj", "ct_attenuation_water", "ct_tx_rotation_offsets", "ct_tx_transaxial_offsets", "ct_bh_correction", "ct_aluminum_filter_thickness", "projection", "ct_projection_average_center_offset", "ct_projection_center_offset", "ct_projection_horizontal_bed_offset", "end_of_header", }; char * MdcConcBlockValueNames[MDC_CONC_NUM_BLOCK_VALUES] = { "frame", "detector_panel", "event_type", "energy_window", "gate", "bed", "bed_offset", "ending_bed_offset", "bed_passes", "vertical_bed_offset", "data_file_pointer", "frame_start", "frame_duration", "scale_factor", "minimum", "maximum", "deadtime_correction", "decay_correction", "prompts", "delays", "trues", "prompts_rate", "delays_rate", "singles", "end_of_header" }; #define MDC_INPUT_STRING_SIZE 512 #define MDC_CONC_SUPPORTED_VERSION 001.530 #define MDC_MAX_NUM_GARBAGE_LINES 4 /**************************************************************************** internal functions ****************************************************************************/ static MdcConcHdrValue conc_find_next_hdr_line(FILE * hdr_fp, char ** return_line) { char line[MDC_INPUT_STRING_SIZE]; char token[MDC_INPUT_STRING_SIZE]; int conversion_return_value; char done; char valid = MDC_FALSE; MdcConcHdrValue hdr_value = MDC_CONC_HDR_UNKNOWN; MdcConcHdrValue i_value; done = MDC_FALSE; while (!done) { if ( fgets(line, MDC_INPUT_STRING_SIZE, hdr_fp) == NULL) { /* EOF */ done = MDC_TRUE; valid = MDC_FALSE; hdr_value = MDC_CONC_HDR_EOF; *return_line = NULL; } else if (line[0] != '#') { /* skip comment lines */ done = MDC_TRUE; valid = MDC_TRUE; } } if (valid) { conversion_return_value = sscanf(line, "%s ", token); if (conversion_return_value == EOF) hdr_value = MDC_CONC_HDR_EOF; else if (conversion_return_value <= 0) hdr_value = MDC_CONC_HDR_EOF; else { hdr_value = MDC_CONC_HDR_UNKNOWN; *return_line = NULL; for (i_value = 0; i_value < MDC_CONC_NUM_HDR_VALUES; i_value++) { if (strcasecmp(token, MdcConcHdrValueNames[i_value]) == 0) { hdr_value = i_value; i_value = MDC_CONC_NUM_HDR_VALUES; *return_line = (char *)strdup(line); } } if (hdr_value == MDC_CONC_HDR_UNKNOWN) { /* didn't find anything, return the whole line for error msg */ *return_line = (char *)strdup(line); } } } return hdr_value; } static MdcConcBlockValue conc_find_next_block_line(FILE * hdr_fp, char ** return_line) { char line[MDC_INPUT_STRING_SIZE]; char token[MDC_INPUT_STRING_SIZE]; int conversion_return_value; char done; char valid = MDC_FALSE; MdcConcBlockValue block_value = MDC_CONC_BLOCK_UNKNOWN; MdcConcBlockValue i_value; done = MDC_FALSE; while (!done) { if ( fgets(line, MDC_INPUT_STRING_SIZE, hdr_fp) == NULL) { /* read the next line */ done = MDC_TRUE; valid = MDC_FALSE; block_value = MDC_CONC_BLOCK_EOF; *return_line = NULL; } else { if (line[0] != '#') { /* not done if this is a comment line */ done = MDC_TRUE; valid = MDC_TRUE; } } } if (valid) { conversion_return_value = sscanf(line, "%s ", token); if (conversion_return_value == EOF) block_value = MDC_CONC_BLOCK_EOF; else if (conversion_return_value <= 0) block_value = MDC_CONC_BLOCK_EOF; else { block_value = MDC_CONC_BLOCK_UNKNOWN; *return_line = NULL; for (i_value = 0; i_value < MDC_CONC_NUM_BLOCK_VALUES; i_value++) { if (strcasecmp(token, MdcConcBlockValueNames[i_value]) == 0) { block_value = i_value; i_value = MDC_CONC_NUM_BLOCK_VALUES; *return_line = (char *)strdup(line); } } if (block_value == MDC_CONC_BLOCK_UNKNOWN) { /* didn't find anything, return the whole line for error msg */ *return_line = (char *)strdup(line); } } } return block_value; } static float conc_get_float(char * line, int * return_code) { float return_float; *return_code = sscanf(line, "%*s %f", &return_float); if ((*return_code == EOF) || (*return_code <= 0)) return_float = -1.0; return return_float; } static int conc_get_int(char * line, int * return_code) { int return_int; *return_code = sscanf(line, "%*s %d", &return_int); if ((*return_code == EOF) || (*return_code <= 0)) return_int = -1; return return_int; } static void conc_get_int_float(char * line, int * return_code, int * intp, float * floatp) { *return_code = sscanf(line, "%*s %d %f", intp, floatp); if ((*return_code == EOF) || (*return_code <= 0)) { *intp = -1; *floatp= -1.0; } return; } static void conc_get_float_int(char * line, int * return_code, float * floatp, int * intp) { *return_code = sscanf(line, "%*s %f %d", floatp, intp); if ((*return_code == EOF) || (*return_code <= 0)) { *intp = -1; *floatp= -1.0; } return; } static void conc_get_Int32_Int32(char * line, int * return_code, Int32 * num1, Int32 * num2) { *return_code = sscanf(line, "%*s %d %d", num1, num2); if ((*return_code == EOF) || (*return_code <= 0)) *num1 = *num2 = 0; return; } static void conc_get_int_int(char * line, int * return_code, int * num1, int * num2) { *return_code = sscanf(line, "%*s %d %d", num1, num2); if ((*return_code == EOF) || (*return_code <= 0)) *num1 = *num2 = 0; return; } static void conc_get_int_int_float_float(char * line, int * return_code, int * num1, int * num2, float * num3, float * num4) { *return_code = sscanf(line, "%*s %d %d %f %f", num1, num2, num3, num4); if ((*return_code == EOF) || (*return_code <= 0)) *num1 = *num2 = 0; return; } static char * conc_get_string(char * line, int * return_code) { char * return_string; int start_copy; size_t copy_length; /* AML - MacOSX sscan() broken: can't have space before %n, */ /* also added while loop below */ /* *return_code = sscanf(line, "%*s %n", &start_copy) */ *return_code = sscanf(line,"%*s%n",&start_copy); if (*return_code == EOF) return_string = NULL; else { while (line[start_copy] == ' ') start_copy++;/* while added for MacOSX */ copy_length = strcspn(&(line[start_copy]), "\n"); /* return_string = (char *) strndup(&(line[start_copy]), copy_length); */ /* eNlf: strndup replaced for portability */ MdcRemoveEnter(&line[start_copy]); /* remove '\n' as well as '\r */ return_string = malloc(copy_length + 1); if (return_string != NULL) { strncpy(return_string,&(line[start_copy]),copy_length); return_string[copy_length]='\0'; } } return return_string; } static int conc_get_int_string(char * line, int * return_code, int * num1, char ** string1) { int return_int; int conversion_end; *return_code = sscanf(line, "%*s %d%n", &return_int, &conversion_end); if ((*return_code == EOF) || (*return_code <= 0)) return_int = -1; /* the minus 1 is a quick hack to get conc_get_string to work for this */ *string1 = conc_get_string(&(line[conversion_end-1]), return_code); return return_int; } static float conc_convert_injected_dose_to_MBq(float input_id, MdcConcDoseUnits dose_units) { float id; switch(dose_units) { case MDC_CONC_DOSE_UNITS_MILLICURIES: id = MdcmCi2MBq(input_id); break; case MDC_CONC_DOSE_UNITS_UNKNOWN: case MDC_CONC_DOSE_UNITS_MEGA_BEQUERELS: default: id = input_id; break; } return id; } static float conc_convert_weight_to_kg(float input_weight, MdcConcWeightUnits weight_units) { float weight; switch(weight_units) { case MDC_CONC_WEIGHT_UNITS_GRAMS: weight = input_weight/1000.; break; case MDC_CONC_WEIGHT_UNITS_OUNCES: input_weight /= 16.; case MDC_CONC_WEIGHT_UNITS_POUNDS: weight = input_weight / 2.2046226; break; case MDC_CONC_WEIGHT_UNITS_KILOGRAMS: case MDC_CONC_WEIGHT_UNITS_UNKNOWN: default: weight = input_weight; } return weight; } static Int16 conc_save_type(FILEINFO *fi) { Int16 type; /* currently supported BIT8_S, BIT16_S, BIT32_S, FLT32 */ if (MDC_FORCE_INT != MDC_NO) { switch (MDC_FORCE_INT) { case BIT8_U : MdcPrntWarn("CONC Format doesn't support Uint8 type"); case BIT16_S: type = BIT16_S; break; default : type = BIT16_S; } }else{ switch(fi->type) { case BIT8_S : type = BIT8_S; break; case BIT8_U : case BIT16_S: type = BIT16_S; break; case BIT16_U: case BIT32_S: type = BIT32_S; break; case BIT32_U: case BIT64_S: case BIT64_U: case FLT32 : case FLT64 : default : type = FLT32; } } return(type); } /**************************************************************************** F U N C T I O N S ****************************************************************************/ const char *MdcLoadPlaneCONC(FILEINFO *fi, int img) { size_t bytes; IMG_DATA * plane; plane = &fi->image[img]; if (plane->load_location < 0) return("CONC Incorrect plane location in file"); if (plane->buf != NULL) return("CONC Tried to reload plane"); if (fseek(fi->ifp_raw, plane->load_location, SEEK_SET) < 0) { fi->truncated=MDC_YES; return("CONC Could not seek to appropriate file location, truncated read"); } bytes = plane->width*plane->height; bytes *= MdcType2Bytes(plane->type); plane->buf = MdcGetImgBuffer(bytes); if (fread(plane->buf,1,bytes,fi->ifp_raw) != bytes) { fi->truncated=MDC_YES; return("CONC Truncated file read"); } return NULL; } const char *MdcLoadHeaderCONC(FILEINFO *fi) { FILE *hdr_fp = fi->ifp; IMG_DATA * first_plane; IMG_DATA * plane; DYNAMIC_DATA * dd = NULL; BED_DATA * bd = NULL; GATED_DATA * gd = NULL; MdcConcHdrValue hdr_value; MdcConcBlockValue block_value; MdcConcFileTypes file_type=MDC_CONC_FILE_IMAGE; MdcConcWeightUnits weight_units=MDC_CONC_WEIGHT_UNITS_UNKNOWN; MdcConcAcqModes acq_type=MDC_CONC_ACQ_UNKNOWN; char * line = NULL; char done; float temp_float, temp_float2; int temp_int, temp_int2; char * temp_string; char * raw_filename=NULL; char base_filename[MDC_MAX_PATH+1]; char * header_derived_filename=NULL; char * pfilename; int return_code; MdcConcDeadCorrTypes deadtime_correction; MdcConcCalibUnits calibration_units=0; MdcConcReconTypes recon_type=-1; float osem2d_recon_zoom=-1; float calibration_factor=1.0; float isotope_branching_factor=1.0; int i_bed, i_gate, i_frame, i_plane, img; Int32 high_file_pointer, low_file_pointer; Uint32 number; char found_total_frames = MDC_FALSE; char found_time_frames = MDC_FALSE; Int32 total_frames=0; Int32 time_frames=0; char found_beds = MDC_FALSE; char found_data_type = MDC_FALSE; char found_pixel_size_x = MDC_FALSE; char found_pixel_size_y = MDC_FALSE; char found_pixel_size_z = MDC_FALSE; char found_half_life = MDC_FALSE; char found_injected_dose_units = MDC_FALSE; MdcConcDoseUnits injected_dose_units = MDC_CONC_DOSE_UNITS_UNKNOWN; char found_injected_dose = MDC_FALSE; float injected_dose = 0.0; time_t injection_time=0; char found_injection_time = MDC_FALSE; float injection_decay_correction = 1.0; char found_injection_decay_correction = MDC_FALSE; char found_activity_units = MDC_FALSE; MdcConcDoseUnits activity_units = MDC_CONC_DOSE_UNITS_UNKNOWN; char found_activity_before_injection = MDC_FALSE; float activity_before_injection = 0.0; time_t activity_before_injection_time=0; char found_activity_before_injection_time = MDC_FALSE; float residual_activity = 0.0; time_t residual_activity_time=0; char found_residual_activity_time = MDC_FALSE; struct tm time_struct; time_t scan_time=0; char found_scan_time=MDC_FALSE; /* MARK: unused yet #ifdef HAVE_8BYTE_INT Uint64 location; #endif */ int num_garbage_lines = 0; #ifndef HAVE_8BYTE_INT char failed_to_read_64_bit=MDC_FALSE; #endif long plane_bytes; char transmission_scan = MDC_FALSE; if (MDC_VERBOSE) MdcPrntMesg("CONC Reading <%s> ...",fi->ifname); /* initialize */ fi->modality = M_PT; /* read through the header, looking at all the tokens */ done = MDC_FALSE; while (!done) { hdr_value = conc_find_next_hdr_line(hdr_fp, &line); switch (hdr_value) { case MDC_CONC_HDR_VERSION: if (MDC_INFO) MdcPrntScrn("Siemens/Concorde file version:\t%f\n", conc_get_float(line, &return_code)); break; case MDC_CONC_HDR_MANUFACTURER: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Manufacturer:\t\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_MODEL: if (MDC_INFO) MdcPrntScrn("Scanner model:\t\t\t%d\n", conc_get_int(line, &return_code)); break; case MDC_CONC_HDR_MODALITY: temp_int = conc_get_int(line, &return_code); if ((temp_int < MDC_CONC_MODALITY_UNKNOWN) || (temp_int >= MDC_CONC_MODALITY_LAST)) temp_int = MDC_CONC_MODALITY_UNKNOWN; if (MDC_INFO) MdcPrntScrn("Modality:\t\t\t%d=%s\n", temp_int,MdcConcModalityNames[temp_int+1]); switch(temp_int) { case MDC_CONC_MODALITY_PET: fi->modality = M_PT; break; case MDC_CONC_MODALITY_CT: fi->modality = M_CT; break; case MDC_CONC_MODALITY_SPECT: fi->modality = M_ST; break; case MDC_CONC_MODALITY_UNKNOWN: default: fi->modality = M_OT; break; } break; case MDC_CONC_HDR_MODALITY_CONFIGURATION: if (MDC_INFO) MdcPrntScrn("Modality configuration:\t\t%d\n", conc_get_int(line, &return_code)); break; case MDC_CONC_HDR_INSTITUTION: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Institution:\t\t\t%s\n",temp_string); if (strlen(temp_string)) MdcStringCopy(fi->institution,temp_string,strlen(temp_string)); MdcFree(temp_string); break; case MDC_CONC_HDR_STUDY: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Study:\t\t\t\t%s\n",temp_string); MdcStringCopy(fi->study_id, temp_string,strlen(temp_string)); MdcFree(temp_string); break; case MDC_CONC_HDR_FILE_NAME: raw_filename = conc_get_string(line, &return_code); if (MDC_INFO) MdcPrntScrn("Raw data file:\t\t\t%s\n",raw_filename); pfilename = strrchr(raw_filename,'/'); if (pfilename == NULL) pfilename = strrchr(raw_filename,'\\'); if (pfilename != NULL) pfilename++; else pfilename = raw_filename; base_filename[0]='\0'; if (fi->idir != NULL) { strncpy(base_filename, fi->idir, MDC_MAX_PATH); strncat(base_filename, MDC_PATH_DELIM_STR, MDC_MAX_PATH); } strncat(base_filename, pfilename, MDC_MAX_PATH); if (MDC_INFO) MdcPrntScrn("Base name of raw data file:\t%s\n",pfilename); break; case MDC_CONC_HDR_FILE_TYPE: temp_int = conc_get_int(line, &return_code); if ((temp_int < 0) || (temp_int >= MDC_CONC_NUM_FILE_TYPES)) { file_type = MDC_CONC_FILE_UNKNOWN; }else{ file_type = temp_int; } if (MDC_INFO) MdcPrntScrn("File type:\t\t\t%d=%s\n", temp_int,MdcConcFileTypeNames[file_type]); switch(file_type) { case MDC_CONC_FILE_MU_MAP: case MDC_CONC_FILE_IMAGE: fi->reconstructed = MDC_YES; break; case MDC_CONC_FILE_ATTENUATION: case MDC_CONC_FILE_SINOGRAM: case MDC_CONC_FILE_NORMALIZATION: case MDC_CONC_FILE_CT_PROJECTION_DATA: case MDC_CONC_FILE_SPECT_RAW_PROJECTION_DATA: case MDC_CONC_FILE_SPECT_ENERGY_PROJECTION_DATA: case MDC_CONC_FILE_SPECT_NORMALIZATION_DATA: fi->reconstructed = MDC_NO; break; default: return("CONC Cannot handle this Siemens/Concorde file type"); break; } break; case MDC_CONC_HDR_ACQUISITION_MODE: temp_int = conc_get_int(line, &return_code); if ((temp_int < 0) || (temp_int >= MDC_CONC_NUM_ACQ_MODES)) { acq_type = MDC_CONC_ACQ_UNKNOWN; }else{ acq_type = temp_int; } if (MDC_INFO) MdcPrntScrn("Acquisition type:\t\t%d=%s\n", temp_int,MdcConcAcqModeNames[acq_type]); switch(acq_type) { case MDC_CONC_ACQ_BLANK: case MDC_CONC_ACQ_CT_PROJECTION: case MDC_CONC_ACQ_CT_CALIBRATION: case MDC_CONC_ACQ_SPECT_PLANAR_PROJECTION: case MDC_CONC_ACQ_SPECT_MULTIPROJECTION: case MDC_CONC_ACQ_SPECT_CALIBRATION: fi->acquisition_type = MDC_ACQUISITION_STATIC; break; case MDC_CONC_ACQ_EMISSION: case MDC_CONC_ACQ_CONTINUOUS: fi->acquisition_type = MDC_ACQUISITION_TOMO; break; case MDC_CONC_ACQ_DYNAMIC: fi->acquisition_type = MDC_ACQUISITION_DYNAMIC; break; case MDC_CONC_ACQ_GATED: fi->acquisition_type = MDC_ACQUISITION_GATED; break; case MDC_CONC_ACQ_SINGLES: fi->acquisition_type = MDC_ACQUISITION_STATIC; transmission_scan = MDC_TRUE; break; case MDC_CONC_ACQ_WINDOWED_COINCIDENCE: case MDC_CONC_ACQ_NON_WINDOWED_COINCIDENCE: fi->acquisition_type = MDC_ACQUISITION_TOMO; transmission_scan = MDC_TRUE; break; case MDC_CONC_ACQ_UNKNOWN: default: fi->acquisition_type = MDC_ACQUISITION_UNKNOWN; break; } break; case MDC_CONC_HDR_BED_CONTROL: if (MDC_INFO) MdcPrntScrn("Bed control:\t\t\t%d\n", conc_get_int(line, &return_code)); break; case MDC_CONC_HDR_BED_MOTION: { MdcConcBedMotion bed_motion; temp_int = conc_get_int(line, &return_code); if ((temp_int < 0) || (temp_int >= MDC_CONC_NUM_BED_MOTIONS)) { bed_motion = MDC_CONC_BED_MOTION_STATIC; }else{ bed_motion = temp_int; } if (MDC_INFO) MdcPrntScrn("Bed Motion type:\t\t%d=%s\n", temp_int,MdcConcBedMotionNames[bed_motion]); if (bed_motion == MDC_CONC_BED_MOTION_CONTINOUS) { MdcPrntWarn("CONC Don't know how to handle bed motion:\t%s", MdcConcBedMotionNames[bed_motion]); } } break; /* don't care */ case MDC_CONC_HDR_NUMBER_BED_POSITIONS: temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("Number of bed positions:\t%d\n", temp_int); if (temp_int < 0) return("CONC Header reported negative bed positions"); if (temp_int == 0) fi->dim[6] = 1; else fi->dim[6] = temp_int; found_beds = MDC_TRUE; break; case MDC_CONC_HDR_HORIZONTAL_BED_CALIBRATION: if (MDC_INFO) MdcPrntScrn("Horizontal bed calibration:\t%5.3f (microns)\n", conc_get_float(line, &return_code)); break; case MDC_CONC_HDR_VERTICAL_BED_CALIBRATION: if (MDC_INFO) MdcPrntScrn("Vertical bed calibration:\t%5.3f (microns)\n", conc_get_float(line, &return_code)); break; case MDC_CONC_HDR_TOTAL_FRAMES: temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("Number of total frames:\t\t%d\n",temp_int); if (temp_int <= 0) return("CONC Header reported no total frames of data"); total_frames = temp_int; found_total_frames = MDC_TRUE; if (!found_time_frames) time_frames = total_frames; break; case MDC_CONC_HDR_TIME_FRAMES: temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("Number of time frames:\t\t%d\n",temp_int); /* Concorde will have time_frames to 0 for static studies */ if (temp_int > 0) { time_frames = temp_int; found_time_frames = MDC_TRUE; } break; case MDC_CONC_HDR_ISOTOPE: temp_string = conc_get_string(line, &return_code); if (MDC_INFO) MdcPrntScrn("Isotope used:\t\t\t%s\n",temp_string); MdcStringCopy(fi->isotope_code, temp_string, strlen(temp_string)); MdcFree(temp_string); break; case MDC_CONC_HDR_ISOTOPE_HALF_LIFE: temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("Isotope half life:\t\t%5.3f\n",temp_float); fi->isotope_halflife = temp_float; found_half_life = MDC_TRUE; break; case MDC_CONC_HDR_ISOTOPE_BRANCHING_FRACTION: temp_float = conc_get_float(line, &return_code); isotope_branching_factor = temp_float; if (MDC_INFO) MdcPrntScrn("Isotope branching fraction:\t%5.3f\n",temp_float); break; case MDC_CONC_HDR_TRANSAXIAL_CRYSTALS_PER_BLOCK: if (MDC_INFO) MdcPrntScrn("Transaxial crystals per block:\t%d\n", conc_get_int(line, &return_code)); break; case MDC_CONC_HDR_AXIAL_CRYSTALS_PER_BLOCK: if (MDC_INFO) MdcPrntScrn("Axial crystals per block:\t%d\n", conc_get_int(line, &return_code)); break; case MDC_CONC_HDR_INTRINSIC_CRYSTAL_OFFSET: if (MDC_INFO) MdcPrntScrn("Crystal off. for intrinsic rot:\t%d\n", conc_get_int(line, &return_code)); break; case MDC_CONC_HDR_TRANSAXIAL_BLOCKS: if (MDC_INFO) MdcPrntScrn("Transaxial blocks:\t\t%d\n", conc_get_int(line, &return_code)); break; case MDC_CONC_HDR_AXIAL_BLOCKS: if (MDC_INFO) MdcPrntScrn("Axial blocks:\t\t\t%d\n", conc_get_int(line, &return_code)); break; case MDC_CONC_HDR_TRANSAXIAL_CRYSTAL_PITCH: temp_float = 10.0*conc_get_float(line, &return_code); /* get in mm */ if (MDC_INFO) MdcPrntScrn("Transaxial crystal pitch:\t%5.3f (mm)\n",temp_float); break; case MDC_CONC_HDR_AXIAL_CRYSTAL_PITCH: temp_float = 10.0*conc_get_float(line, &return_code); /* in cm, get into mm */ if (MDC_INFO) MdcPrntScrn("Axial crystal pitch:\t\t%5.3f (mm)\n",temp_float); if (!found_pixel_size_z) { /* favor the pixel_size_z header entry */ if (MDC_INFO) MdcPrntScrn("Slice width (z):\t\t%5.3f (mm)\n",temp_float/2.0); fi->pixdim[3] = temp_float/2.0; } break; case MDC_CONC_HDR_RADIUS: if (MDC_INFO) MdcPrntScrn("Ring radius (to crystal face):\t%5.3f (mm)\n", 10.0*conc_get_float(line, &return_code)); break; case MDC_CONC_HDR_RADIAL_FOV: if (MDC_INFO) MdcPrntScrn("Radial field of view:\t\t%5.3f (mm)\n", 10.0*conc_get_float(line, &return_code)); break; case MDC_CONC_HDR_PT_SRC_RADIUS: case MDC_CONC_HDR_SRC_RADIUS: if (MDC_INFO) MdcPrntScrn("Source radius:\t\t\t%5.3f (mm)\n", 10.0*conc_get_float(line, &return_code)); break; case MDC_CONC_HDR_SRC_CM_PER_REV: if (MDC_INFO) MdcPrntScrn("Source CM/Rev:\t\t\t%5.3f (mm)\n", 10.0*conc_get_float(line, &return_code)); break; case MDC_CONC_HDR_TX_SRC_TYPE: if ((acq_type == MDC_CONC_ACQ_SINGLES) || (acq_type == MDC_CONC_ACQ_WINDOWED_COINCIDENCE) || (acq_type == MDC_CONC_ACQ_NON_WINDOWED_COINCIDENCE)) { MdcConcTXSrcTypes tx_src; temp_int = conc_get_int(line, &return_code); if ((temp_int >= 0) && (temp_int < MDC_CONC_NUM_TX_SRC_TYPES)) { tx_src = temp_int; }else{ tx_src = MDC_CONC_TX_SRC_UNKNOWN; } if (MDC_INFO) MdcPrntScrn("Transmission source:\t\t%d=%s\n", temp_int, MdcConcTXSrcNames[tx_src]); } break; case MDC_CONC_HDR_PT_SRC_STEPS_PER_REV: case MDC_CONC_HDR_SRC_STEPS_PER_REV: if (MDC_INFO) MdcPrntScrn("Source encoder steps/rev.:\t%d\n", conc_get_int(line, &return_code)); break; case MDC_CONC_HDR_DEFAULT_PROJECTIONS: if (MDC_INFO) MdcPrntScrn("Default # of projections:\t%d\n", conc_get_int(line, &return_code)); break; case MDC_CONC_HDR_DEFAULT_TRANSAXIAL_ANGLES: if (MDC_INFO) MdcPrntScrn("Default # of transaxial angles:\t%d\n", conc_get_int(line, &return_code)); break; case MDC_CONC_HDR_CRYSTAL_THICKNESS: if (MDC_INFO) MdcPrntScrn("Crystal thickness:\t\t%5.3f (mm)\n", 10.0*conc_get_float(line, &return_code)); break; case MDC_CONC_HDR_DEPTH_OF_INTERACTION: if (MDC_INFO) MdcPrntScrn("Depth of interaction:\t\t%5.3f (mm)\n", 10.0*conc_get_float(line, &return_code)); break; case MDC_CONC_HDR_TRANSAXIAL_BIN_SIZE: if (MDC_INFO) MdcPrntScrn("Transaxial bin size:\t\t%5.3f (mm)\n", 10.0*conc_get_float(line, &return_code)); break; case MDC_CONC_HDR_AXIAL_PLANE_SIZE: if (MDC_INFO) MdcPrntScrn("Axial plane size:\t\t%5.3f (mm)\n", 10.0*conc_get_float(line, &return_code)); break; case MDC_CONC_HDR_NUMBER_DETECTOR_PANELS: if (MDC_INFO) MdcPrntScrn("Number of detector panels:\t%d\n", conc_get_int(line, &return_code)); break; case MDC_CONC_HDR_LLD: if (MDC_INFO) MdcPrntScrn("Lower level energy threshold:\t%5.3f (KeV)\n", conc_get_float(line, &return_code)); break; case MDC_CONC_HDR_ULD: if (MDC_INFO) MdcPrntScrn("Upper level energy threshold:\t%5.3f (KeV)\n", conc_get_float(line, &return_code)); break; case MDC_CONC_HDR_TIMING_WINDOW: if (MDC_INFO) MdcPrntScrn("Coincidence timing window:\t%d (nsecs)\n", conc_get_int(line, &return_code)); break; case MDC_CONC_HDR_DATA_TYPE: { MdcConcDataTypes data_type; temp_int = conc_get_int(line, &return_code); if ((temp_int < 0) || (temp_int >= MDC_CONC_NUM_DATA_TYPES)) { data_type = MDC_CONC_DATA_UNKNOWN; }else{ data_type = temp_int; } if (MDC_INFO) MdcPrntScrn("Data type:\t\t\t%d=%s\n", temp_int,MdcConcDataTypeNames[data_type]); fi->endian=MDC_FILE_ENDIAN= MDC_LITTLE_ENDIAN; switch(data_type) { case MDC_CONC_DATA_SBYTE: fi->bits = 8; fi->type = BIT8_S; break; case MDC_CONC_DATA_SSHORT_BE: fi->endian=MDC_FILE_ENDIAN = MDC_BIG_ENDIAN; case MDC_CONC_DATA_SSHORT_LE: fi->bits = 16; fi->type = BIT16_S; break; case MDC_CONC_DATA_SINT_BE: fi->endian=MDC_FILE_ENDIAN = MDC_BIG_ENDIAN; case MDC_CONC_DATA_SINT_LE: fi->bits = 32; fi->type = BIT32_S; break; case MDC_CONC_DATA_FLOAT_BE: fi->endian=MDC_FILE_ENDIAN = MDC_BIG_ENDIAN; case MDC_CONC_DATA_FLOAT_LE: fi->bits = 32; fi->type = FLT32; break; case MDC_CONC_DATA_UNKNOWN: case MDC_CONC_NUM_DATA_TYPES: default: return("CONC Unknown data type for Siemens/Concorde file"); } found_data_type = MDC_TRUE; } break; case MDC_CONC_HDR_DATA_ORDER: { MdcConcOrderModes mode_type; temp_int = conc_get_int(line, &return_code); if ((temp_int < 0) || (temp_int >= MDC_CONC_NUM_ORDER_MODES)) { mode_type = MDC_CONC_ORDER_SINOGRAM; }else{ mode_type = temp_int; } if (MDC_INFO) MdcPrntScrn("Data order:\t\t\t%d=%s\n", temp_int,MdcConcOrderModeNames[mode_type]); if (mode_type != MDC_CONC_ORDER_SINOGRAM) return("CONC Can only handle Siemens/Concorde scans in x/y/z/w order"); } break; case MDC_CONC_HDR_SPAN: if (MDC_INFO) MdcPrntScrn("Span of data set:\t\t%d\n", conc_get_int(line, &return_code)); break; case MDC_CONC_HDR_RING_DIFFERENCE: if (MDC_INFO) MdcPrntScrn("Maximum ring difference:\t%d\n", conc_get_int(line, &return_code)); break; /* don't care */ case MDC_CONC_HDR_NUMBER_OF_DIMENSIONS: temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("Number of dimensions:\t\t%d\n",temp_int); /* Concorde doesn't use this consistently, so ignore it */ break; case MDC_CONC_HDR_X_DIMENSION: temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("X dimension:\t\t\t%d\n",temp_int); fi->dim[1]=temp_int; break; case MDC_CONC_HDR_Y_DIMENSION: temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("Y dimension:\t\t\t%d\n",temp_int); fi->dim[2]=temp_int; break; case MDC_CONC_HDR_Z_DIMENSION: temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("Z dimension:\t\t\t%d\n",temp_int); if ((file_type == MDC_CONC_FILE_SINOGRAM) || (file_type == MDC_CONC_FILE_ATTENUATION) || (file_type == MDC_CONC_FILE_NORMALIZATION)) fi->dim[3]=0; else fi->dim[3]=temp_int; break; case MDC_CONC_HDR_W_DIMENSION: temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("W dimension (ignored):\t\t%d\n",temp_int); break; case MDC_CONC_HDR_DELTA_ELEMENTS: { int delta, planes; conc_get_int_int(line, &return_code, &delta, &planes); if (MDC_INFO) MdcPrntScrn("\tdelta elements (%d):\t%d\n", delta, planes); fi->dim[3] += planes; } break; case MDC_CONC_HDR_X_FILTER: { MdcConcFilterTypes filter_type; conc_get_int_float(line, &return_code, &temp_int, &temp_float); if ((temp_int >= 0) && (temp_int < MDC_CONC_NUM_FILTER_TYPES)) { filter_type = temp_int; }else{ filter_type = MDC_CONC_FILTER_NONE; } if (MDC_INFO) MdcPrntScrn("Filter (X):\t\t\t%d=%s\n", temp_int, MdcConcFilterTypeNames[filter_type]); MdcStringCopy(fi->filter_type, MdcConcFilterTypeNames[filter_type], strlen(MdcConcFilterTypeNames[filter_type])); } break; case MDC_CONC_HDR_Y_FILTER: break; /* don't care */ case MDC_CONC_HDR_Z_FILTER: break; /* don't care */ case MDC_CONC_HDR_HISTOGRAM_VERSION: break; /* don't care */ case MDC_CONC_HDR_REBINNING_TYPE: break; /* don't care */ case MDC_CONC_HDR_REBINNING_VERSION: break; /* don't care */ case MDC_CONC_HDR_RECON_ALGORITHM: temp_int = conc_get_int(line, &return_code); if ((temp_int >= 0) && (temp_int < MDC_CONC_NUM_RECON_TYPES)) { recon_type = temp_int; }else{ recon_type = MDC_CONC_RECON_UNKNOWN; } if (MDC_INFO) MdcPrntScrn("Reconstruction type:\t\t%d=%s\n", temp_int, MdcConcReconTypeNames[recon_type]); MdcStringCopy(fi->recon_method, MdcConcReconTypeNames[recon_type], strlen(MdcConcReconTypeNames[recon_type])); break; case MDC_CONC_HDR_RECON_VERSION: if (MDC_INFO) MdcPrntScrn("Reconstruction version:\t\t%f\n", conc_get_float(line, &return_code)); break; case MDC_CONC_HDR_MAP_SUBSETS: if (recon_type == MDC_CONC_RECON_OSEM3D_MAP) { temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("OSEM3D Subsets:\t\t\t%d\n", temp_int); } break; case MDC_CONC_HDR_MAP_OSEM3D_ITERATIONS: if (recon_type == MDC_CONC_RECON_OSEM3D_MAP) { temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("OSEM3D Iterations:\t\t%d\n", temp_int); } break; case MDC_CONC_HDR_MAP_ITERATIONS: if (recon_type == MDC_CONC_RECON_OSEM3D_MAP) { temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("MAP Iterations:\t\t\t%d\n", temp_int); } break; case MDC_CONC_HDR_MAP_BETA: if (recon_type == MDC_CONC_RECON_OSEM3D_MAP) { temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("MAP Beta:\t\t\t%5.3f\n", temp_float); } break; case MDC_CONC_HDR_MAP_BLUR_TYPE: if (recon_type == MDC_CONC_RECON_OSEM3D_MAP) { temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("MAP Blur Type:\t\t\t%d\n", temp_int); } break; case MDC_CONC_HDR_MAP_PRIOR_TYPE: if (recon_type == MDC_CONC_RECON_OSEM3D_MAP) { temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("MAP Prior Type:\t\t\t%d\n", temp_int); } break; case MDC_CONC_HDR_MAP_BLUR_FILE: if (recon_type == MDC_CONC_RECON_OSEM3D_MAP) { temp_string = conc_get_string(line, &return_code); if (MDC_INFO) MdcPrntScrn("MAP Blur File:\t\t\t%s\n",temp_string); MdcFree(temp_string); } break; case MDC_CONC_HDR_MAP_PMATRIX_FILE: if (recon_type == MDC_CONC_RECON_OSEM3D_MAP) { temp_string = conc_get_string(line, &return_code); if (MDC_INFO) MdcPrntScrn("MAP PMatrix File:\t\t%s\n",temp_string); MdcFree(temp_string); } break; case MDC_CONC_HDR_OSEM2D_METHOD: if (recon_type == MDC_CONC_RECON_OSEM2D) { MdcConcOSEM2DTypes osem_type; temp_int = conc_get_int(line, &return_code); if ((temp_int >= 0) && (temp_int < MDC_CONC_NUM_OSEM2D_TYPES)) { osem_type = temp_int; if (MDC_INFO) MdcPrntScrn("OSEM2D type:\t\t\t%d=%s\n", temp_int, MdcConcOSEM2DTypeNames[osem_type]); }else{ osem_type = MDC_CONC_OSEM2D_UNKNOWN; } } break; case MDC_CONC_HDR_OSEM2D_SUBSETS: if (recon_type == MDC_CONC_RECON_OSEM2D) { temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("OSEM2D Subsets:\t\t\t%d\n", temp_int); } break; case MDC_CONC_HDR_OSEM2D_ITERATIONS: if (recon_type == MDC_CONC_RECON_OSEM2D) { temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("OSEM2D Iterations:\t\t%d\n", temp_int); } break; case MDC_CONC_HDR_OSEM2D_EM_ITERATIONS: if (recon_type == MDC_CONC_RECON_OSEM2D) { temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("OSEM2D EM Iterations:\t\t%d\n", temp_int); } break; /* Epsilon and power values for map regularization (float integer) */ case MDC_CONC_HDR_OSEM2D_MAP: if (recon_type == MDC_CONC_RECON_OSEM2D) { conc_get_float_int(line, &return_code, &temp_float, &temp_int); temp_int = conc_get_int(line, &return_code); if (MDC_INFO) { MdcPrntScrn("OSEM2D Epsilon:\t\t\t%5.3f\n", temp_float); MdcPrntScrn("OSEM2D Power:\t\t\t%d\n", temp_int); } } break; case MDC_CONC_HDR_OSEM2D_X_OFFSET: if (recon_type == MDC_CONC_RECON_OSEM2D) { temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("OSEM2D X_Offset:\t\t%5.3f\n", temp_float); } break; case MDC_CONC_HDR_OSEM2D_Y_OFFSET: if (recon_type == MDC_CONC_RECON_OSEM2D) { temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("OSEM2D Y_Offset:\t\t%5.3f\n", temp_float); } break; case MDC_CONC_HDR_OSEM2D_ZOOM: osem2d_recon_zoom = conc_get_float(line, &return_code); if (recon_type == MDC_CONC_RECON_OSEM2D) { if (MDC_INFO) MdcPrntScrn("OSEM2D Recon Zoom:\t\t%5.3f\n", osem2d_recon_zoom); } break; case MDC_CONC_HDR_DEADTIME_CORRECTION_APPLIED: temp_int = conc_get_int(line, &return_code); if ((temp_int >= 0) && (temp_int < MDC_CONC_NUM_DEAD_CORR_TYPES)) { deadtime_correction = temp_int; }else{ deadtime_correction = MDC_CONC_DEAD_CORR_NONE; } if (MDC_INFO) MdcPrntScrn("Deadtime correction applied:\t%d=%s\n", temp_int, MdcConcDeadCorrTypeNames[deadtime_correction]); break; case MDC_CONC_HDR_DECAY_CORRECTION_APPLIED: fi->decay_corrected = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("Decay correction applied:\t%d=%s\n", fi->decay_corrected, fi->decay_corrected ? "applied" : "not applied"); break; case MDC_CONC_HDR_NORMALIZATION_APPLIED: { MdcConcNormTypes norm_type; temp_int = conc_get_int(line, &return_code); if ((temp_int >= 0) && (temp_int < MDC_CONC_NUM_NORM_TYPES)) { norm_type = temp_int; }else{ norm_type = MDC_CONC_NORM_NONE; } if (MDC_INFO) MdcPrntScrn("Normalization applied:\t\t%d=%s\n", temp_int, MdcConcNormTypeNames[norm_type]); } break; case MDC_CONC_HDR_NORMALIZATION_FILENAME: temp_string = conc_get_string(line, &return_code); if (MDC_INFO) MdcPrntScrn("Normalization file:\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_ATTENUATION_APPLIED: { MdcConcAttnCorrTypes attn_type; temp_int = conc_get_int(line, &return_code); if ((temp_int >= 0) && (temp_int < MDC_CONC_NUM_ATTN_CORR_TYPES)) { attn_type = temp_int; }else{ attn_type = MDC_CONC_ATTN_CORR_NONE; } if (MDC_INFO) MdcPrntScrn("Attenuation correction applied:\t%d=%s\n", temp_int, MdcConcAttnCorrNames[attn_type]); } break; case MDC_CONC_HDR_ATTENUATION_FILENAME: temp_string = conc_get_string(line, &return_code); if (MDC_INFO) MdcPrntScrn("Attenuation file:\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_SCATTER_CORRECTION: { MdcConcScatterCorrTypes scatter_type; temp_int = conc_get_int(line, &return_code); if ((temp_int >= 0) && (temp_int < MDC_CONC_NUM_SCATTER_CORR_TYPES)) { scatter_type = temp_int; }else{ scatter_type = MDC_CONC_SCATTER_CORR_NONE; } if (MDC_INFO) MdcPrntScrn("Scatter correction applied:\t%d=%s\n", temp_int, MdcConcScatterCorrNames[scatter_type]); } break; case MDC_CONC_HDR_SCATTER_VERSION: if (MDC_INFO) MdcPrntScrn("Scatter Correction version:\t%f\n", conc_get_float(line, &return_code)); break; case MDC_CONC_HDR_ARC_CORRECTION_APPLIED: temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("Arc correction applied:\t\t%d=%s\n", temp_int, temp_int ? "applied" : "not applied"); break; case MDC_CONC_HDR_ROTATION: case MDC_CONC_HDR_X_OFFSET: case MDC_CONC_HDR_Y_OFFSET: case MDC_CONC_HDR_Z_OFFSET: case MDC_CONC_HDR_ZOOM: case MDC_CONC_HDR_VOLUME_ORIGIN_X: case MDC_CONC_HDR_VOLUME_ORIGIN_Y: case MDC_CONC_HDR_VOLUME_ORIGIN_Z: case MDC_CONC_HDR_REGISTRATION_AVAILABLE: case MDC_CONC_HDR_TRANSFORMATION_MATRIX: case MDC_CONC_HDR_SPATIAL_IDENTIFIER: break; /* not sure how Concorde is using these things. */ case MDC_CONC_HDR_PIXEL_SIZE: temp_float = 10.0*conc_get_float(line, &return_code); /* in cm, convert to mm */ if ((MDC_INFO) && ((!found_pixel_size_x) || (!found_pixel_size_y))) MdcPrntScrn("Pixel Size (x,y) (mm):\t\t%5.3f\n", temp_float); if (!found_pixel_size_x) /* favor the pixel_size_x header entry */ fi->pixdim[1] = temp_float; if (!found_pixel_size_y) /* favor the pixel_size_y header entry */ fi->pixdim[2] = temp_float; break; case MDC_CONC_HDR_PIXEL_SIZE_X: temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("Pixel Size (x) (mm):\t\t%5.3f\n", temp_float); fi->pixdim[1] = temp_float; found_pixel_size_x=MDC_TRUE; break; case MDC_CONC_HDR_PIXEL_SIZE_Y: temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("Pixel Size (y) (mm):\t\t%5.3f\n", temp_float); fi->pixdim[2] = temp_float; found_pixel_size_y=MDC_TRUE; break; case MDC_CONC_HDR_PIXEL_SIZE_Z: temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("Pixel Size (z) (mm):\t\t%5.3f\n", temp_float); fi->pixdim[3] = temp_float; found_pixel_size_z=MDC_TRUE; break; case MDC_CONC_HDR_CALIBRATION_UNITS: temp_int = conc_get_int(line, &return_code); if ((temp_int >= 0) && (temp_int < MDC_CONC_NUM_CALIB_UNITS)) { calibration_units = temp_int; }else{ calibration_units = MDC_CONC_CALIB_UNITS_UNKNOWN; } if (MDC_INFO) MdcPrntScrn("Calibration Units:\t\t%d=%s\n", temp_int, MdcConcCalibUnitNames[calibration_units]); break; case MDC_CONC_HDR_CALIBRATION_FACTOR: temp_float = conc_get_float(line, &return_code); calibration_factor *= temp_float; if (MDC_INFO) MdcPrntScrn("Calibration Factor:\t\t%5.3f\n",temp_float); break; case MDC_CONC_HDR_CALIBRATION_BRANCHING_FRACTION: if (MDC_INFO) MdcPrntScrn("Calibration branching fraction:\t%5.3f\n", conc_get_float(line, &return_code)); break; case MDC_CONC_HDR_NUMBER_OF_SINGLES_RATES: break; /* don't care */ case MDC_CONC_HDR_INVESTIGATOR: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Investigator:\t\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_OPERATOR: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Operator:\t\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_STUDY_IDENTIFIER: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Study ID:\t\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_ACQUISITION_USER_ID: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Acquisition user ID:\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_HISTOGRAM_USER_ID: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Histogram user ID:\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_RECONSTRUCTION_USER_ID: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Reconstruction user ID:\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_SCATTER_CORRECTION_USER_ID: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Scatter correction user ID:\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_ACQUISITION_NOTES: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Acquisition notes:\t\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_SCAN_TIME: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Scan Time:\t\t\t%s\n",temp_string); #ifdef HAVE_STRPTIME if (strlen(temp_string)) { time_struct.tm_mday=0; time_struct.tm_mon=0; time_struct.tm_year=0; time_struct.tm_hour=0; time_struct.tm_min=0; time_struct.tm_sec=0; time_struct.tm_isdst=-1; strptime(temp_string, "%a %b %d %T %Y", &time_struct); if (time_struct.tm_year != 0) { fi->study_date_day = time_struct.tm_mday; fi->study_date_month = time_struct.tm_mon+1; fi->study_date_year = time_struct.tm_year+1900; fi->study_time_hour = time_struct.tm_hour; fi->study_time_minute = time_struct.tm_min; fi->study_time_second = time_struct.tm_sec; scan_time = mktime(&time_struct); if (scan_time > 0) found_scan_time=MDC_TRUE; } } #endif MdcFree(temp_string); break; case MDC_CONC_HDR_GMT_SCAN_TIME: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("GMT Scan time:\t\t\t%s\n",temp_string); MdcFree(temp_string); break; break; case MDC_CONC_HDR_INJECTED_COMPOUND: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Injected Compound:\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_DOSE_UNITS: injected_dose_units = conc_get_int(line, &return_code); if ((injected_dose_units < 0) || (injected_dose_units >= MDC_CONC_NUM_DOSE_UNITS)) { injected_dose_units = MDC_CONC_DOSE_UNITS_UNKNOWN; } else { found_injected_dose_units = MDC_TRUE; } if (MDC_INFO) MdcPrntScrn("Dose Units:\t\t\t%d=%s\n", injected_dose_units, MdcConcDoseUnitNames[injected_dose_units]); break; case MDC_CONC_HDR_INJECTED_DOSE: temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("Injected Dose:\t\t\t%5.3f\n", temp_float); if (temp_float > 0.0) { injected_dose= temp_float; found_injected_dose = MDC_TRUE; } break; case MDC_CONC_HDR_INJECTION_TIME: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Injection Time:\t\t\t%s\n",temp_string); #ifdef HAVE_STRPTIME if (strlen(temp_string)) { time_struct.tm_mday=0; time_struct.tm_mon=0; time_struct.tm_year=0; time_struct.tm_hour=0; time_struct.tm_min=0; time_struct.tm_sec=0; time_struct.tm_isdst=-1; strptime(temp_string, "%a %b %d %T %Y", &time_struct); if (time_struct.tm_year != 0) { injection_time = mktime(&time_struct); if (injection_time > 0) found_injection_time=MDC_TRUE; } } #endif MdcFree(temp_string); break; case MDC_CONC_HDR_INJECTION_DECAY_CORRECTION: temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("Injection Decay Correction:\t%5.3f\n",temp_float); if ( temp_float >= 1.0) { injection_decay_correction = temp_float; found_injection_decay_correction = MDC_TRUE; } break; case MDC_CONC_HDR_ACTIVITY_UNITS: /* used for both activity_before_injection and residual_activity */ activity_units = conc_get_int(line, &return_code); if ((activity_units < 0) || (activity_units >= MDC_CONC_NUM_DOSE_UNITS)) { activity_units = MDC_CONC_DOSE_UNITS_UNKNOWN; } else { if (MDC_INFO) found_activity_units = MDC_TRUE; } if (MDC_INFO) MdcPrntScrn("Activity Units:\t\t\t%d=%s\n", activity_units, MdcConcDoseUnitNames[activity_units]); break; case MDC_CONC_HDR_ACTIVITY_BEFORE_INJECTION: temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("Activity before injection:\t%5.3f\n", temp_float); if (temp_float > 0.0) { activity_before_injection = temp_float; found_activity_before_injection = MDC_TRUE; } break; case MDC_CONC_HDR_ACTIVITY_BEFORE_INJECTION_TIME: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Activity Before Injection Time:\t%s\n",temp_string); #ifdef HAVE_STRPTIME if (strlen(temp_string)) { time_struct.tm_mday=0; time_struct.tm_mon=0; time_struct.tm_year=0; time_struct.tm_hour=0; time_struct.tm_min=0; time_struct.tm_sec=0; time_struct.tm_isdst=-1; strptime(temp_string, "%a %b %d %T %Y", &time_struct); if (time_struct.tm_year != 0) { activity_before_injection_time = mktime(&time_struct); if (activity_before_injection_time > 0) found_activity_before_injection_time=MDC_TRUE; } } #endif MdcFree(temp_string); break; case MDC_CONC_HDR_RESIDUAL_ACTIVITY: residual_activity = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("Residual Activity:\t\t%5.3f\n", residual_activity); break; case MDC_CONC_HDR_RESIDUAL_ACTIVITY_TIME: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Residual activity time:\t\t%s\n",temp_string); #ifdef HAVE_STRPTIME if (strlen(temp_string)) { time_struct.tm_mday=0; time_struct.tm_mon=0; time_struct.tm_year=0; time_struct.tm_hour=0; time_struct.tm_min=0; time_struct.tm_sec=0; time_struct.tm_isdst=-1; strptime(temp_string, "%a %b %d %T %Y", &time_struct); if (time_struct.tm_year != 0) { residual_activity_time = mktime(&time_struct); if (residual_activity_time > 0) found_residual_activity_time=MDC_TRUE; } } #endif MdcFree(temp_string); break; case MDC_CONC_HDR_GATE_INPUTS: temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("Number of Gate Inputs:\t\t%d\n", temp_int); MdcGetStructGD(fi, (unsigned)temp_int); break; case MDC_CONC_HDR_GATE_BINS: conc_get_int_int_float_float(line, &return_code, &temp_int, &temp_int2, &temp_float, &temp_float2); if (MDC_INFO) { MdcPrntScrn("Number of Bins for Gate %d:\t%d\n", temp_int, temp_int2); MdcPrntScrn(" min/max gate cycle:\t%5.3f/%5.3f\n", temp_float, temp_float2); } if (fi->gdata == NULL) return("CONC gate_inputs line must preceed gate_bins line"); if (temp_int >= fi->gatednr) return("CONC more gates found then specified in gate_inputs line"); gd = &(fi->gdata[temp_int]); gd->nr_projections = temp_int2; gd->window_low = temp_float*1000.; gd->window_high = temp_float*1000.; /* note, there can be more then one gate entry (for instance, cardiac and respiratory), we just combine all separate gates */ if (fi->dim[5] == 0) fi->dim[5] = temp_int2; else fi->dim[5]*=temp_int2; if (!found_time_frames) { /* older files did not have the time_frames entry, only total_frames, estimate our time_frames by dividing by the # of gates */ time_frames = total_frames/=fi->dim[5]; /* Concorde sets total frames = total gates */ if (time_frames == 0) time_frames = 1; /* Concorde not always consistent to frames = total gates*/ } break; case MDC_CONC_HDR_GATE_DESCRIPTION: conc_get_int_string(line, &return_code, &temp_int, &temp_string); if (MDC_INFO) MdcPrntScrn("Gate %d description:\t\t%s\n", temp_int, temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_SUBJECT_IDENTIFIER: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Subject ID:\t\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_SUBJECT_GENUS: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Subject Genus:\t\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_SUBJECT_ORIENTATION: temp_int = conc_get_int(line, &return_code); if ((temp_int < 0) || (temp_int >= MDC_CONC_NUM_SUBJECT_ORIENTATIONS)) { temp_int = MDC_CONC_SUBJECT_ORIENTATION_UNKNOWN; } if (MDC_INFO) MdcPrntScrn("Subject Orientation:\t\t%d=%s\n", temp_int, MdcConcSubjectOrientationNames[temp_int]); switch(temp_int) { case MDC_CONC_SUBJECT_ORIENTATION_FEET_PRONE: fi->pat_slice_orient=MDC_PRONE_FEETFIRST_TRANSAXIAL; break; case MDC_CONC_SUBJECT_ORIENTATION_HEAD_PRONE: fi->pat_slice_orient=MDC_PRONE_HEADFIRST_TRANSAXIAL; break; case MDC_CONC_SUBJECT_ORIENTATION_FEET_SUPINE: fi->pat_slice_orient=MDC_SUPINE_FEETFIRST_TRANSAXIAL; break; case MDC_CONC_SUBJECT_ORIENTATION_HEAD_SUPINE: fi->pat_slice_orient=MDC_SUPINE_HEADFIRST_SAGITTAL; break; case MDC_CONC_SUBJECT_ORIENTATION_FEET_RIGHT: fi->pat_slice_orient=MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL; break; case MDC_CONC_SUBJECT_ORIENTATION_HEAD_RIGHT: fi->pat_slice_orient=MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL; break; case MDC_CONC_SUBJECT_ORIENTATION_FEET_LEFT: fi->pat_slice_orient=MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL; break; case MDC_CONC_SUBJECT_ORIENTATION_HEAD_LEFT: fi->pat_slice_orient=MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL; break; case MDC_CONC_SUBJECT_ORIENTATION_UNKNOWN: default: fi->pat_slice_orient=MDC_UNKNOWN; break; } break; case MDC_CONC_HDR_SUBJECT_LENGTH_UNITS: temp_int = conc_get_int(line, &return_code); if ((temp_int < 0) || (temp_int >= MDC_CONC_NUM_LENGTH_UNITS)) { temp_int = MDC_CONC_LENGTH_UNITS_UNKNOWN; } if (MDC_INFO) MdcPrntScrn("Length Units:\t\t\t%d=%s\n", temp_int, MdcConcLengthUnitNames[temp_int]); break; case MDC_CONC_HDR_SUBJECT_LENGTH: temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("Subject Length:\t\t\t%5.3f\n", temp_float); break; case MDC_CONC_HDR_SUBJECT_WEIGHT_UNITS: weight_units = conc_get_int(line, &return_code); if ((weight_units < 0) || (weight_units >= MDC_CONC_NUM_WEIGHT_UNITS)) { weight_units = MDC_CONC_WEIGHT_UNITS_UNKNOWN; } if (MDC_INFO) MdcPrntScrn("Weight Units:\t\t\t%d=%s\n", weight_units, MdcConcWeightUnitNames[weight_units]); /* next line incase SUBJECT_WEIGHT read before WEIGHT_UNITS */ fi->patient_weight = conc_convert_weight_to_kg(fi->patient_weight, weight_units); break; case MDC_CONC_HDR_SUBJECT_WEIGHT: temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("Subject Weight:\t\t\t%5.3f\n", temp_float); fi->patient_weight = conc_convert_weight_to_kg(temp_float,weight_units); break; case MDC_CONC_HDR_SUBJECT_PHENOTYPE: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Subject Phenotype:\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_STUDY_MODEL: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Study Model:\t\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_ANESTHESIA: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Anesthesia:\t\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_ANALGESIA: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Analgesia:\t\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_OTHER_DRUGS: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Other drugs:\t\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_FOOD_ACCESS: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Food Access:\t\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_WATER_ACCESS: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Water Access:\t\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_SUBJECT_DOB: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Subject date of birth:\t\t%s\n",temp_string); MdcStringCopy(fi->patient_dob, temp_string,strlen(temp_string)); MdcFree(temp_string); break; case MDC_CONC_HDR_SUBJECT_AGE: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Subject age:\t\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_SUBJECT_SEX: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Subject sex:\t\t\t%s\n",temp_string); MdcStringCopy(fi->patient_sex, temp_string,strlen(temp_string)); MdcFree(temp_string); break; case MDC_CONC_HDR_SUBJECT_SCAN_REGION: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Subject scan region:\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_SUBJECT_GLUCOSE_LEVEL: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Subject glucose level:\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_SUBJECT_GLUCOSE_LEVEL_TIME: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Subject glucose level measurement time:\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_ACQUISITION_FILE_NAME: temp_string = conc_get_string(line, &return_code); if ((MDC_INFO) && (strlen(temp_string))) MdcPrntScrn("Acquisition file name:\t\t%s\n",temp_string); MdcFree(temp_string); break; case MDC_CONC_HDR_GANTRY_ROTATION: temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("Gantry rotation:\t\t%d\n",temp_int); break; case MDC_CONC_HDR_ROTATION_DIRECTION: temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("Rotation direction:\t\t%d\n",temp_int); break; case MDC_CONC_HDR_ROTATING_STAGE_START_POSITION: temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("Rotating stage start position:\t%f (degrees)\n",temp_float); break; case MDC_CONC_HDR_ROTATING_STAGE_STOP_POSITION: temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("Rotating stage stop position:\t%f (degrees)\n",temp_float); break; case MDC_CONC_HDR_NUMBER_OF_PROJECTIONS: temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("Number of projections:\t\t%d\n",temp_int); break; case MDC_CONC_HDR_GANTRY_ROTATIONS: temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("Gantry rotations:\t\t%f\n",temp_float); break; case MDC_CONC_HDR_CT_FILE_VERSION: temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("CT file version:\t\t%d\n",temp_int); break; case MDC_CONC_HDR_CT_HEADER_SIZE: temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("CT header size:\t\t\t%d\n",temp_int); break; case MDC_CONC_HDR_CT_PROJ_SIZE_TRANSAXIAL: temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("Projection size transaxial:\t%d (pixels)\n",temp_int); break; case MDC_CONC_HDR_CT_PROJ_SIZE_AXIAL: temp_int = conc_get_int(line, &return_code); if (MDC_INFO) MdcPrntScrn("Projection size axial:\t\t%d (pixels)\n",temp_int); break; case MDC_CONC_HDR_CT_AVERAGE_DARK_PROJECTIONS: case MDC_CONC_HDR_CT_AVERAGE_LIGHT_PROJECTIONS: case MDC_CONC_HDR_CT_LIGHT_CALIBRATION_PROJECTIONS: case MDC_CONC_HDR_CT_DEPENDENT_LIGHT_CALIBRATION_PROJECTIONS: case MDC_CONC_HDR_CT_XRAY_DETECTOR_OFFSET: case MDC_CONC_HDR_CT_DETECTOR_TRANSAXIAL_POSITION: case MDC_CONC_HDR_CT_UNCROPPED_TRANSAXIAL_PIXELS: case MDC_CONC_HDR_CT_UNCROPPED_AXIAL_PIXELS: case MDC_CONC_HDR_CT_CROPPED_TRANSAXIAL_PIXELS: case MDC_CONC_HDR_CT_CROPPED_AXIAL_PIXELS: case MDC_CONC_HDR_CT_XRAY_DETECTOR_PITCH: case MDC_CONC_HDR_CT_HORIZ_ROT_AXIS_BED_ANGLE: case MDC_CONC_HDR_CT_VERT_ROT_AXIS_BED_ANGLE: case MDC_CONC_HDR_CT_EXPOSURE_TIME: case MDC_CONC_HDR_CT_SCAN_TIME: case MDC_CONC_HDR_CT_WARPING: case MDC_CONC_HDR_CT_DEFECT_MAP_FILE_NAME: /* don't care */ break; case MDC_CONC_HDR_CT_XRAY_VOLTAGE: temp_float = conc_get_float(line,&return_code); if (MDC_INFO) MdcPrntScrn("CT X-ray voltage:\t\t%f (kVp)\n",temp_float); break; case MDC_CONC_HDR_CT_ANODE_CURRENT: temp_float = conc_get_float(line,&return_code); if (MDC_INFO) MdcPrntScrn("CT anode current:\t\t%f (uA)\n",temp_float); break; case MDC_CONC_HDR_CT_CALIBRATION_EXPOSURES: case MDC_CONC_HDR_CT_CONE_ANGLE: case MDC_CONC_HDR_CT_PROJECTION_INTERPOLATION: case MDC_CONC_HDR_CT_SOURCE_TO_DETECTOR: case MDC_CONC_HDR_CT_SOURCE_TO_CROT: case MDC_CONC_HDR_CT_DETECTOR_VERTICAL_OFFSET: case MDC_CONC_HDR_CT_DETECTOR_HORIZONTAL_TILT: case MDC_CONC_HDR_CT_DETECTOR_VERTICAL_TILT: case MDC_CONC_HDR_CT_TRANSAXIAL_BIN_FACTOR: case MDC_CONC_HDR_CT_AXIAL_BIN_FACTOR: case MDC_CONC_HDR_CT_GATING: /* don't care */ break; case MDC_CONC_HDR_CT_HOUNSFIELD_SCALE: temp_float = conc_get_float(line,&return_code); if (MDC_INFO) MdcPrntScrn("Hounsfield scale:\t\t%f\n",temp_float); break; case MDC_CONC_HDR_CT_HOUNSFIELD_OFFSET: temp_float = conc_get_float(line,&return_code); if (MDC_INFO) MdcPrntScrn("Hounsfield offset:\t\t%f\n",temp_float); break; case MDC_CONC_HDR_CT_PROJ_DOWNSAMPLE_FACTOR: case MDC_CONC_HDR_CT_FIRST_RECON_PROJ: case MDC_CONC_HDR_CT_LAST_RECON_PROJ: case MDC_CONC_HDR_CT_RECON_EVERY_NTH_PROJ: /* don't care */ break; case MDC_CONC_HDR_CT_ATTENUATION_WATER: temp_float = conc_get_float(line,&return_code); if (MDC_INFO) MdcPrntScrn("Attenuation of water:\t\t%f (cm^-1)\n",temp_float); break; case MDC_CONC_HDR_CT_TX_ROTATION_OFFSETS: case MDC_CONC_HDR_CT_TX_TRANSAXIAL_OFFSETS: /* don't care */ break; case MDC_CONC_HDR_CT_BH_CORRECTION: temp_int = conc_get_int(line,&return_code); if (MDC_INFO) MdcPrntScrn("Beam hardening correction:\t%d (%s)\n", temp_int, temp_int ? "applied" : "not applied"); break; case MDC_CONC_HDR_CT_ALUMINUM_FILTER_THICKNESS: case MDC_CONC_HDR_PROJECTION: case MDC_CONC_HDR_CT_PROJECTION_AVERAGE_CENTER_OFFSET: case MDC_CONC_HDR_CT_PROJECTION_CENTER_OFFSET: case MDC_CONC_HDR_CT_PROJECTION_HORIZONTAL_BED_OFFSET: break; case MDC_CONC_HDR_END_OF_HEADER: done = MDC_TRUE; break; case MDC_CONC_HDR_EOF: done = MDC_TRUE; return("CONC Got inappropriate EOF on reading Siemens/Concorde header"); break; case MDC_CONC_HDR_UNKNOWN: default: if (num_garbage_lines < MDC_MAX_NUM_GARBAGE_LINES) { MdcPrntWarn("CONC Uninterpretable line: %s",line); } num_garbage_lines++; break; } MdcFree(line); } if (!(found_total_frames || found_time_frames) || !found_data_type) { return("CONC Header file didn't contain necessary entries"); } if (MDC_ECHO_ALIAS == MDC_YES) { MdcEchoAliasName(fi); return(NULL); } /* favor activity_before_injection parameter over injected_dose */ if (found_activity_before_injection) { /* convert activities to MBq if needed */ if (found_activity_units) { activity_before_injection = conc_convert_injected_dose_to_MBq(activity_before_injection, activity_units); residual_activity = conc_convert_injected_dose_to_MBq(residual_activity, activity_units); } /* decay correct activity_before_injection to start of scan */ if (found_half_life && found_scan_time && found_activity_before_injection_time) { activity_before_injection *= pow(0.5, (scan_time-activity_before_injection_time)/fi->isotope_halflife); } /* decay correct residual activity to start of scan */ if (found_half_life && found_scan_time && found_residual_activity_time) { residual_activity *= pow(0.5, (scan_time-residual_activity_time)/fi->isotope_halflife); } fi->injected_dose = activity_before_injection - residual_activity; if (MDC_INFO) MdcPrntScrn("Injected Dose at Scan Start:\t%5.3f\n", fi->injected_dose); } else if (found_injected_dose) { /* use injected dose */ /* convert activities to MBq if needed */ if (found_injected_dose_units) { injected_dose = conc_convert_injected_dose_to_MBq(injected_dose, injected_dose_units); } /* favor using injection_decay_factor, as less likely to get screwed up */ if (found_injection_decay_correction) { injected_dose /= injection_decay_correction; } else { /* decay correct activity_before_injection to start of scan */ if (found_half_life && found_scan_time && found_injection_time) { injected_dose *= pow(0.5, (scan_time-injection_time)/fi->isotope_halflife); } } fi->injected_dose = injected_dose; if (MDC_INFO) MdcPrntScrn("Injected Dose at Scan Start:\t%5.3f\n", fi->injected_dose); } /* figure out remaining parameters of the FILEINFO structure */ fi->dim[0]=5; fi->pixdim[0]=5; fi->dim[4] = time_frames; fi->dim[7]=1; if (!found_beds) fi->dim[6]=1; number = fi->dim[7]*fi->dim[6]*fi->dim[5]*fi->dim[4]*fi->dim[3]; fi->truncated = MDC_NO; if (number == 0) return("CONC No valid images specified"); /* not worrying about filling in patient orientation */ /* figure out a guess at the raw filename from the header name */ /* allows us to complain if the raw filename in the header is different */ MdcMergePath(fi->ipath,fi->idir,fi->ifname); header_derived_filename = (char *)strdup(fi->ipath); MdcSplitPath(fi->ipath,fi->idir,fi->ifname); pfilename = strstr(header_derived_filename, ".hdr"); if (pfilename == NULL) { MdcFree(header_derived_filename); header_derived_filename = NULL; } else { strcpy(pfilename, "\0"); } /* complain if the filename derived from the header's filename doesn't match the file_name entry in the header */ if (header_derived_filename != NULL) { if (strcmp(header_derived_filename, base_filename) != 0) { MdcPrntWarn("CONC Name mismatch between header entry & derived file\n" \ "\t\t using: %s\n", base_filename); } } #if MDC_ENABLE_ISOTOPE_BRANCHING_FRACTION /* adjust the calibration factor with the branching factor if needed */ if (!transmission_scan) calibration_factor /= isotope_branching_factor; #endif /* need to open up the raw data file */ fi->ifp_raw = fopen(raw_filename, "rb"); /* try filename with bogus path info removed, *nix or DOS style */ if (fi->ifp_raw == NULL) fi->ifp_raw = fopen(base_filename, "rb"); /* maybe a compressed file */ if (fi->ifp_raw == NULL) { MdcAddCompressionExt(fi->compression, base_filename); if (MdcFileExists(base_filename)) { if (MdcDecompressFile(base_filename) != MDC_OK) { MdcFree(raw_filename); return("CONC Decompression image file failed"); } fi->ifp_raw = fopen(base_filename, "rb"); if (fi->ifp_raw != NULL) unlink(base_filename); /* delete after use */ } } /* allright, try guessing the filename */ if ((fi->ifp_raw == NULL) && (header_derived_filename != NULL)) { fi->ifp_raw = fopen(header_derived_filename, "rb"); if (fi->ifp_raw != NULL) { /* complain we're picking our own data file */ MdcPrntWarn("CONC Header specified raw file (%s) not found," \ "\t\t using: %s",base_filename, header_derived_filename); } } /* fix original path and free strings */ MdcFree(raw_filename); if (header_derived_filename != NULL) MdcFree(header_derived_filename); if (fi->ifp_raw == NULL) return("CONC Couldn't open raw data file"); /* malloc IMG_DATA structs */ if (!MdcGetStructID(fi,number)) return("CONC Bad malloc IMG_DATA structs"); /* malloc DYNAMIC_DATA structs */ if (!MdcGetStructDD(fi,(unsigned) (fi->dim[4]*fi->dim[5]))) return("CONC Bad malloc DYNAMIC_DATA structs"); /* malloc BED_DATA structs */ if (!MdcGetStructBD(fi,(unsigned)fi->dim[6])) return("CONC Bad malloc BED_DATA structs"); img = 0; /* read each of the beds, gates, and frames */ for (i_bed = 0; i_bed < fi->dim[6]; i_bed++) { for (i_gate = 0; i_gate < fi->dim[5]; i_gate++) { for (i_frame = 0; i_frame < fi->dim[4]; i_frame++) { if (fi->dynnr > 0) dd = &fi->dyndata[i_frame+i_gate*fi->dim[4]]; if (dd != NULL) dd->nr_of_slices = fi->dim[3]; if (fi->bednr > 0) bd = &fi->beddata[i_bed]; if (MDC_INFO) MdcPrintLine('-', MDC_HALF_LENGTH); if (MDC_INFO) MdcPrntScrn("Bed: \t\t\t\t%d\n",i_bed); if (MDC_INFO) MdcPrntScrn("Gate: \t\t\t\t%d\n",i_gate); if (MDC_INFO) MdcPrntScrn("Frame:\t\t\t\t%d\n",i_frame); first_plane = &fi->image[img]; first_plane->width = fi->dim[1]; first_plane->height = fi->dim[2]; first_plane->bits = fi->bits; first_plane->type = fi->type; first_plane->pixel_xsize = fi->pixdim[1]; first_plane->pixel_ysize = fi->pixdim[2]; first_plane->slice_width = fi->pixdim[3]; if (recon_type == MDC_CONC_RECON_OSEM2D) if (osem2d_recon_zoom > 0) first_plane->recon_scale = osem2d_recon_zoom; /* otherwise use default */ /* continue reading through the header to get the frame info */ done = MDC_FALSE; high_file_pointer=low_file_pointer=-1; while (!done) { block_value = conc_find_next_block_line(hdr_fp, &line); switch (block_value) { case MDC_CONC_BLOCK_FRAME: temp_int = conc_get_int(line, &return_code); if (temp_int != i_frame) { MdcPrntWarn("CONC Detected frame numbering discrepancy"); } break; case MDC_CONC_BLOCK_DETECTOR_PANEL: break; /* don't care */ case MDC_CONC_BLOCK_EVENT_TYPE: { MdcConcEventTypes event_type; temp_int = conc_get_int(line, &return_code); if ((temp_int >= 0) && (temp_int < MDC_CONC_NUM_EVENT_TYPES)) { event_type = temp_int; }else{ event_type = MDC_CONC_EVENT_UNKNOWN; } if (MDC_INFO) MdcPrntScrn("\tEvent type for block:\t%d=%s\n", temp_int, MdcConcEventTypeNames[event_type]); } break; case MDC_CONC_BLOCK_ENERGY_WINDOW: break; /* don't care */ case MDC_CONC_BLOCK_GATE: temp_int = conc_get_int(line, &return_code); if (temp_int != i_gate) { MdcPrntWarn("CONC Detected gate numbering discrepancy"); } break; case MDC_CONC_BLOCK_BED: temp_int = conc_get_int(line, &return_code); if (temp_int != i_bed) { MdcPrntWarn("CONC Detected bed numbering discrepancy"); } break; case MDC_CONC_BLOCK_BED_OFFSET: temp_float = 10*conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("\tBed offset (mm):\t%5.3f\n", temp_float); bd->hoffset = temp_float; break; case MDC_CONC_BLOCK_ENDING_BED_OFFSET: if (MDC_INFO) MdcPrntScrn("\tBed ending offset (mm):\t%5.3f\n" ,10*conc_get_float(line, &return_code)); break; case MDC_CONC_BLOCK_BED_PASSES: /* I have no idea what this parameter means */ break; case MDC_CONC_BLOCK_VERTICAL_BED_OFFSET: temp_float = 10*conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("\tBed vert. offset (mm):\t%5.3f\n", temp_float); bd->voffset = temp_float; break; case MDC_CONC_BLOCK_DATA_FILE_POINTER: conc_get_Int32_Int32(line, &return_code, &high_file_pointer , &low_file_pointer); break; case MDC_CONC_BLOCK_FRAME_START: temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("\tFrame start (s):\t%5.3f\n",temp_float); if (dd != NULL) dd->time_frame_start = temp_float * 1000.; break; case MDC_CONC_BLOCK_FRAME_DURATION: temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("\tFrame duration (s):\t%5.3f\n",temp_float); if (dd != NULL) dd->time_frame_duration = temp_float * 1000.; break; case MDC_CONC_BLOCK_SCALE_FACTOR: first_plane->quant_scale = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("\tScale factor:\t\t%9.8f\n",first_plane->quant_scale); break; case MDC_CONC_BLOCK_MINIMUM: /* don't store, we recalculate it */ temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("\tMinimum:\t\t%9.8f\n",temp_float); break; case MDC_CONC_BLOCK_MAXIMUM: /* don't store, we recalculate it */ temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("\tMaximum:\t\t%9.8f\n",temp_float); break; case MDC_CONC_BLOCK_DEADTIME_CORRECTION: temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("\tDeadtime correction:\t%9.8f\n",temp_float); break; case MDC_CONC_BLOCK_DECAY_CORRECTION: temp_float = conc_get_float(line, &return_code); if (MDC_INFO) MdcPrntScrn("\tDecay correction:\t%9.8f\n",temp_float); break; case MDC_CONC_BLOCK_PROMPTS: break; /* don't care */ case MDC_CONC_BLOCK_DELAYS: break; /* don't care */ case MDC_CONC_BLOCK_TRUES: break; /* don't care */ case MDC_CONC_BLOCK_PROMPTS_RATE: break; /* don't care */ case MDC_CONC_BLOCK_DELAYS_RATE: break; /* don't care */ case MDC_CONC_BLOCK_SINGLES: break; /* don't care */ case MDC_CONC_BLOCK_END_OF_HEADER: done = MDC_TRUE; break; case MDC_CONC_BLOCK_EOF: done = MDC_TRUE; MdcFree(line); return("CONC Got inapproprate EOF on reading Siemens/Concorde header"); break; case MDC_CONC_BLOCK_UNKNOWN: default: if (num_garbage_lines < MDC_MAX_NUM_GARBAGE_LINES) { MdcPrntWarn("CONC Uninterpretable line: %s",line); } num_garbage_lines++; break; } MdcFree(line); } plane_bytes = first_plane->width*first_plane->height*MdcType2Bytes(first_plane->type); /* where in the raw data file the frame starts */ if ((high_file_pointer >= 0) && (low_file_pointer >= 0)) { #ifdef HAVE_8BYTE_INT first_plane->load_location = high_file_pointer*INT_MAX + low_file_pointer; #else /* LONG_4BYTE */ /* since the fseek command uses long, we can't use the value of high_file_pointer in calculating where to fseek. */ if (high_file_pointer != 0) failed_to_read_64_bit = MDC_YES; first_plane->load_location = low_file_pointer; #endif } else { /* DATA_FILE_POINTER header entry not used, calculate it instead */ first_plane->load_location = img*plane_bytes; } /* and read in the info for the first plane, and the rest of the planes */ for(i_plane=0; i_plane < fi->dim[3]; i_plane++, img++) { plane = &fi->image[img]; plane->calibr_fctr = calibration_factor; if (i_plane != 0) { plane->width = first_plane->width; plane->height = first_plane->height; plane->bits = first_plane->bits; plane->type = first_plane->type; plane->quant_scale = first_plane->quant_scale; plane->slice_width = first_plane->slice_width; plane->pixel_xsize = first_plane->pixel_xsize; plane->pixel_ysize = first_plane->pixel_ysize; plane->recon_scale = first_plane->recon_scale; plane->load_location = first_plane->load_location+i_plane*plane_bytes; } } } /* i_frame */ } /* i_gate */ } /* i_bed */ /* complain some more about uninterpretable lines */ if (num_garbage_lines >= MDC_MAX_NUM_GARBAGE_LINES) { MdcPrntWarn("CONC Couldn't process %d header lines", num_garbage_lines); } #ifndef HAVE_8BYTE_INT /* warn about trying to access 64 bit locations */ if (failed_to_read_64_bit) { MdcPrntWarn("CONC Read past 2GB (32bit system), file read incomplete"); } #endif return NULL; } const char * MdcLoadCONC(FILEINFO *fi) { const char *msg; msg = MdcLoadHeaderCONC(fi); return(msg); } const char * MdcSavePlaneCONC(FILEINFO *fi, int img) { Int8 saved_norm_over_frames; Uint8 *newbuff, *buff; Int16 pixtype; size_t pixels, bytes; saved_norm_over_frames = MDC_NORM_OVER_FRAMES; if (MDC_QUANTIFY || MDC_CALIBRATE) { /* using global scale factor <=> normalize over ALL images */ MDC_NORM_OVER_FRAMES = MDC_NO; } pixtype = conc_save_type(fi); switch(pixtype) { case BIT16_S: newbuff = MdcGetImgBIT16_S(fi,(unsigned)img); break; case BIT32_S: newbuff = MdcGetImgBIT32_S(fi,(unsigned)img); break; case FLT32: default: newbuff = MdcGetImgFLT32(fi,(unsigned)img); break; } MDC_NORM_OVER_FRAMES = saved_norm_over_frames; if (fi->diff_size == MDC_YES) { buff = MdcGetResizedImage(fi, newbuff, pixtype, (unsigned)img); if (buff == NULL) return("CONC Bad malloc resized image"); MdcFree(newbuff); } else buff = newbuff; if (MDC_FILE_ENDIAN != MDC_HOST_ENDIAN) { MdcMakeImgSwapped(buff,fi,(unsigned)img,fi->mwidth,fi->mheight,pixtype); } pixels = fi->mwidth * fi->mheight; bytes = MdcType2Bytes(pixtype); if (fwrite(buff,bytes,pixels,fi->ofp_raw) != pixels) return("CONC Bad writing of image"); MdcFree(buff); return NULL; } const char *MdcSaveInitCONC(FILEINFO *fi, char *raw_filename) { char *pfilename; if (MDC_FILE_STDOUT == MDC_YES) return("CONC Writing to stdout unsupported for this format"); MDC_FILE_ENDIAN = MDC_WRITE_ENDIAN; if (XMDC_GUI == MDC_NO) { MdcDefaultName(fi,MDC_FRMT_CONC,fi->ofname,fi->ifname); } if (MDC_VERBOSE) MdcPrntMesg("Siemens/Concorde Writing <%s> ...",fi->ofname); /* check for colored files */ if (fi->map == MDC_MAP_PRESENT) return("CONC Colored files unsupported"); if (MdcKeepFile(fi->ofname)) return("CONC Header file exists!!"); if (fi->dim[7] > 1) return("CONC cannot handle files of this dimensions"); if ((fi->ofp = fopen(fi->ofname, "w")) == NULL) return("CONC Could not open header file for writing"); strncpy(raw_filename,fi->ofname,MDC_INPUT_STRING_SIZE-5); pfilename = strstr(raw_filename, ".img.hdr"); if (pfilename != NULL) strcpy(pfilename+4, "\0"); else strcat(raw_filename,".dat"); if (MdcKeepFile(raw_filename)) return("CONC Image file exists!!"); if ((fi->ofp_raw = fopen(raw_filename, "wb")) == NULL) return("CONC Could not open data file for writing"); return NULL; } const char *MdcSaveHeaderCONC(FILEINFO *fi, char *raw_filename) { MdcConcFilterTypes filter_type, i_filter_type; IMG_DATA * first_plane; BED_DATA * bd = NULL; GATED_DATA * gd = NULL; int i_bed, i_gate, i_frame, i_plane; float calibration_factor, fstart, fduration, slice_width; Int32 high_file_pointer, low_file_pointer; Uint32 img, fnr; Int16 pixtype; int dimensions, i_dim; size_t write_length; struct tm time_struct; fprintf(fi->ofp, "#\n# Header file for data file %s\n", raw_filename); fprintf(fi->ofp, "#\twith %d frames\n",fi->dim[4]*fi->dim[5]); fprintf(fi->ofp, "#\n# Siemens/Concorde image file - %s %s\n#\n" ,XMEDCON_PRGR, XMEDCON_VERSION); fprintf(fi->ofp, "#\n%s %5.3f\n", MdcConcHdrValueNames[MDC_CONC_HDR_VERSION] , MDC_CONC_SUPPORTED_VERSION); switch(fi->modality) { case M_PT: fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_MODALITY], MDC_CONC_MODALITY_PET); break; case M_CT: fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_MODALITY], MDC_CONC_MODALITY_CT); break; case M_ST: fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_MODALITY], MDC_CONC_MODALITY_SPECT); break; default: fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_MODALITY], MDC_CONC_MODALITY_UNKNOWN); break; } fprintf(fi->ofp, "#\n%s %s\n", MdcConcHdrValueNames[MDC_CONC_HDR_INSTITUTION] , fi->institution); fprintf(fi->ofp, "#\n%s %s\n", MdcConcHdrValueNames[MDC_CONC_HDR_STUDY] , fi->study_id); fprintf(fi->ofp, "#\n%s %s\n", MdcConcHdrValueNames[MDC_CONC_HDR_FILE_NAME] , raw_filename); fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_FILE_TYPE] , MDC_CONC_FILE_IMAGE); switch(fi->acquisition_type) { case MDC_ACQUISITION_TOMO: case MDC_ACQUISITION_STATIC: fprintf(fi->ofp, "#\n%s %d\n" , MdcConcHdrValueNames[MDC_CONC_HDR_ACQUISITION_MODE] , MDC_CONC_ACQ_EMISSION); break; case MDC_ACQUISITION_DYNAMIC: fprintf(fi->ofp, "#\n%s %d\n" , MdcConcHdrValueNames[MDC_CONC_HDR_ACQUISITION_MODE] , MDC_CONC_ACQ_DYNAMIC); break; case MDC_ACQUISITION_GATED: fprintf(fi->ofp, "#\n%s %d\n" , MdcConcHdrValueNames[MDC_CONC_HDR_ACQUISITION_MODE] , MDC_CONC_ACQ_GATED); break; case MDC_ACQUISITION_GSPECT: case MDC_ACQUISITION_UNKNOWN: default: fprintf(fi->ofp, "#\n%s %d\n" , MdcConcHdrValueNames[MDC_CONC_HDR_ACQUISITION_MODE] , MDC_CONC_ACQ_UNKNOWN); break; } fprintf(fi->ofp, "#\n%s %d\n" , MdcConcHdrValueNames[MDC_CONC_HDR_TOTAL_FRAMES] , fi->dim[4]*fi->dim[5]); fprintf(fi->ofp, "#\n%s %d\n" , MdcConcHdrValueNames[MDC_CONC_HDR_TIME_FRAMES] , fi->dim[4]); fprintf(fi->ofp, "#\n%s %d\n" , MdcConcHdrValueNames[MDC_CONC_HDR_NUMBER_BED_POSITIONS] , fi->dim[6]); fprintf(fi->ofp, "#\n%s %s\n" , MdcConcHdrValueNames[MDC_CONC_HDR_ISOTOPE] , fi->isotope_code); fprintf(fi->ofp, "#\n%s %e\n" , MdcConcHdrValueNames[MDC_CONC_HDR_ISOTOPE_HALF_LIFE] , fi->isotope_halflife); fprintf(fi->ofp, "# Note: isotope branching fraction is included in the calibration fraction\n%s %g\n" , MdcConcHdrValueNames[MDC_CONC_HDR_ISOTOPE_BRANCHING_FRACTION] , 1.0); slice_width = fi->pixdim[3]; #ifdef MDC_USE_SLICE_SPACING if (fi->number > 1) slice_width = fi->image[0].slice_spacing; #endif fprintf(fi->ofp, "#\n%s %g\n" , MdcConcHdrValueNames[MDC_CONC_HDR_AXIAL_CRYSTAL_PITCH] , 2.0*slice_width/10.0); pixtype = conc_save_type(fi); switch (pixtype) { case BIT8_S: fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_DATA_TYPE] , MDC_CONC_DATA_SBYTE); break; case BIT16_S: if (MDC_FILE_ENDIAN == MDC_LITTLE_ENDIAN) { fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_DATA_TYPE] , MDC_CONC_DATA_SSHORT_LE); }else{ fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_DATA_TYPE] , MDC_CONC_DATA_SSHORT_BE); } break; case BIT32_S: if (MDC_FILE_ENDIAN == MDC_LITTLE_ENDIAN) { fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_DATA_TYPE] , MDC_CONC_DATA_SINT_LE); }else{ fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_DATA_TYPE] , MDC_CONC_DATA_SINT_BE); } break; case FLT32 : default: if (MDC_FILE_ENDIAN == MDC_LITTLE_ENDIAN) { fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_DATA_TYPE] , MDC_CONC_DATA_FLOAT_LE); }else{ fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_DATA_TYPE] , MDC_CONC_DATA_FLOAT_BE); } } fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_DATA_ORDER] , MDC_CONC_ORDER_SINOGRAM); dimensions = 0; for (i_dim=1;i_dim<=6;i_dim++) dimensions += (fi->dim[i_dim] > 1) ? 1 : 0; fprintf(fi->ofp, "#\n%s %d\n" , MdcConcHdrValueNames[MDC_CONC_HDR_NUMBER_OF_DIMENSIONS] , 3); /* dimension is always 3... regardless of dynamic or gated */ fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_X_DIMENSION] , fi->dim[1]); fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_Y_DIMENSION] , fi->dim[2]); fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_Z_DIMENSION] , fi->dim[3]); fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_W_DIMENSION] , 1); /* not sure what this is used for... */ filter_type = 0; for (i_filter_type=0;i_filter_typefilter_type) == 0) filter_type = i_filter_type; fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_X_FILTER] , filter_type); fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_Y_FILTER] , MDC_CONC_FILTER_NONE); fprintf(fi->ofp, "#\n%s %d\n", MdcConcHdrValueNames[MDC_CONC_HDR_Z_FILTER] , MDC_CONC_FILTER_NONE); fprintf(fi->ofp, "#\n%s %d\n" , MdcConcHdrValueNames[MDC_CONC_HDR_RECON_ALGORITHM] , MDC_CONC_RECON_UNKNOWN); fprintf(fi->ofp, "#\n%s %d\n" , MdcConcHdrValueNames[MDC_CONC_HDR_DECAY_CORRECTION_APPLIED] , fi->decay_corrected); fprintf(fi->ofp, "#\n%s %g\n", MdcConcHdrValueNames[MDC_CONC_HDR_PIXEL_SIZE] , fi->pixdim[1]/10.); /* in cm */ fprintf(fi->ofp, "#\n%s %g\n", MdcConcHdrValueNames[MDC_CONC_HDR_PIXEL_SIZE_X] , fi->pixdim[1]); /* in mm*/ fprintf(fi->ofp, "#\n%s %g\n", MdcConcHdrValueNames[MDC_CONC_HDR_PIXEL_SIZE_Y] , fi->pixdim[2]); fprintf(fi->ofp, "#\n%s %g\n", MdcConcHdrValueNames[MDC_CONC_HDR_PIXEL_SIZE_Z] , fi->pixdim[3]); /* eNlf: don't use, scales always combined internally calibration_factor = fi->image[0].calibr_fctr; */ calibration_factor = 1.0; fprintf(fi->ofp, "#\n%s %g\n" , MdcConcHdrValueNames[MDC_CONC_HDR_CALIBRATION_FACTOR] , calibration_factor); if ((fi->study_date_month != 0) && (fi->study_date_year != 0)) { time_struct.tm_sec = fi->study_time_second; time_struct.tm_min = fi->study_time_minute; time_struct.tm_hour = fi->study_time_hour; time_struct.tm_mday = fi->study_date_day; time_struct.tm_mon = fi->study_date_month-1; time_struct.tm_year = fi->study_date_year-1900; time_struct.tm_isdst = -1; /* "-1" is suppose to let the system figure it out */ if (mktime(&time_struct) != -1) { /* make sure the time is proper */ fprintf(fi->ofp, "#\n%s %s" , MdcConcHdrValueNames[MDC_CONC_HDR_SCAN_TIME] , asctime(&time_struct)); } } fprintf(fi->ofp, "#\n%s %d\n" , MdcConcHdrValueNames[MDC_CONC_HDR_DOSE_UNITS] , MDC_CONC_DOSE_UNITS_MEGA_BEQUERELS); fprintf(fi->ofp, "#\n%s %g\n" , MdcConcHdrValueNames[MDC_CONC_HDR_INJECTED_DOSE] , fi->injected_dose); fprintf(fi->ofp, "#\n%s %g\n" , MdcConcHdrValueNames[MDC_CONC_HDR_INJECTION_DECAY_CORRECTION] , 1.0); fprintf(fi->ofp, "#\n%s %d\n" , MdcConcHdrValueNames[MDC_CONC_HDR_ACTIVITY_UNITS] , MDC_CONC_DOSE_UNITS_MEGA_BEQUERELS); fprintf(fi->ofp, "#\n%s %d\n" , MdcConcHdrValueNames[MDC_CONC_HDR_GATE_INPUTS] , fi->gatednr); for (i_gate=0; i_gate < fi->gatednr; i_gate++) { gd = &(fi->gdata[i_gate]); fprintf(fi->ofp, "#\n%s %d %1.0f %g %g\n" , MdcConcHdrValueNames[MDC_CONC_HDR_GATE_BINS] , i_gate , gd->nr_projections , gd->window_low/1000. , gd->window_high/1000.); } fprintf(fi->ofp, "#\n%s %d\n" , MdcConcHdrValueNames[MDC_CONC_HDR_SUBJECT_WEIGHT_UNITS] , MDC_CONC_WEIGHT_UNITS_KILOGRAMS); fprintf(fi->ofp, "#\n%s %g\n" , MdcConcHdrValueNames[MDC_CONC_HDR_SUBJECT_WEIGHT] , fi->patient_weight); fprintf(fi->ofp, "#\n%s %s\n" , MdcConcHdrValueNames[MDC_CONC_HDR_SUBJECT_DOB] , fi->patient_dob); fprintf(fi->ofp, "#\n%s %s\n" , MdcConcHdrValueNames[MDC_CONC_HDR_SUBJECT_SEX] , fi->patient_sex); fprintf(fi->ofp, "#\n%s\n", MdcConcHdrValueNames[MDC_CONC_HDR_END_OF_HEADER]); /* write the data and the headers for the frames */ fprintf(fi->ofp, "#\n#\n#\n#\n"); img = 0; high_file_pointer = 0; low_file_pointer = 0; for (i_bed = 0; i_bed < fi->dim[6]; i_bed++) { if (fi->bednr > 0) bd = &fi->beddata[i_bed]; for (i_gate = 0; i_gate < fi->dim[5]; i_gate++) { for (i_frame= 0; i_frame < fi->dim[4]; i_frame++) { first_plane = &fi->image[img]; fnr = first_plane->frame_number; if ((fi->dynnr > 0) && (fnr > 0)) { fstart = fi->dyndata[fnr-1].time_frame_start/1000.; fduration = fi->dyndata[fnr-1].time_frame_duration/1000.; }else{ fstart = 0.; fduration = 0.; } fprintf(fi->ofp, "#\n%s %d\n" , MdcConcBlockValueNames[MDC_CONC_BLOCK_FRAME], i_frame+i_gate*fi->dim[4]); /* Concorde's ASIPro program requires the event_type entry on gated data for some reason... */ fprintf(fi->ofp, "#\n%s %d\n" , MdcConcBlockValueNames[MDC_CONC_BLOCK_EVENT_TYPE], MDC_CONC_EVENT_UNKNOWN); fprintf(fi->ofp, "#\n%s %d\n" , MdcConcBlockValueNames[MDC_CONC_BLOCK_GATE], i_gate); fprintf(fi->ofp, "#\n%s %d\n" , MdcConcBlockValueNames[MDC_CONC_BLOCK_BED], i_bed); if (bd != NULL) { fprintf(fi->ofp, "#\n%s %g\n" , MdcConcBlockValueNames[MDC_CONC_BLOCK_BED_OFFSET] , bd->hoffset/10.); fprintf(fi->ofp, "#\n%s %g\n" , MdcConcBlockValueNames[MDC_CONC_BLOCK_VERTICAL_BED_OFFSET] , bd->voffset/10.); } fprintf(fi->ofp, "#\n#\tData file offset to start of data," \ " two 32 bit signed ints\n"); fprintf(fi->ofp, "%s %d %d\n" , MdcConcBlockValueNames[MDC_CONC_BLOCK_DATA_FILE_POINTER] , high_file_pointer, low_file_pointer); fprintf(fi->ofp, "#\n%s %g\n" , MdcConcBlockValueNames[MDC_CONC_BLOCK_FRAME_START] , fstart); fprintf(fi->ofp, "#\n%s %g\n" , MdcConcBlockValueNames[MDC_CONC_BLOCK_FRAME_DURATION] , fduration); for (i_plane = 0; i_plane < fi->dim[3]; i_plane++, img++) { write_length = fi->mwidth * fi->mheight*MdcType2Bytes(pixtype); /* update the high and low file pointers */ if ((INT_MAX-write_length) < low_file_pointer) { high_file_pointer += 1; low_file_pointer = write_length - (INT_MAX-low_file_pointer); } else low_file_pointer += write_length; } if (first_plane->rescaled) { fprintf(fi->ofp, "#\n%s %g\n" , MdcConcBlockValueNames[MDC_CONC_BLOCK_SCALE_FACTOR] , first_plane->rescaled_fctr); } else { /* eNlf: must use combined scale factor fprintf(fi->ofp, "#\n%s %g\n" , MdcConcBlockValueNames[MDC_CONC_BLOCK_SCALE_FACTOR] , first_plane->quant_scale); */ fprintf(fi->ofp, "#\n%s %g\n" , MdcConcBlockValueNames[MDC_CONC_BLOCK_SCALE_FACTOR] , first_plane->rescale_slope); } /* Concorde's ASIPro program requires the dead time correction entry on gated data.... */ fprintf(fi->ofp, "#\n# Not 1.0, Unknown\n%s %g\n" , MdcConcBlockValueNames[MDC_CONC_BLOCK_DEADTIME_CORRECTION] , 1.0); /* Concorde's ASIPro program requires the decay correction entry on gated data.... */ { float num_half_lifes = 0.; if (fi->isotope_halflife > 0.) { num_half_lifes = (fstart+fduration/2.0)/fi->isotope_halflife; } fprintf(fi->ofp, "#\n# Check decay_correction_applied to know if already applied\n%s %g\n" , MdcConcBlockValueNames[MDC_CONC_BLOCK_DECAY_CORRECTION] , 1.0/pow(0.5,(double)num_half_lifes)); } fprintf(fi->ofp, "#\n%s\n", MdcConcBlockValueNames[MDC_CONC_BLOCK_END_OF_HEADER]); } } } return NULL; } const char *MdcSaveCONC(FILEINFO *fi) { char raw_filename[MDC_INPUT_STRING_SIZE]; const char * return_string; int img=0; int i_bed, i_gate, i_frame, i_plane; return_string = MdcSaveInitCONC(fi,raw_filename); if (return_string != NULL) return(return_string); for (i_bed = 0; i_bed < fi->dim[6]; i_bed++) { for (i_gate = 0; i_gate < fi->dim[5]; i_gate++) { for (i_frame= 0; i_frame < fi->dim[4]; i_frame++) { for (i_plane = 0; i_plane < fi->dim[3]; i_plane++, img++) { return_string = MdcSavePlaneCONC(fi, img); if (return_string != NULL) return(return_string); } } } } return_string = MdcSaveHeaderCONC(fi,raw_filename); if (return_string != NULL) return(return_string); MdcCheckQuantitation(fi); return(NULL); } int MdcCheckCONC(FILEINFO *fi) { char header_str[17]; int FORMAT=MDC_FRMT_NONE; if (fscanf(fi->ifp, "%16s", header_str)==0) return(MDC_BAD_READ); if (strcmp(header_str, "#") == 0) { if (fscanf(fi->ifp, "%16s", header_str)==0) return(MDC_BAD_READ); if (strcmp(header_str, "#") == 0) { if (fscanf(fi->ifp, "%16s", header_str)==0) return(MDC_BAD_READ); if (strcmp(header_str, "Header") == 0) { if (fscanf(fi->ifp, "%16s", header_str)==0) return(MDC_BAD_READ); if (strcmp(header_str, "file") == 0) return (MDC_FRMT_CONC); } } } return(FORMAT); } const char *MdcReadCONC(FILEINFO *fi) { const char * return_string; int i_bed,i_gate, i_frame, i_plane, img=0; int total_images=0; if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Reading Siemens/Concorde:"); /* read in the header */ return_string = MdcLoadHeaderCONC(fi); if (return_string != NULL) return(return_string); total_images = fi->dim[6]*fi->dim[5]*fi->dim[4]*fi->dim[3]; /* make sure all planes are loaded */ for (i_bed = 0; i_bed < fi->dim[6]; i_bed++) { for (i_gate = 0; i_gate < fi->dim[5]; i_gate++) { for (i_frame = 0; i_frame < fi->dim[4]; i_frame++) { if (MDC_PROGRESS && (total_images > 100)) { MdcProgress(MDC_PROGRESS_INCR,1./(float)(fi->dim[4]*fi->dim[5]*fi->dim[6]),NULL); } /* and read in the data for the first plane, and the rest of the planes */ for (i_plane=0; i_plane < fi->dim[3]; i_plane++, img++) { if (MDC_PROGRESS && (total_images <= 100)) { MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->dim[3],NULL); } return_string = MdcLoadPlaneCONC(fi, img); if (return_string != NULL) return(return_string); } } } } return(NULL); } const char *MdcWriteCONC(FILEINFO *fi) { char raw_filename[MDC_INPUT_STRING_SIZE]; const char * return_string; int img=0; int i_bed, i_gate, i_frame, i_plane; int total_images=0; if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Writing Siemens/Concorde:"); total_images = fi->dim[4]*fi->dim[3]; return_string = MdcSaveInitCONC(fi,raw_filename); if (return_string != NULL) return(return_string); for (i_bed = 0; i_bed < fi->dim[6]; i_bed++) { for (i_gate = 0; i_gate < fi->dim[5]; i_gate++) { for (i_frame= 0; i_frame < fi->dim[4]; i_frame++) { if (MDC_PROGRESS && (total_images > 100)) { MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->dim[4],NULL); } for (i_plane = 0; i_plane < fi->dim[3]; i_plane++, img++) { if (MDC_PROGRESS && (total_images <= 100)) { MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->dim[3],NULL); } return_string = MdcSavePlaneCONC(fi, img); if (return_string != NULL) return(return_string); } } } } return_string = MdcSaveHeaderCONC(fi,raw_filename); if (return_string != NULL) return(return_string); MdcCheckQuantitation(fi); return(NULL); } xmedcon-0.14.1/source/m-gif.c0000644000175000017510000010357712636253502012640 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-gif.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : read and write GIF files * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcCheckGIF() - Check for GIF format * * MdcReadGIF() - Read GIF file * * MdcDoExtension() - Handle extensions * * MdcReadGifHeader() - Read header block * * MdcReadGifImageBlk() - Read image block * * MdcReadGifControlBlk() - Read control block * * MdcReadGifPlainTextBlk() - Read plain text block * * MdcReadGifApplicationBlk() - Read application block * * MdcUnpackImage() - Unpack LZW compressed image * * MdcPutGifLine() - Copy line to memory buffer * * MdcWriteGIF() - Write GIF file * * MdcGetGifOpt() - Get specific GIF options * * MdcWriteGifHeader() - Write gif header * * MdcWriteControlBlock() - Write control block * * MdcWriteImageBlock() - Write image block * * MdcWriteImage() - Write LZW compressed image * * MdcWriteCommentBlock() - Write comment block * * MdcWriteLoopBlock() - Write loop block * * MdcWriteApplicationBlock() - Write application block * * MdcInitTable() - Initialize compression table* * MdcFlush() - Flush code the code buffer * * MdcWriteCode() - Write code to code buffer * * * * Notes : Code fragments addapted from Alchemy Mindworks, Inc. * * Original code GIF reader/writer copyright (c) 1991 * * * * "Supercharged bitmapped graphics" * * written by Steve Rimmer * * published by Windcrest(r)/McGraw-Hill * * ISBN: 0-8306-3788-5 * * * * We only write GIF89a animated gifs * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-gif.c,v 1.46 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "medcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ #define largest_code 4095 /* largest possible code */ #define table_size 5003 /* table dimensions */ static Uint8 code_buffer[259]; /* where the codes go */ static Int16 oldcode[table_size]; /* the table */ static Int16 currentcode[table_size]; static Uint8 newcode[table_size]; static Int16 code_size; static Int16 clear_code; static Int16 eof_code; static Int16 bit_offset; static Int16 byte_offset; static Int16 bits_left; static Int16 max_code; static Int16 free_code; /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcCheckGIF(FILEINFO *fi) { MDC_GIFHEADER gh; memset(&gh,0,MDC_GIF_GH_SIZE); if ( fread((char *)&gh,1,MDC_GIF_GH_SIZE,fi->ifp) != MDC_GIF_GH_SIZE ) return(MDC_BAD_READ); if ( memcmp(gh.sig,MDC_GIF_SIG,3) ) return(MDC_FRMT_NONE); return(MDC_FRMT_GIF); } /* unpack a GIF file */ char *MdcReadGIF(FILEINFO *fi) { FILE *fp=fi->ifp; MDC_GIFHEADER gh; MDC_GIFIMAGEBLOCK iblk; Uint32 b, c, img=0, number=0; char *err=NULL; Uint32 bytes; if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Reading GIF:"); if (MDC_VERBOSE) MdcPrntMesg("GIF Reading <%s> ...",fi->ifname); if (MDC_ECHO_ALIAS == MDC_YES) { MdcEchoAliasName(fi); return(NULL); /* a little pointless for GIF */ } /* initialize structures */ memset(&gh,0,MDC_GIF_GH_SIZE); memset(&iblk,0,MDC_GIF_IBLK_SIZE); /* put some defaults we use */ fi->endian=MDC_FILE_ENDIAN=MDC_LITTLE_ENDIAN; /* always for a GIF */ fi->dim[0] = 4; fi->dim[4]=1; /* make sure it's a GIF file */ if ( MdcReadGifHeader(fp,&gh) != MDC_YES ) return("GIF Bad read gifheader"); if ( memcmp(gh.sig, MDC_GIF_SIG, 3) ) return("No GIF file"); if (MDC_INFO) { MdcPrntScrn("GIFHEADER (%d bytes)\n",MDC_GIF_GH_SIZE); MdcPrintLine('-',MDC_HALF_LENGTH); } fi->bits=8; /* (gh.flags & 0x0007) + 1; */ if (MDC_INFO) { MdcPrntScrn("signature: %.6s\n",gh.sig); MdcPrntScrn("screen width: %d\nscreen height: %d\n", gh.screenwidth,gh.screenheight); MdcPrntScrn("global palette: "); } /* get colour map if there is one */ if (gh.flags & 0x80) { if (fi->map < 2) fi->map=MDC_MAP_PRESENT; c = 3 * (1 << ((gh.flags & 0x0007) + 1)); if (fread(fi->palette,1,c,fp) != c) return("GIF Bad read global palette"); if (MDC_INFO) { MdcPrntScrn("Yes\n"); MdcPrntScrn("bits: %hd\n",(gh.flags & 7)+1 ); MdcPrntScrn("colors: %hd\n",(1 << ((gh.flags & 0x0007)+1))); MdcPrntScrn("sorted: "); if (gh.flags > 0x0008 ) MdcPrntScrn("Yes\n"); else MdcPrntScrn("No\n"); MdcPrntScrn("background: %hd\n", (int)gh.background); MdcPrntScrn("aspect: %hd\n\n",(int)gh.aspect); } } else if (MDC_INFO) MdcPrntScrn("No\n"); /* step through the blocks */ while((c=(Int16)fgetc(fp))==',' || c=='!' || c==0) { /* if it's an image block... */ if (c == ',') { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_SET,0.0,NULL); if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('=',MDC_HALF_LENGTH); MdcPrntScrn("\nIMAGEBLOCK %03d (%d bytes)\n",number+1 ,MDC_GIF_IBLK_SIZE); MdcPrintLine('-',MDC_HALF_LENGTH); } /* get the start of the image block */ if (MdcReadGifImageBlk(fp,&iblk) != MDC_YES) return("GIF Bad read imageblock"); number+=1; if (!MdcGetStructID(fi,number)) return("GIF Bad malloc IMG_DATA struct"); /* fill in the IMG_DATA struct */ fi->image[img].width=(Uint32) iblk.width; fi->image[img].height=(Uint32) iblk.height; if (MDC_INFO) { MdcPrntScrn("image left: %hu\n",iblk.left); MdcPrntScrn("image top: %hu\n",iblk.top); MdcPrntScrn("image width: %hu\n",iblk.width); MdcPrntScrn("image height: %hu\n",iblk.height); MdcPrntScrn("interlaced: "); if ( iblk.flags & 0x0040 ) MdcPrntScrn("Yes\n"); else MdcPrntScrn("No\n"); MdcPrntScrn("local palette: "); } /* get the local colour map if there is one */ if (iblk.flags & 0x80) { if (fi->map < 2) fi->map=MDC_MAP_PRESENT; if (MDC_INFO) { MdcPrntScrn("Yes\n"); MdcPrntScrn("sorted: "); if ( iblk.flags & 0x0020 ) MdcPrntScrn("Yes\n"); else MdcPrntScrn("No\n"); } b = 3*(1<<((iblk.flags & 0x0007) + 1)); if (fread(fi->palette,1,b,fp) != b) return("GIF Bad read local palette"); } else if (MDC_INFO) MdcPrntScrn("No\n"); /* get the initial code size */ if ((c=(Int16)fgetc(fp))==EOF) return("GIF Bad read initial code"); fi->image[img].bits = c; fi->image[img].flags = iblk.flags; /* get an image buffer */ bytes=MdcPixels2Bytes(fi->image[img].width*fi->image[img].height*8); if ( (fi->image[img].buf=MdcGetImgBuffer(bytes)) == NULL ) return("GIF Bad malloc image buffer"); if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_SET,0.5,NULL); /* unpack the image */ err = MdcUnpackImage(fi,img); if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_SET,1.0,NULL); /* fill in the FILEINFO struct */ fi->bits=fi->image[img].bits=8; fi->image[img].type=BIT8_U; fi->dim[3] = number; img = number; /* warning if there was an error */ if (err != NULL) { MdcPrntWarn(err); err = MdcHandleTruncated(fi,fi->number,MDC_NO); if (err != NULL) return(err); break; } }else if (c == '!') MdcDoExtension(fi); } if (fi->number == 0) return("GIF No valid images found"); MdcCloseFile(fi->ifp); if (fi->truncated) return("GIF Truncated image file"); return NULL; } /* this function is called when the GIF decoder encounters an extension */ void MdcDoExtension(FILEINFO *fi) { FILE *fp=fi->ifp; MDC_GIFPLAINTEXT pt; MDC_GIFCONTROLBLOCK cb; MDC_GIFAPPLICATION ap; Int16 c,n,i; memset(&pt,0,MDC_GIF_TBLK_SIZE); memset(&cb,0,MDC_GIF_CBLK_SIZE); memset(&ap,0,MDC_GIF_ABLK_SIZE); if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('=',MDC_HALF_LENGTH); } switch (c=(Int16)fgetc(fp)) { case 0x0001: /* plain text descriptor */ if (MdcReadGifPlainTextBlk(fp,&pt) == MDC_YES) { if (MDC_INFO) { MdcPrntScrn("\nPLAIN TEXT BLOCK\n"); MdcPrintLine('-', MDC_HALF_LENGTH); MdcPrntScrn("This block requires %u bytes\n",pt.blocksize); MdcPrntScrn("Text location at (%u,%u)\n",pt.left,pt.top); MdcPrntScrn("Grid dimensions are %u by %u\n",pt.gridwidth ,pt.gridheight); MdcPrntScrn("Cell dimensions are %u by %u\n",pt.cellwidth ,pt.cellheight); MdcPrntScrn("Foregound colour is %u\n",pt.forecolour); MdcPrntScrn("Background colour is %u\n",pt.backcolour); } do { if ((n=(Int16)fgetc(fp)) != EOF) { for (i=0;i 0 && n != EOF); }else{ MdcPrntWarn("GIF Bad read plain text block"); } break; case 0x00f9: /* graphic control block */ if (MdcReadGifControlBlk(fp,&cb) == MDC_YES) { if (MDC_INFO) { MdcPrntScrn("\nCONTROL BLOCK\n"); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("This block requires %u bytes\n",cb.blocksize); switch((cb.flags >> 2) & 0x0007) { case 0: MdcPrntScrn("No disposal specified\n"); break; case 1: MdcPrntScrn("Do not dispose\n"); break; case 2: MdcPrntScrn("Dispose to background colour\n"); break; case 3: MdcPrntScrn("Dispose to previous graphic\n"); break; default: MdcPrntScrn("Unknown disposal procedure\n"); break; } if (cb.flags & 0x0002) MdcPrntScrn("User input required - delay for %g seconds\n" ,(float)cb.delay/100.); else MdcPrntScrn("No user input required\n"); if (cb.flags & 0x0001) MdcPrntScrn("Transparent colour: %u\n",cb.transparent_colour); else MdcPrntScrn("No transparent_colour\n"); } }else{ MdcPrntWarn("GIF Bad read control block"); } break; case 0x00fe: /* comment extension */ if (MDC_INFO) { MdcPrntScrn("\nCOMMENT BLOCK\n"); MdcPrintLine('-',MDC_HALF_LENGTH); } do { if ((n=(Int16)fgetc(fp)) != EOF) { if (n > 0) { fi->comment = (char *)MdcRealloc(fi->comment,fi->comm_length+n+2); if (fi->comment == NULL) { MdcPrntWarn("Couldn't allocate comment buffer"); }else if (fi->comm_length==0) fi->comment[fi->comm_length] = '\0'; } for (i=0;icomment != NULL) { fi->comment[fi->comm_length++] = c; } } if ((n <= 0) && (fi->comment != NULL)) { fi->comment[fi->comm_length++] = '\n'; fi->comment[fi->comm_length] = '\0'; } } }while (n > 0 && n != EOF); break; case 0x00ff: /* application extension */ if (MdcReadGifApplicationBlk(fp,&ap) == MDC_YES) { if (MDC_INFO) { MdcPrntScrn("\nAPPLICATION BLOCK\n"); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("This block requires %d bytes\n",ap.blocksize); MdcPrntScrn("Identification string: %.8s\n",ap.applstring); MdcPrntScrn("Authentication string: %.3s\n",ap.authentication); } do { if ((n=(Int16)fgetc(fp)) != EOF) { if (MDC_INFO) MdcPrntScrn("\nSub-block requires %d bytes:\n",n); for (i=0;i 0 && n != EOF); }else{ MdcPrntWarn("GIF Bad read application block"); } break; default: /* something else */ MdcPrntWarn("GIF Unknown extension 0x%02.2x\n",c & 0x00ff); n=(Int16)fgetc(fp); for (i=0;isig ,bb ,6); memcpy(&gh->screenwidth ,bb+6,2); MdcSWAP(gh->screenwidth); memcpy(&gh->screenheight,bb+8,2); MdcSWAP(gh->screenheight); gh->flags = (Uint8) bb[10]; gh->background = (Uint8) bb[11]; gh->aspect = (Uint8) bb[12]; return(MDC_YES); } int MdcReadGifImageBlk(FILE *fp, MDC_GIFIMAGEBLOCK *ib) { char bb[MDC_GIF_IBLK_SIZE]; if (fread(bb,1,MDC_GIF_IBLK_SIZE,fp) != MDC_GIF_IBLK_SIZE) return(MDC_NO); memcpy(&ib->left ,bb ,2); MdcSWAP(ib->left); memcpy(&ib->top ,bb+2,2); MdcSWAP(ib->top); memcpy(&ib->width ,bb+4,2); MdcSWAP(ib->width); memcpy(&ib->height,bb+6,2); MdcSWAP(ib->height); ib->flags = (Uint8) bb[8]; return(MDC_YES); } int MdcReadGifControlBlk(FILE *fp, MDC_GIFCONTROLBLOCK *cb) { char bb[MDC_GIF_CBLK_SIZE]; if (fread(bb,1,MDC_GIF_CBLK_SIZE,fp) != MDC_GIF_CBLK_SIZE) return(MDC_NO); cb->blocksize = (Uint8) bb[0]; cb->flags = (Uint8) bb[1]; memcpy(&cb->delay,bb+2,2); MdcSWAP(cb->delay); cb->transparent_colour = (Uint8) bb[4]; cb->terminator = (Uint8) bb[5]; return(MDC_YES); } int MdcReadGifPlainTextBlk(FILE *fp, MDC_GIFPLAINTEXT *pt) { char bb[MDC_GIF_TBLK_SIZE]; if (fread(bb,1,MDC_GIF_TBLK_SIZE,fp) != MDC_GIF_TBLK_SIZE) return(MDC_NO); pt->blocksize = (Uint8) bb[0]; memcpy(&pt->left ,bb+1,2); MdcSWAP(pt->left); memcpy(&pt->top ,bb+3,2); MdcSWAP(pt->top); memcpy(&pt->gridwidth ,bb+5,2); MdcSWAP(pt->gridwidth); memcpy(&pt->gridheight,bb+7,2); MdcSWAP(pt->gridheight); pt->cellwidth = (Uint8) bb[9]; pt->cellheight = (Uint8) bb[10]; pt->forecolour = (Uint8) bb[11]; pt->backcolour = (Uint8) bb[12]; return(MDC_YES); } int MdcReadGifApplicationBlk(FILE *fp, MDC_GIFAPPLICATION *ap) { char bb[MDC_GIF_ABLK_SIZE]; if (fread(bb,1,MDC_GIF_ABLK_SIZE,fp) != MDC_GIF_ABLK_SIZE) return(MDC_NO); ap->blocksize = (Uint8) bb[0]; memcpy(ap->applstring ,bb+1,8); memcpy(ap->authentication,bb+9,3); return(MDC_YES); } /* unpack an LZW compressed image */ char *MdcUnpackImage(FILEINFO *fi, Uint32 nr ) { FILE *fp=fi->ifp; Int16 bits=fi->image[nr].bits; IMG_DATA *id=&fi->image[nr]; Uint8 pix; Int16 bits2; /* Bits plus 1 */ Int16 codesize; /* Current code size in bits */ Int16 codesize2; /* Next codesize */ Int16 nextcode; /* Next available table entry */ Int16 thiscode; /* Code being expanded */ Int16 oldtoken; /* Last symbol decoded */ Int16 currentcode; /* Code just read */ Int16 oldcode; /* Code read before this one */ Int16 bitsleft; /* Number of bits left in *p */ Int16 blocksize; /* Bytes in next block */ Int16 line=0; /* next line to write */ Int16 nxtbyte=0; /* next byte to write */ Int16 pass=0; /* pass number for interlaced pictures */ Uint8 *p; /* Pointer to current byte in read buffer */ Uint8 *q; /* Pointer past last byte in read buffer */ Uint8 b[255]; /* Read buffer */ Uint8 *u; /* Stack pointer into firstcodestack */ Uint8 *linebuffer; /* place to store the current line */ static Uint8 firstcodestack[4096]; /* Stack for first codes */ static Uint8 lastcodestack[4096]; /* Statck for previous code */ static Int16 codestack[4096]; /* Stack for links */ static Int16 wordmasktable[] = { 0x0000,0x0001,0x0003,0x0007, 0x000f,0x001f,0x003f,0x007f, 0x00ff,0x01ff,0x03ff,0x07ff, 0x0fff,0x1fff,0x3fff,0x7fff }; static Int16 inctable[] = { 8,8,4,2,0 }; /* interlace increments */ static Int16 startable[] = { 0,4,2,1,0 }; /* interlace starts */ p=q=b; bitsleft = 8; if (bits < 2 || bits > 8) return("GIF Bad symbolsize"); bits2 = 1 << bits; nextcode = bits2 + 2; codesize2 = 1 << (codesize = bits + 1); oldcode=oldtoken=MDC_NO_CODE; if ((linebuffer=(Uint8 *)malloc(id->width)) == NULL) return("GIF Bad malloc linebuffer"); /* loop until something breaks */ for (;;) { if (bitsleft==8) { if (++p >= q && (((blocksize = (Int16)fgetc(fp)) < 1) || (q=(p=b)+fread(b,1,(unsigned)blocksize,fp))< (b+blocksize))) { MdcFree(linebuffer); return("GIF Unexpected EOF (1)"); } bitsleft = 0; } thiscode = *p; if ((currentcode=(codesize+bitsleft)) <= 8) { *p >>= codesize; bitsleft = currentcode; }else { if (++p >= q && (((blocksize = (Int16)fgetc(fp)) < 1) || (q=(p=b)+fread(b,1,(unsigned)blocksize,fp)) < (b+blocksize))) { MdcFree(linebuffer); return("GIF Unexpected EOF (2)"); } thiscode |= *p << (8 - bitsleft); if (currentcode <= 16) *p >>= (bitsleft=currentcode-8); else { if (++p >= q && (((blocksize = (Int16)fgetc(fp)) < 1) || (q=(p=b) + fread(b,1,(unsigned)blocksize,fp)) < (b+blocksize))) { MdcFree(linebuffer); return("GIF Unexpected EOF (3)"); } thiscode |= *p << (16 - bitsleft); *p >>= (bitsleft = currentcode - 16); } } thiscode &= wordmasktable[codesize]; currentcode = thiscode; if (thiscode == (bits2+1)) break; /* found EOI */ if (thiscode > nextcode) { MdcFree(linebuffer); return("GIF Bad compression code"); } if (thiscode == bits2) { nextcode = bits2 + 2; codesize2 = 1 << (codesize = (bits + 1)); oldtoken = oldcode = MDC_NO_CODE; continue; } u = firstcodestack; if (thiscode==nextcode) { if (oldcode==MDC_NO_CODE) { MdcFree(linebuffer); return("GIF Bad first code"); } *u++ = oldtoken; thiscode = oldcode; } while (thiscode >= bits2) { *u++ = lastcodestack[thiscode]; thiscode = codestack[thiscode]; } oldtoken = thiscode; do { pix = (Uint8)thiscode; linebuffer[nxtbyte++]=pix; if (nxtbyte >= id->width) { MdcPutGifLine(id,linebuffer,line); nxtbyte=0; /* check for interlaced image */ if (id->flags & 0x40) { line+=inctable[pass]; if (line >= id->height) line=startable[++pass]; }else ++line; } if (u <= firstcodestack) break; thiscode = *--u; }while(1); if (nextcode < 4096 && oldcode != MDC_NO_CODE) { codestack[nextcode] = oldcode; lastcodestack[nextcode] = oldtoken; if (++nextcode >= codesize2 && codesize < 12) codesize2 = 1 << ++codesize; } oldcode = currentcode; } MdcFree(linebuffer); return(NULL); } /* save one line to memory */ void MdcPutGifLine(IMG_DATA *id, Uint8 *p, Int16 n) { if ( n >= 0 && n < id->height ) memcpy(id->buf+((Uint32)n*id->width),p,id->width); } char *MdcWriteGIF(FILEINFO *fi) { Uint32 nr; Uint8 *buf8; MDC_GIFOPT opt; MDC_FILE_ENDIAN = MDC_LITTLE_ENDIAN; /* always for a gif */ /* check supported */ if (fi->type == COLRGB) return("GIF True color files unsupported"); memset(&opt,0,sizeof(MDC_GIFOPT)); if ((MDC_GIF_OPTIONS == MDC_YES) && (XMDC_GUI == MDC_NO)) { MdcGetGifOpt(fi,&opt); }else { opt.transp = MDC_NO; opt.loop = MDC_YES; opt.delay = GIF_DELAY; } if (XMDC_GUI == MDC_NO) { MdcDefaultName(fi,MDC_FRMT_GIF,fi->ofname,fi->ifname); } if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Writing GIF:"); if (MDC_VERBOSE) MdcPrntMesg("GIF Writing <%s> ...",fi->ofname); if (MDC_FILE_STDOUT == MDC_YES) { fi->ofp = stdout; }else{ if (MdcKeepFile(fi->ofname)) return("GIF File exists!!"); if ( (fi->ofp=fopen(fi->ofname,"wb")) == NULL ) return ("GIF Couldn't open file"); } if (MDC_FORCE_INT != MDC_NO) { if (MDC_FORCE_INT != BIT8_U) { MdcPrntWarn("GIF Only Uint8 pixels supported"); } } /* check supported things */ if (MDC_QUANTIFY || MDC_CALIBRATE) { MdcPrntWarn("GIF Normalization loses quantified values!"); } if ( MdcWriteGifHeader(fi,&opt) ) return("GIF Bad write screen description"); if ( MdcWriteCommentBlock(fi,MDC_LIBVERS) ) return("GIF Bad write comment block"); if ( fi->acquisition_type != MDC_ACQUISITION_UNKNOWN ) if ( MdcMakeScanInfoStr(fi) ) { if ( MdcWriteCommentBlock(fi,mdcbufr) ) { return("GIF Bad write scan info comment block"); } } if ( (fi->number > 1) && (opt.loop == MDC_YES) ) { if ( MdcWriteLoopBlock(fi,"NETSCAPE","2.0") ) return ("GIF Bad write loop block"); } for ( nr=0; nrnumber; nr++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); if ( (fi->number > 1) || (opt.transp == MDC_YES)) if ( MdcWriteControlBlock(fi,&opt,nr) ) return("GIF Bad write control block"); if ( MdcWriteImageBlock(fi,nr) ) return("GIF Bad write image block"); if (fi->image[nr].type != BIT8_U) { if ( (buf8=MdcGetImgBIT8_U(fi, nr)) == NULL) return("GIF Bad malloc new image buffer"); if ( MdcWriteImage(buf8,fi,nr) ) { MdcFree(buf8); return("GIF Bad compression (1)"); }else{ MdcFree(buf8); } }else{ if ( MdcWriteImage(fi->image[nr].buf,fi,nr) ) return("GIF Bad compression (2)"); } } if ( MdcWriteApplicationBlock(fi,MDC_PRGR,"NLF")) return("GIF Bad write application block"); if ( fputc(';',fi->ofp) == EOF ) return("GIF Bad write terminator code"); MdcCloseFile(fi->ofp); return NULL; } void MdcGetGifOpt(FILEINFO *fi, MDC_GIFOPT *opt) { opt->loop = MDC_YES; opt->transp = MDC_YES; if (MDC_FILE_STDIN == MDC_YES) return; /* stdin already in use */ MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("\tGIF OPTIONS\t\tORIG FILE: %s\n",fi->ifname); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("\n\tSelect color map:\n\n"); MdcPrntScrn("\t\t%d -> present\n",MDC_MAP_PRESENT); MdcPrntScrn("\t\t%d -> gray\n",MDC_MAP_GRAY); MdcPrntScrn("\t\t%d -> rainbow\n",MDC_MAP_RAINBOW); MdcPrntScrn("\t\t%d -> combined\n",MDC_MAP_COMBINED); MdcPrntScrn("\t\t%d -> hotmetal\n",MDC_MAP_HOTMETAL); MdcPrntScrn("\t\t%d -> loaded LUT\n",MDC_MAP_LOADED); MdcPrntScrn("\n\tYour choice [%d]? ",(int)fi->map); if (!MdcPutDefault(mdcbufr)) { fi->map = (Uint8)atoi(mdcbufr); MdcGetColorMap((int)fi->map,fi->palette); } if (fi->number > 1) { MdcPrntScrn("\n\tInsert a display loop [yes]? "); mdcbufr[0]='y'; if (!MdcPutDefault(mdcbufr)) if (mdcbufr[0]=='n' || mdcbufr[0]=='N') opt->loop = MDC_NO; MdcPrntScrn("\n\tDelay 1/100ths of a second [%3d]? ", GIF_DELAY); if (!MdcPutDefault(mdcbufr)) { opt->delay = (Uint16)atoi(mdcbufr); }else{ opt->delay = GIF_DELAY; } } MdcPrntScrn("\n\tInsert transparent color [yes]? "); mdcbufr[0]='y'; if (!MdcPutDefault(mdcbufr)) if (mdcbufr[0]=='n' || mdcbufr[0]=='N') opt->transp = MDC_NO; if (opt->transp == MDC_YES) { MdcPrntScrn("\n\tTransparent color [%u]? ",opt->transp_color); if (!MdcPutDefault(mdcbufr)) opt->transp_color = (Uint8)atoi(mdcbufr); } MdcPrntScrn("\n\tBackground color [%u]? ",opt->bground_color); if (!MdcPutDefault(mdcbufr)) opt->bground_color= (Uint8)atoi(mdcbufr); MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } /* write the header */ int MdcWriteGifHeader(FILEINFO *fi, MDC_GIFOPT *opt) { MDC_GIFHEADER gh; unsigned int bits = 8; /* we only write 8-bit gifs */ /* fill the header struct */ memset(&gh,0,MDC_GIF_GH_SIZE); memcpy(gh.sig,MDC_GIF89_SIG,6); gh.screenwidth=(Int16)fi->mwidth; gh.screenheight=(Int16)fi->mheight; gh.background=opt->bground_color; gh.aspect=0; gh.flags=0; /* set up the global flags */ if (fi->map < MDC_MAP_PRESENT) { gh.flags=(((bits-1) & 0x07)<<4); }else{ gh.flags = (0x80 | ((bits-1)<<4) | ((bits-1) & 0x07)); } MdcSWAP(gh.screenwidth); MdcSWAP(gh.screenheight); /* write the header */ fwrite((char *)&gh,1,MDC_GIF_GH_SIZE,fi->ofp); /* write the colour map */ fwrite(fi->palette,1U,3U*(1U<ofp); return(ferror(fi->ofp)); } int MdcWriteControlBlock(FILEINFO *fi, MDC_GIFOPT *opt, Uint32 n) { MDC_GIFCONTROLBLOCK cb; memset(&cb,0,MDC_GIF_CBLK_SIZE); fputc('!',fi->ofp); /* say it's an extension block */ fputc(0xf9,fi->ofp); /* say it's a control block */ cb.blocksize=0x04; cb.flags=0x00; if (fi->number > 1 ) { cb.flags^=0x02; cb.flags<<=2; /* dispose to background */ cb.flags^=0x02; /* wait for user input */ cb.delay = opt->delay; /* delay to dispose 1/100 sec */ } if (opt->transp == MDC_YES) { /* transparent color */ cb.flags^=0x01; cb.transparent_colour = opt->transp_color; } MdcSWAP(cb.delay); fwrite((char *)&cb,1,MDC_GIF_CBLK_SIZE,fi->ofp); return(ferror(fi->ofp)); } /* write an image descriptor block */ int MdcWriteImageBlock(FILEINFO *fi, Uint32 n) { MDC_GIFIMAGEBLOCK ib; Uint8 *palette=NULL; int bits = 8; /* we only write 8-bit gifs */ memset(&ib,0,MDC_GIF_IBLK_SIZE); /* fill the image block struct */ fputc(',',fi->ofp); ib.left=0; ib.top=0; ib.width=fi->image[n].width; ib.height=fi->image[n].height; /* set the local flags */ if(palette==NULL) ib.flags=bits-1; else ib.flags=((bits-1) & 0x07) | 0x80; MdcSWAP(ib.left); MdcSWAP(ib.top); MdcSWAP(ib.width); MdcSWAP(ib.height); /* write the block */ fwrite((char *)&ib,1,MDC_GIF_IBLK_SIZE,fi->ofp); return(ferror(fi->ofp)); } /* compress an image */ int MdcWriteImage(Uint8 * buffer, FILEINFO *fi, Uint32 n) { FILE *fp=fi->ofp; Uint8 *pix=buffer; Int16 prefix_code; Int16 suffix_char; Int16 hx,d; Uint16 min_code_size=8; Uint32 i, width=fi->image[n].width, height=fi->image[n].height; /* make sure the initial code size is legal */ if (min_code_size < 2 || min_code_size > 9) { /* monochrome images have two bits in LZW compression */ if (min_code_size == 1) min_code_size = 2; else return(EOF); } /* write initial code size */ fputc(min_code_size,fp); /* initialize the encoder */ bit_offset=0; MdcInitTable(min_code_size); MdcWriteCode(fp,clear_code); if (pix == NULL) return(EOF); suffix_char=(Int16)pix[0]; /* initialize the prefix */ prefix_code = suffix_char; /* get a character to compress */ for ( i=1; i<(width*height); i++) { if ( i == (width*height) ) break; suffix_char = (Int16)pix[i]; /* derive an index into the code table */ hx=(prefix_code ^ (suffix_char << 5)) % table_size; d=1; for (;;) { /* see if the code is in the table */ if (currentcode[hx] == 0) { /* if not, put it there */ MdcWriteCode(fp,prefix_code); d = free_code; /* find the next free code */ if (free_code <= largest_code) { oldcode[hx] = prefix_code; newcode[hx] = suffix_char; currentcode[hx] = free_code; free_code++; } /* expand the code size or scrap the table */ if (d == max_code) { if (code_size < 12) { code_size++; max_code <<= 1; }else{ MdcWriteCode(fp,clear_code); MdcInitTable(min_code_size); } } prefix_code = suffix_char; break; } if (oldcode[hx] == prefix_code && newcode[hx] == suffix_char) { prefix_code = currentcode[hx]; break; } hx += d; d += 2; if(hx >= table_size) hx -= table_size; } } /* write the prefix code */ MdcWriteCode(fp,prefix_code); /* and the end of file code */ MdcWriteCode(fp,eof_code); /* MdcFlush the buffer */ if(bit_offset > 0) MdcFlush(fp,(bit_offset+7)/8); /* write a zero length block */ MdcFlush(fp,0); return(ferror(fp)); } int MdcWriteCommentBlock(FILEINFO *fi, const char *comment) { int n; n=strlen(comment); fputc('!',fi->ofp); /* say it's an extension block */ fputc(0xfe,fi->ofp); /* say it's a comment */ do { if(n > 255) { fputc(255,fi->ofp); fwrite(comment,1,255,fi->ofp); comment +=255; n-=255; } else { fputc(n,fi->ofp); fwrite(comment,1,(unsigned)n,fi->ofp); fputc(0,fi->ofp); n=0; } } while(n); return(ferror(fi->ofp)); } int MdcWriteLoopBlock(FILEINFO *fi, const char *applstr, const char *auth) { MDC_GIFAPPLICATION ap; memset(&ap,0,MDC_GIF_ABLK_SIZE); fputc('!',fi->ofp); fputc(0xff,fi->ofp); ap.blocksize=0x0b; memcpy(ap.applstring,applstr,8); memcpy(ap.authentication,auth,3); fwrite((char *)&ap,1,MDC_GIF_ABLK_SIZE,fi->ofp); fputc(0x03,fi->ofp); fputc(0x01,fi->ofp); fputc(0xe8,fi->ofp); fputc(0x03,fi->ofp); fputc(0,fi->ofp); return(ferror(fi->ofp)); } int MdcWriteApplicationBlock(FILEINFO *fi, const char *applstr, const char *auth) { MDC_GIFAPPLICATION ap; memset(&ap,0,MDC_GIF_ABLK_SIZE); fputc('!',fi->ofp); fputc(0xff,fi->ofp); ap.blocksize=0x0b; memcpy(ap.applstring,applstr,7); memcpy(ap.authentication,auth,3); fwrite((char *)&ap,1,MDC_GIF_ABLK_SIZE,fi->ofp); fputc(0,fi->ofp); return(ferror(fi->ofp)); } /* initialize the code table */ void MdcInitTable(Int16 min_code_size) { Int16 i; code_size=min_code_size+1; clear_code=(1<> 3; bits_left = bit_offset & 7; /* eNlf: BUG?? Problem: */ /* eNlf: BUG?? We found one image that didn't compress well */ /* eNlf: BUG?? with the original code of (byte_offset>=254) */ /* eNlf: BUG?? Decoding gave error "GIF Unexpected EOF (2)" */ /* eNlf: BUG?? Solution: */ /* eNlf: BUG?? We changed de code into (byte_offset>=253) */ /* eNlf: BUG?? and that image got compressed (others too) */ /* eNlf: BUG?? Perhaps our solution implicates a new BUG?? */ /* eNlf: BUG?? for other images! Let's hope it doesn't ... */ /* eNlf:if(byte_offset >= 254) { original code fragment */ if(byte_offset >= 253) { /* new code fragment */ MdcFlush(fp,byte_offset); code_buffer[0] = code_buffer[byte_offset]; bit_offset = bits_left; byte_offset = 0; } if(bits_left > 0) { temp = ((Int32)code << bits_left) | code_buffer[byte_offset]; code_buffer[byte_offset]=temp; code_buffer[byte_offset+1]=(temp >> 8); code_buffer[byte_offset+2]=(temp >> 16); } else { code_buffer[byte_offset] = code; code_buffer[byte_offset+1]=(code >> 8); } bit_offset += code_size; } xmedcon-0.14.1/source/xmnuftry.c0000644000175000017510000002140012636253502013515 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xmnuftry.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : menu creation factory * * * * project : (X)MedCon by Erik Nolf * * * * Note : basic code extracted from Gtk+ tutorial * * * * Functions : XMdcMenusGetMain() - Get main menu * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xmnuftry.c,v 1.44 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include #include "xmedcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ static GtkItemFactoryEntry menu_items[] = { {(char *)"/_File", NULL, (void(*)())NULL, 0, (char *)""}, {(char *)"/File/Open", (char *)"O", XMdcFileSelOpen, 0, NULL}, {(char *)"/File/Open Raw", NULL, (void(*)())NULL, 0, (char *)"" }, {(char *)"/File/Open Raw/Interactive", NULL, XMdcFileSelOpen, XMDC_RAW, NULL}, {(char *)"/File/Open Raw/Predefined", NULL, XMdcFileSelOpen,XMDC_PREDEF,NULL}, {(char *)"/File/SepA", NULL, (void(*)())NULL, 0, (char *)"" }, {(char *)"/File/Raw Predef Load", NULL, XMdcRawPredefSelOpen, 0, NULL }, {(char *)"/File/Raw Predef Save", (char *)"I" , XMdcRawPredefSelSave, 0, NULL }, {(char *)"/File/SepB", NULL, (void(*)())NULL, 0, (char *)"" }, {(char *)"/File/Info Show", (char *)"G", XMdcShowFileInfo, 0, NULL}, {(char *)"/File/Info Edit", (char *)"F", XMdcEditFileInfo, 0, NULL}, {(char *)"/File/SepC", NULL, (void(*)())NULL, 0, (char *)"" }, {(char *)"/File/Save", (char *)"S", XMdcFileSelSave ,MDC_MAX_FRMTS,NULL}, {(char *)"/File/Save _As", NULL, (void(*)())NULL, 0, (char *)"" }, {(char *)"/File/Save As/Raw Binary", NULL,XMdcFileSelSave,MDC_FRMT_RAW,NULL}, {(char *)"/File/Save As/Raw Ascii", NULL,XMdcFileSelSave,MDC_FRMT_ASCII,NULL}, #if MDC_INCLUDE_ACR {(char *)"/File/Save As/AcrNema", NULL,XMdcFileSelSave,MDC_FRMT_ACR,NULL}, #endif #if MDC_INCLUDE_ANLZ {(char *)"/File/Save As/Analyze", NULL,XMdcFileSelSave,MDC_FRMT_ANLZ,NULL}, #endif #if MDC_INCLUDE_CONC {(char *)"/File/Save As/Concorde", NULL,XMdcFileSelSave,MDC_FRMT_CONC,NULL}, #endif #if MDC_INCLUDE_DICM {(char *)"/File/Save As/DICOM", NULL,XMdcFileSelSave,MDC_FRMT_DICM,NULL}, #endif #if MDC_INCLUDE_ECAT {(char *)"/File/Save As/Ecat6", NULL,XMdcFileSelSave,MDC_FRMT_ECAT6,NULL}, #if MDC_INCLUDE_TPC {(char *)"/File/Save As/Ecat7", NULL,XMdcFileSelSave,MDC_FRMT_ECAT7,NULL}, #endif #endif #if MDC_INCLUDE_GIF {(char *)"/File/Save As/Gif89a", NULL,XMdcFileSelSave,MDC_FRMT_GIF,NULL}, #endif #if MDC_INCLUDE_INTF {(char *)"/File/Save As/InterFile", NULL,XMdcFileSelSave,MDC_FRMT_INTF,NULL}, #endif #if MDC_INCLUDE_INW {(char *)"/File/Save As/INW (RUG)", NULL,XMdcFileSelSave,MDC_FRMT_INW,NULL}, #endif #if MDC_INCLUDE_NIFTI {(char *)"/File/Save As/NIFTI", NULL,XMdcFileSelSave,MDC_FRMT_NIFTI,NULL}, #endif #if MDC_INCLUDE_PNG {(char *)"/File/Save As/PNG", NULL,XMdcFileSelSave,MDC_FRMT_PNG,NULL}, #endif {(char *)"/File/SepD", NULL, (void(*)())NULL, 0, (char *)"" }, {(char *)"/File/Close", NULL, XMdcCloseFile, 0, NULL}, {(char *)"/File/Quit", (char *)"Q", XMdcMedconQuit, 0, NULL}, {(char *)"/_Images", NULL, (void(*)())NULL, 0, (char *)"" }, {(char *)"/Images/View", (char *)"V", XMdcImagesView, 0, NULL}, {(char *)"/Images/Extract", (char *)"E",XMdcExtractStyleSel, 0,NULL}, {(char *)"/Images/Reslice", NULL, (void(*)())NULL, 0, (char *)"" }, {(char *)"/Images/Reslice/XY-Transaxial",NULL,XMdcResliceImages ,MDC_TRANSAXIAL,NULL}, {(char *)"/Images/Reslice/XZ-Coronal", NULL,XMdcResliceImages ,MDC_CORONAL, NULL}, {(char *)"/Images/Reslice/YZ-Sagittal", NULL,XMdcResliceImages ,MDC_SAGITTAL, NULL}, {(char *)"/Images/Flip", NULL, (void(*)())NULL, 0, (char *)"" }, {(char *)"/Images/Flip/Horizontal",NULL,XMdcTransformImages ,MDC_TRANSF_HORIZONTAL,NULL}, {(char *)"/Images/Flip/Vertical ",NULL ,XMdcTransformImages ,MDC_TRANSF_VERTICAL,NULL}, {(char *)"/Images/Sort", NULL, (void(*)())NULL, 0, (char *)"" }, {(char *)"/Images/Sort/Reverse",NULL,XMdcTransformImages ,MDC_TRANSF_REVERSE,NULL}, {(char *)"/Images/Sort/Cine", NULL, (void(*)())NULL, 0, (char *)"" }, {(char *)"/Images/Sort/Cine/Apply",NULL,XMdcTransformImages ,MDC_TRANSF_CINE_APPLY,NULL}, {(char *)"/Images/Sort/Cine/Undo",NULL ,XMdcTransformImages ,MDC_TRANSF_CINE_UNDO,NULL}, {(char *)"/Images/Matrix",NULL, (void(*)())NULL, 0, (char *)"" }, {(char *)"/Images/Matrix/Square",NULL,XMdcTransformImages ,MDC_TRANSF_SQR1,NULL}, {(char *)"/Images/Matrix/Square Pwr2",NULL,XMdcTransformImages ,MDC_TRANSF_SQR2,NULL}, {(char *)"/_Options", NULL, (void(*)())NULL, 0, (char *)""}, {(char *)"/Options/MedCon", (char *)"M",XMdcOptionsMedconSel,0,NULL}, {(char *)"/Options/SepE", NULL, (void(*)())NULL, 0, (char *)"" }, {(char *)"/Options/Render", (char *)"R",XMdcOptionsRenderSel,0,NULL}, {(char *)"/Options/Labels", (char *)"L", XMdcOptionsLabelSel,0,NULL}, {(char *)"/Options/Pages", (char *)"P", XMdcOptionsPagesSel,0,NULL}, {(char *)"/Options/Resize", (char *)"Z",XMdcOptionsResizeSel,0,NULL}, {(char *)"/Options/Colormap", NULL, (void(*)())NULL, 0, (char *)""}, {(char *)"/Options/Colormap/Colors", (char *)"C" , XMdcOptionsColorMapSel, 0, NULL}, {(char *)"/Options/Colormap/Place", NULL, XMdcOptionsMapPlaceSel, 0, NULL}, {(char *)"/_Help", NULL, (void(*)())NULL, 0, (char *)""}, {(char *)"/Help/Online Info", NULL, XMdcHelp, 0, NULL}, {(char *)"/Help/Console Logs", NULL, XMdcShowLogConsole, 0, NULL}, {(char *)"/Help/About", NULL, XMdcAbout, 0, NULL} }; /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcMenusGetMain(GtkWidget *window, GtkWidget **menubar) { guint nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]); GtkItemFactory *factory; GtkAccelGroup *accel_group; accel_group = gtk_accel_group_new(); factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "
", accel_group); gtk_item_factory_create_items(factory, nmenu_items, menu_items, NULL); #ifdef GTKONE gtk_accel_group_attach(accel_group, GTK_OBJECT(window)); #else gtk_window_add_accel_group(GTK_WINDOW(window), accel_group); #endif if (menubar) *menubar = gtk_item_factory_get_widget(factory, "
"); } xmedcon-0.14.1/source/xviewer.c0000644000175000017510000004565612636253503013336 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xviewer.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : image viewer routines * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcGetBoardDimensions() - Get checker board display * * XMdcHandleBoardDimensions() - Create image number arrays* * XMdcBuildViewerWindow() - Build viewer window * * XMdcViewerHide() - Hide the viewer * * XMdcViewerShow() - Show the viewer * * XMdcViewerEnableAutoShrink() - Enable auto shrinking * * XMdcViewerDisableAutoShrink()- Disable auto shrinking * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xviewer.c,v 1.35 2015/12/22 13:59:31 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #include #ifdef HAVE_STDLIB_H #include #endif #include "xmedcon.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ int XMdcGetBoardDimensions(void) { Uint32 i, total_images, real_images, mwidth, mheight; Uint32 arbitrary_row, arbitrary_col; Uint32 arbitrary_images_per_page, arbitrary_pages; Uint32 trial_images_vertical = 0, trial_images_horizontal = 0; int FOUND = MDC_NO; real_images = XMdcPagesGetNrImages(); if (real_images == 0) XMdcDisplayFatalErr(MDC_BAD_CODE,"Number of images is zero !?"); mwidth = XMdcScaleW(my.fi->mwidth); mheight = XMdcScaleH(my.fi->mheight); /* TRIAL#1: original number of images is a neat square ? */ total_images = real_images; if ((total_images % (Uint32)sqrt((double)total_images)) == 0 ) { FOUND = MDC_YES; trial_images_vertical = (Uint32)sqrt((double)total_images); trial_images_horizontal = total_images / trial_images_vertical; /* inside the screen boundaries ? */ if ((trial_images_vertical * mheight) > (gdk_screen_height() - XMDC_FREE_BORDER)) FOUND = MDC_NO; if ((trial_images_horizontal * mwidth) > (gdk_screen_width() - XMDC_FREE_BORDER)) FOUND = MDC_NO; } if (FOUND == MDC_NO) { /* TRIAL#2: based on divisors of closest even number */ total_images = real_images; if (total_images % 2) total_images += 1; for (i=(Uint32)sqrt((double)total_images); i>=1; i--) { if (!(total_images % i)) { FOUND = MDC_YES; /* found a possible dimension */ trial_images_vertical = i; trial_images_horizontal = total_images / trial_images_vertical; /* inside the screen boundaries ? */ if ((trial_images_vertical * mheight) > (gdk_screen_height() - XMDC_FREE_BORDER)) FOUND = MDC_NO; if ((trial_images_horizontal * mwidth) > (gdk_screen_width() - XMDC_FREE_BORDER)) FOUND = MDC_NO; } if (FOUND == MDC_YES) break; } } if (FOUND == MDC_NO) { /* TRIAL#3: based on closest square number */ /* always ok, except for screen boundaries */ FOUND = MDC_YES; total_images = real_images; while ( total_images % (Uint32)sqrt((double)total_images) ) { total_images += 1; } trial_images_vertical = (Uint32)sqrt((double)total_images); trial_images_horizontal = total_images / trial_images_vertical; /* inside the screen boundaries ? */ if ((trial_images_vertical * mheight) > (gdk_screen_height() - XMDC_FREE_BORDER)) FOUND = MDC_NO; if ((trial_images_horizontal * mwidth) > (gdk_screen_width() - XMDC_FREE_BORDER)) FOUND = MDC_NO; } if (FOUND == MDC_YES) { my.images_vertical = trial_images_vertical; my.images_horizontal = trial_images_horizontal; /* now get pages & images per page */ my.images_per_page = my.images_vertical * my.images_horizontal; if (real_images < my.images_per_page) { my.number_of_pages = (my.fi->number + real_images - 1) / real_images; }else{ my.number_of_pages = (my.fi->number + my.images_per_page - 1) / my.images_per_page; } if ((real_images < my.images_per_page) && (my.images_vertical == 1)) { /* Ola, all images fit on one row ! (ex.: 1 image) -> No board */ my.images_horizontal = real_images; my.images_per_page = my.images_vertical * my.images_horizontal; my.number_of_pages = (my.fi->number + my.images_per_page - 1) / my.images_per_page; } return(MDC_OK); } /* final fallback based on screen dimensions */ arbitrary_row = (gdk_screen_height() - XMDC_FREE_BORDER) / XMdcScaleH(my.fi->mheight); arbitrary_col = (gdk_screen_width() - XMDC_FREE_BORDER) / XMdcScaleW(my.fi->mwidth); if (arbitrary_row == 0 || arbitrary_col == 0) { arbitrary_row = 1; arbitrary_col = 1; } arbitrary_images_per_page = arbitrary_row * arbitrary_col; arbitrary_pages = (my.fi->number+(arbitrary_images_per_page - 1)) / arbitrary_images_per_page; my.images_vertical = arbitrary_row; my.images_horizontal = arbitrary_col; my.images_per_page = arbitrary_images_per_page; my.number_of_pages = arbitrary_pages; /* we still have to take care of less images per page */ if (XMdcPagesGetNrImages() < my.images_per_page ) { my.images_per_page = XMdcPagesGetNrImages(); my.number_of_pages = (my.fi->number+(my.images_per_page - 1)) / my.images_per_page; my.images_vertical = (my.images_per_page + (my.images_horizontal - 1)) / my.images_horizontal; } if ((my.fi->number < my.images_per_page) && (my.images_vertical == 1)) { /* Ola, all images fit on one row ! (ex.: 1 image) -> No chessboard */ my.images_horizontal = my.fi->number; my.images_per_page = my.images_vertical * my.images_horizontal; my.number_of_pages = 1; }else if (my.fi->number < my.images_per_page) { /* Ola, there could have been to much rows provided */ for (i=1; i<=my.images_vertical; i++) { if (i*my.images_horizontal >= my.fi->number) { my.images_vertical = i; my.images_per_page = my.images_vertical * my.images_horizontal; my.number_of_pages = 1; } } } return(MDC_OK); } void XMdcHandleBoardDimensions(void) { Uint32 vertical, i; Uint32 h=my.fi->mheight; /* derive colormap dimensions */ vertical = my.images_vertical; if (vertical*(XMdcScaleH(h)+(XMDC_IMAGE_BORDER<<1)) < XMDC_COLORMAP_HEIGHT) { my.cmap_h = XMDC_COLORMAP_HEIGHT; }else{ my.cmap_h = vertical * (XMdcScaleH(h) + XMDC_IMAGE_BORDER); } my.cmap_w = XMDC_COLORMAP_WIDTH; my.im=(GdkPixbuf **)malloc(sizeof(GdkPixbuf *) * my.images_per_page); if (my.im == NULL) { MdcCleanUpFI(my.fi); XMdcDisplayFatalErr(MDC_BAD_ALLOC,"Couldn't malloc GdkPixbuf array"); } my.imagenumber=(Uint32 *)malloc(sizeof(Uint32)*my.images_per_page); if (my.imagenumber == NULL) { MdcFree(my.im); MdcCleanUpFI(my.fi); XMdcDisplayFatalErr(MDC_BAD_ALLOC,"Couldn't malloc ImageNumbers array"); } my.realnumber =(Uint32 *)malloc(sizeof(Uint32)*my.images_per_page); if (my.realnumber == NULL) { MdcFree(my.im); MdcFree(my.imagenumber); MdcCleanUpFI(my.fi); XMdcDisplayFatalErr(MDC_BAD_ALLOC,"Couldn't malloc RealNumbers array"); } my.pagenumber=(Uint32 *)malloc(sizeof(Uint32)*my.number_of_pages); if (my.pagenumber == NULL) { MdcFree(my.im); MdcFree(my.imagenumber); MdcFree(my.realnumber); MdcCleanUpFI(my.fi); XMdcDisplayFatalErr(MDC_BAD_ALLOC,"Couldn't malloc PageNumbers array"); } my.image=(GtkWidget **)malloc(sizeof(GtkWidget *)*my.images_per_page); if (my.image == NULL) { MdcFree(my.im); MdcFree(my.imagenumber); MdcFree(my.realnumber); MdcFree(my.pagenumber); MdcCleanUpFI(my.fi); XMdcDisplayFatalErr(MDC_BAD_ALLOC,"Couldn't malloc Images array"); } #ifdef MDC_USE_SIGNAL_BLOCKER my.sblkr=(SignalBlocker *)malloc(sizeof(SignalBlocker)*my.images_per_page); if (my.sblkr == NULL) { MdcFree(my.im); MdcFree(my.imagenumber); MdcFree(my.realnumber); MdcFree(my.pagenumber); MdcFree(my.image); MdcCleanUpFI(my.fi); XMdcDisplayFatalErr(MDC_BAD_ALLOC,"Couldn't malloc SignalBlockers"); } #else my.sblkr = NULL; #endif for (i = 0; imwidth); MdcDebugPrint("mheight = %u",my.fi->mheight); MdcDebugPrint("resize = %d",sResizeSelection.CurType); MdcDebugPrint("fi.number = %u",my.fi->number); MdcDebugPrint("fi.dim[3] = %u",my.fi->dim[3]); MdcDebugPrint("curpage = %u",my.curpage); MdcDebugPrint("images_horizontal = %u",my.images_horizontal); MdcDebugPrint("images_vertical = %u",my.images_vertical); MdcDebugPrint("images_per_page = %u",my.images_per_page); MdcDebugPrint("number_of_pages = %u",my.number_of_pages); MdcDebugPrint("cmap_w = %u",my.cmap_w); MdcDebugPrint("cmap_h = %u",my.cmap_h); } void XMdcBuildViewerWindow(void) { GtkWidget *box1; GtkWidget *box2; GtkWidget *vbox; GtkWidget *label; GtkWidget *frame; GtkWidget *winbox; GtkWidget *button; GtkWidget *spinner; GtkWidget *entrybox; GtkWidget *separator; GtkAdjustment *adj; if (my.viewwindow == NULL) { my.viewwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_policy(GTK_WINDOW(my.viewwindow),FALSE,FALSE,FALSE); gtk_signal_connect(GTK_OBJECT(my.viewwindow), "delete-event", GTK_SIGNAL_FUNC(XMdcViewerHide), NULL); gtk_signal_connect(GTK_OBJECT(my.viewwindow), "destroy", GTK_SIGNAL_FUNC(XMdcMedconQuit), NULL); gtk_container_set_border_width(GTK_CONTAINER (my.viewwindow), 0); } gtk_window_set_title(GTK_WINDOW(my.viewwindow), my.fi->ifname); gtk_widget_realize(my.viewwindow); box1 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER (my.viewwindow), box1); gtk_widget_show(box1); my.viewbox = box1; box2 = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(box1),box2,FALSE,FALSE,0); gtk_widget_show(box2); my.pagemenu = gtk_option_menu_new(); gtk_option_menu_set_menu(GTK_OPTION_MENU(my.pagemenu),XMdcPagesCreateMenu()); gtk_box_pack_start(GTK_BOX(box2),my.pagemenu,TRUE,TRUE,0); gtk_widget_show(my.pagemenu); button = gtk_button_new_with_label("Next"); gtk_signal_connect(GTK_OBJECT(button),"button-release-event", GTK_SIGNAL_FUNC(XMdcPagesNext),NULL); gtk_box_pack_start(GTK_BOX(box2),button,TRUE,TRUE,0); gtk_widget_show(button); button = gtk_button_new_with_label("Prev"); gtk_signal_connect(GTK_OBJECT(button),"button-release-event", GTK_SIGNAL_FUNC(XMdcPagesPrev),NULL); gtk_box_pack_start(GTK_BOX(box2),button,TRUE,TRUE,0); gtk_widget_show(button); /* layout for images and colormap */ frame = gtk_frame_new(NULL); gtk_container_set_border_width(GTK_CONTAINER(frame),4); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_OUT); gtk_box_pack_start(GTK_BOX(box1),frame,TRUE,TRUE,0); gtk_widget_show(frame); winbox = gtk_hbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame),winbox); gtk_widget_show(winbox); my.imgsbox = gtk_hbox_new(TRUE,0); gtk_container_set_border_width(GTK_CONTAINER(my.imgsbox),0); gtk_box_pack_start(GTK_BOX(winbox),my.imgsbox,TRUE,TRUE,0); gtk_widget_show(my.imgsbox); my.imgstable=gtk_table_new(my.images_vertical,my.images_horizontal,TRUE); gtk_box_pack_start(GTK_BOX(my.imgsbox), my.imgstable, TRUE, TRUE, 0); gtk_widget_show(my.imgstable); separator = gtk_vseparator_new(); gtk_box_pack_start(GTK_BOX(winbox), separator, FALSE, FALSE, 0); gtk_widget_show(separator); my.cmapbox = gtk_event_box_new(); gtk_box_pack_start(GTK_BOX(winbox),my.cmapbox,FALSE,FALSE,0); gtk_widget_show(my.cmapbox); XMdcApplyMapPlace(XMDC_CMAP_PLACE); /* seperator */ separator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(box1), separator, FALSE, TRUE, 0); /* layout for buttons */ vbox = gtk_vbox_new(FALSE, 2); gtk_container_set_border_width(GTK_CONTAINER(box2), 0); gtk_box_pack_start(GTK_BOX(box1), vbox, FALSE, TRUE, 0); gtk_widget_show(vbox); box2 = gtk_hbox_new(FALSE, 2); gtk_container_set_border_width(GTK_CONTAINER(box2), 0); gtk_box_pack_start(GTK_BOX(vbox), box2, FALSE, FALSE, 0); gtk_widget_show(box2); button = gtk_button_new_with_label("Toggle Entries"); gtk_box_pack_start(GTK_BOX(box2),button,TRUE,TRUE,0); gtk_widget_show(button); entrybox = gtk_hbox_new(FALSE, 2); gtk_container_set_border_width(GTK_CONTAINER(box2), 0); gtk_box_pack_start(GTK_BOX(box2), entrybox, FALSE, FALSE, 0); gtk_widget_show(entrybox); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcToggleVisibility), GTK_OBJECT(entrybox)); label = gtk_label_new("Page: "); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label,"FixedLabel"); gtk_box_pack_start(GTK_BOX(entrybox),label,FALSE,TRUE,5); gtk_widget_show(label); adj=(GtkAdjustment *)gtk_adjustment_new(1., 1., (float)my.number_of_pages, 1., 5., 0.); spinner = gtk_spin_button_new(adj, 0.0, 0); gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(spinner), TRUE); #ifdef GTKONE gtk_spin_button_set_shadow_type(GTK_SPIN_BUTTON(spinner), GTK_SHADOW_ETCHED_IN); #endif gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(spinner), TRUE); gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON(spinner), TRUE); gtk_box_pack_start(GTK_BOX(entrybox),spinner,FALSE,FALSE,5); #ifdef GTKONE gtk_signal_connect_after(GTK_OBJECT(spinner),"key_press_event", GTK_SIGNAL_FUNC(XMdcPagesGoTo),NULL); gtk_signal_connect_after(GTK_OBJECT(spinner), "button_release_event", GTK_SIGNAL_FUNC(XMdcPagesGoTo),NULL); #else gtk_signal_connect(GTK_OBJECT(spinner),"value_changed", GTK_SIGNAL_FUNC(XMdcPagesGoTo),NULL); #endif gtk_widget_show(spinner); label = gtk_label_new("Table: "); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label,"FixedLabel"); gtk_box_pack_start(GTK_BOX(entrybox),label,FALSE,TRUE,5); gtk_widget_show(label); adj=(GtkAdjustment *)gtk_adjustment_new(1., 1., (float)XMDC_MAX_LOADABLE_LUTS, 1., 5., 0.); spinner = gtk_spin_button_new(adj, 0.0, 0); gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(spinner), TRUE); #ifdef GTKONE gtk_spin_button_set_shadow_type(GTK_SPIN_BUTTON(spinner), GTK_SHADOW_ETCHED_IN); #endif gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(spinner), TRUE); gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON(spinner), TRUE); gtk_box_pack_start(GTK_BOX(entrybox),spinner,FALSE,FALSE,5); #ifdef GTKONE gtk_signal_connect_after(GTK_OBJECT(spinner),"key_press_event", GTK_SIGNAL_FUNC(XMdcChangeLUT),NULL); gtk_signal_connect_after(GTK_OBJECT(spinner), "button_release_event", GTK_SIGNAL_FUNC(XMdcChangeLUT),NULL); #else gtk_signal_connect(GTK_OBJECT(spinner),"value_changed", GTK_SIGNAL_FUNC(XMdcChangeLUT),NULL); #endif gtk_widget_show(spinner); box2 = gtk_hbox_new(FALSE, 2); gtk_container_set_border_width(GTK_CONTAINER(box2), 0); gtk_box_pack_start(GTK_BOX(vbox), box2, FALSE, TRUE, 0); gtk_widget_show(box2); button = gtk_button_new_with_label(" Hide "); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcViewerHide), NULL); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0); gtk_widget_show(button); button = gtk_button_new_with_label("Labels"); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcLabelSel), NULL); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0); gtk_widget_show(button); button = gtk_button_new_with_label("Render"); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcRenderingSel), NULL); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0); gtk_widget_show(button); } void XMdcViewerHide(void) { if (my.viewwindow != NULL) { gtk_widget_hide(my.viewwindow); } } void XMdcViewerShow(void) { if (XMDC_FILE_OPEN == MDC_NO) return; if (my.viewwindow != NULL) { MdcDebugPrint("Show viewer window ..."); gtk_widget_show(my.viewwindow); } XMdcViewerDisableAutoShrink(); } void XMdcViewerEnableAutoShrink(void) { if (my.viewwindow != NULL) { MdcDebugPrint("enable auto shrink"); gtk_window_set_policy(GTK_WINDOW(my.viewwindow),TRUE,TRUE,TRUE); } } void XMdcViewerDisableAutoShrink(void) { if (my.viewwindow != NULL) { MdcDebugPrint("disable auto shrink"); gtk_window_set_policy(GTK_WINDOW(my.viewwindow),FALSE,FALSE,FALSE); } } xmedcon-0.14.1/source/xhelp.c0000644000175000017510000000550012636253502012744 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xhelp.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : help routines (open URL in Mozilla) * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcHelp() - Open help in Mozilla * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xhelp.c,v 1.23 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #include "xmedcon.h" /***************************************************************************** D E F I N E S *****************************************************************************/ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcHelp(GtkWidget *widget, gpointer data) { int err; /* mozilla */ #if _WIN32 sprintf(xmdcstr,"\"c:\\program files\\mozilla firefox\\firefox.exe\" %s &",XMDCHELP); #else sprintf(xmdcstr,"firefox '%s' &",XMDCHELP); #endif err=system(xmdcstr); if (err == 0) { XMdcDisplayMesg("Opening %s docs in Mozilla Firefox ...",MDC_PRGR); }else{ XMdcDisplayMesg("Online documentation available at\n%s",XMDCHELP); } } xmedcon-0.14.1/source/xicons.h0000644000175000017510000000366012636253502013141 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xicons.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xicons.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xicons.h,v 1.17 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XICONS_H__ #define __XICONS_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ extern const unsigned char xmdc_brightness_icon[]; extern const unsigned char xmdc_contrast_icon[]; extern const unsigned char xmdc_gamma_icon[]; #endif xmedcon-0.14.1/source/xerror.c0000644000175000017510000002257112636253502013154 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xerror.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : error display routines * * * * project : (X)MedCon by Erik Nolf * * * * Note : This code gets linked in (X)MedCon library with X-support* * * * Functions : XMdcFatalErrorKill() - Quit program with fatal error * * XMdcDisplayDialog() - Display a dialog window * * XMdcDisplayWarn() - Display a warning * * XMdcDisplayMesg() - Display a message * * XMdcDisplayErr() - Display an error * * XMdcDisplayFatalErr() - Display a fatal error * * XMdcLogHandler() - The Glib log output handler * * XMdcShowErrorConsole() - Show the error console * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xerror.c,v 1.29 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ /* gtktext was replaced by gtktextview in gtk-2.0, this enables it in 2.0 */ #define GTK_ENABLE_BROKEN #include #include #include #include "xmedcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ static GtkWidget *wconsole = NULL; static GtkWidget *wlogs = NULL; /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcFatalErrorKill(GtkWidget *button, int *code) { gtk_exit(-*code); } void *XMdcDisplayDialog(int code, char *windowtitle, char *info) { GtkWidget *dialog; GtkWidget *label; GtkWidget *button; /* gdk_beep(); */ dialog = gtk_dialog_new(); gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area),0); if (code != MDC_OK) { gtk_signal_connect(GTK_OBJECT(dialog), "destroy", GTK_SIGNAL_FUNC(XMdcFatalErrorKill), &code); }else{ gtk_signal_connect(GTK_OBJECT(dialog),"destroy", GTK_SIGNAL_FUNC(gtk_widget_destroy), NULL); } /* gtk_widget_set_uposition(dialog,100,100); */ gtk_window_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE); gtk_window_set_title(GTK_WINDOW(dialog), windowtitle); gtk_container_set_border_width(GTK_CONTAINER(dialog), 0); label = gtk_label_new(info); gtk_misc_set_padding(GTK_MISC(label), 30, 5); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), label, TRUE, TRUE, 0); gtk_widget_show(label); button = gtk_button_new_with_label("OK"); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), button, TRUE, TRUE, 0); if (code != MDC_OK) { gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcFatalErrorKill), &code); }else{ gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(dialog)); } gtk_widget_show(button); gtk_widget_show_now(dialog); XMdcUpdateDrawing(); return(dialog); } void *XMdcDisplayWarn(char *fmt, ...) { va_list args; va_start(args, fmt); vsprintf(errmsg, fmt, args); va_end(args); return(XMdcDisplayDialog(MDC_OK,"Warning",errmsg)); } void *XMdcDisplayMesg(char *fmt, ...) { va_list args; va_start(args, fmt); vsprintf(errmsg, fmt, args); va_end(args); return(XMdcDisplayDialog(MDC_OK,"Message",errmsg)); } void *XMdcDisplayErr(char *fmt, ...) { va_list args; va_start(args, fmt); vsprintf(errmsg, fmt, args); va_end(args); return(XMdcDisplayDialog(MDC_OK,"Error",errmsg)); } void XMdcDisplayFatalErr(int code, char *fmt, ...) { va_list args; va_start(args, fmt); vsprintf(errmsg, fmt, args); va_end(args); XMdcDisplayDialog(code, "Fatal Error", errmsg); } void XMdcLogHandler(const gchar *domain, GLogLevelFlags level, const gchar *message, gpointer user_data) { time_t t; char *logmsg, timestr[32]; time(&t); strftime(timestr,32,"%b %d %H:%M:%S",localtime(&t)); switch (level) { case G_LOG_LEVEL_DEBUG: logmsg = g_strdup_printf("DEBUG **: %s\n %s\n", timestr, message); break; case G_LOG_LEVEL_MESSAGE: logmsg = g_strdup_printf("MESSAGE **: %s\n %s\n", timestr, message); break; case G_LOG_LEVEL_WARNING: logmsg = g_strdup_printf("WARNING **: %s\n %s\n", timestr, message); break; case G_LOG_LEVEL_ERROR: logmsg = g_strdup_printf("ERROR **: %s\n %s\n", timestr, message); break; default: logmsg = g_strdup_printf("REMARK **: %s\n %s\n", timestr, message); } if (logmsg == NULL) return; gtk_text_insert(GTK_TEXT(wlogs),NULL,NULL,NULL,logmsg,-1); gtk_text_thaw(GTK_TEXT(wlogs)); g_free(logmsg); } void XMdcCreateLogConsole(void) { GtkWidget *box1, *box2; GtkWidget *table; GtkWidget *button; GtkWidget *separator; GtkWidget *vscrollbar; char *str; if (wconsole != NULL) return; wconsole = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_widget_set_usize(wconsole, 506, 100); gtk_signal_connect(GTK_OBJECT(wconsole), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroy), NULL); gtk_signal_connect(GTK_OBJECT(wconsole), "delete_event", GTK_SIGNAL_FUNC(XMdcHandlerToHide), NULL); str = g_strdup_printf("%s Console Logs",MDC_PRGR); if (str != NULL) { gtk_window_set_title(GTK_WINDOW(wconsole),str); g_free(str); } box1 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(wconsole), box1); gtk_widget_show(box1); box2 = gtk_vbox_new(FALSE,0); gtk_container_set_border_width(GTK_CONTAINER(box2),0); gtk_box_pack_start(GTK_BOX(box1),box2,TRUE,TRUE,0); gtk_widget_show(box2); table = gtk_table_new(2, 2, FALSE); gtk_table_set_row_spacing(GTK_TABLE(table), 0, 2); gtk_table_set_col_spacing(GTK_TABLE(table), 0, 2); gtk_box_pack_start(GTK_BOX(box2),table,TRUE,TRUE,0); gtk_widget_show(table); wlogs = gtk_text_new(NULL,NULL); gtk_text_set_editable(GTK_TEXT(wlogs),FALSE); gtk_text_set_word_wrap(GTK_TEXT(wlogs), TRUE); gtk_table_attach(GTK_TABLE(table),wlogs, 0, 1, 0, 1, GTK_EXPAND | GTK_SHRINK | GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); gtk_widget_show(wlogs); vscrollbar = gtk_vscrollbar_new(GTK_TEXT(wlogs)->vadj); gtk_table_attach(GTK_TABLE(table), vscrollbar, 1, 2, 0, 1, GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0); gtk_widget_show(vscrollbar); gtk_widget_show(wlogs); separator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(box1),separator,FALSE,TRUE,0); gtk_widget_show(separator); box2 = gtk_hbox_new(FALSE,0); gtk_container_set_border_width(GTK_CONTAINER(box2),0); gtk_box_pack_start(GTK_BOX(box1),box2,FALSE,FALSE,0); gtk_widget_show(box2); button = gtk_button_new_with_label("Clear"); gtk_signal_connect(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(XMdcClearLogConsole),NULL); gtk_box_pack_start(GTK_BOX(box2),button,TRUE,TRUE,2); gtk_widget_show(button); button = gtk_button_new_with_label("Close"); gtk_signal_connect_object(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(wconsole)); gtk_box_pack_start(GTK_BOX(box2),button,TRUE,TRUE,2); gtk_widget_show(button); g_log_set_handler(MDC_PRGR,G_LOG_LEVEL_MASK,XMdcLogHandler, NULL); } void XMdcShowLogConsole(void) { if (wconsole == NULL) XMdcCreateLogConsole(); gtk_widget_show(wconsole); } void XMdcClearLogConsole(void) { gtk_editable_delete_text( GTK_EDITABLE(wlogs), 0, (gint)gtk_text_get_length(GTK_TEXT(wlogs))); } xmedcon-0.14.1/source/m-split.h0000644000175000017510000000516112636253502013221 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-split.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-split.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-split.h,v 1.17 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_SPLIT_H__ #define __M_SPLIT_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_SPLIT_NONE MDC_NO /* keep images in same volum */ #define MDC_SPLIT_PER_SLICE 1 /* split over each image slice */ #define MDC_SPLIT_PER_FRAME 2 /* split over each time frame */ /**************************************************************************** F U N C T I O N S ****************************************************************************/ Int16 MdcGetSplitAcqType(FILEINFO *fi); Uint32 MdcGetNrSplit(void); char *MdcGetSplitBaseName(char *path); void MdcUpdateSplitPrefix(char *dpath, char *spath, char *bname, int nr); char *MdcCopySlice(FILEINFO *ofi, FILEINFO *ifi, Uint32 slice0); char *MdcCopyFrame(FILEINFO *ofi, FILEINFO *ifi, Uint32 frame0); char *MdcSplitSlices(FILEINFO *fi, int format, int prefixnr); char *MdcSplitFrames(FILEINFO *fi, int format, int prefixnr); #endif xmedcon-0.14.1/source/m-ecat72.c0000644000175000017510000015616712636253502013163 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-ecat72.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : Read ECAT 7.2 files * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcCheckECAT7() - Check for ECAT7 format * * MdcEcatPrintMainHdr() - Print content main header * * MdcEcatPrintImgSubHdr() - Print content image subheader * * MdcEcatPrintAttnSubHdr() - Print content attenuation hdr * * MdcEcatPrintScanSubHdr() - Print content scan header * * MdcEcatPrintNormSubHdr() - Print content norm header * * MdcReadECAT7() - Read ECAT7 file * * MdcWriteECAT7() - Write ECAT7 file * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-ecat72.c,v 1.77 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #define __USE_POSIX 1 #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "medcon.h" #if MDC_INCLUDE_TPC #define MDC_TPC_SITE 0 /* 0/1 disable/enable TPC site items */ #define __USE_ISOC99 1 #include #include "ecat7.h" #endif /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_NUM_PLANES_FIX MDC_YES /* fix for wrong num_planes = 1 bug */ #define MDC_MAX_ECAT7FILETYPES 15 #define MDC_MAX_ECAT7FILETYPES_SIZE 15 static char MdcEcat7FileTypes [MDC_MAX_ECAT7FILETYPES][MDC_MAX_ECAT7FILETYPES_SIZE]= {"Unknown","Sinogram","Image16","AttnCorr","Norm", "PolarMap","Volume8","Volume16","Projection8", "Projection16","Image8","3DSino16","3DSino8", "3DNorm","3DSinoFlt"}; /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcCheckECAT7(FILEINFO *fi) { Mdc_Main_header7 mh; if (mdc_mat_read_main_header7(fi->ifp,&mh)) return MDC_BAD_READ; if (memcmp(mh.magic_number,MDC_ECAT7_SIG,7) ) return(MDC_FRMT_NONE); return MDC_FRMT_ECAT7; } void MdcEcatPrintMainHdr(Mdc_Main_header7 *mh) { int i; MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("ECAT7 Main Header (%d bytes)\n",MH_72_SIZE); MdcPrintLine('-',MDC_HALF_LENGTH); MdcGetSafeString(mdcbufr,(char *)mh->magic_number,14,14); MdcPrntScrn("magic_number : %s\n",mdcbufr); MdcGetSafeString(mdcbufr,mh->original_file_name,32,32); MdcPrntScrn("original_file_name : %s\n",mdcbufr); MdcPrntScrn("sw_version : %hd\n",mh->sw_version); MdcPrntScrn("system_type : %hd\n",mh->system_type); MdcPrntScrn("file_type : %hd ",mh->file_type); if ((mh->file_type > -1) && (mh->file_type < 15)) MdcPrntScrn("(= %s)\n",MdcEcat7FileTypes[mh->file_type]); else MdcPrntScrn("(= Unknown)\n"); MdcGetSafeString(mdcbufr,mh->serial_number,10,10); MdcPrntScrn("serial_number : %s\n",mdcbufr); MdcPrntScrn("scan_start_time : %s\n" ,ctime((time_t *)&mh->scan_start_time)); MdcGetSafeString(mdcbufr,mh->isotope_name,8,8); MdcPrntScrn("isotope_name : %s\n",mdcbufr); MdcPrntScrn("isotope_halflife : %f [sec]\n",mh->isotope_halflife); MdcGetSafeString(mdcbufr,mh->radiopharmaceutical,32,32); MdcPrntScrn("radiopharmaceutical : %s\n",mdcbufr); MdcPrntScrn("gantry_tilt : %f [degrees]\n",mh->gantry_tilt); MdcPrntScrn("gantry_rotation : %f [degrees]\n",mh->gantry_rotation); MdcPrntScrn("bed_elevation : %f [cm]\n",mh->bed_elevation); MdcPrntScrn("intrinsic_tilt : %f [degrees]\n",mh->intrinsic_tilt); MdcPrntScrn("wobble_speed : %hd [rpm]\n",mh->wobble_speed); MdcPrntScrn("tansm_source_type : %hd\n",mh->transm_source_type); MdcPrntScrn("distance_scanned : %f [cm]\n",mh->distance_scanned); MdcPrntScrn("transaxial_fov : %f [cm]\n",mh->transaxial_fov); MdcPrntScrn("angular_compression : %hd\n",mh->angular_compression); MdcPrntScrn("coin_samp_mode : %hd\n",mh->coin_samp_mode); MdcPrntScrn("axial_samp_mode : %hd\n",mh->axial_samp_mode); MdcPrntScrn("ecat_calibration_factor : %e\n",mh->ecat_calibration_factor); MdcPrntScrn("calibration_units : %hd\n",mh->calibration_units); MdcPrntScrn("calibration_units_label : %hd\n",mh->calibration_units_label); MdcPrntScrn("compression_code : %hd\n",mh->compression_code); MdcGetSafeString(mdcbufr,mh->study_type,14,14); MdcPrntScrn("study_type : %s\n",mdcbufr); MdcGetSafeString(mdcbufr,mh->patient_id,16,16); MdcPrntScrn("patient_id : %s\n",mdcbufr); MdcGetSafeString(mdcbufr,mh->patient_name,32,32); MdcPrntScrn("patient_name : %s\n",mdcbufr); MdcPrntScrn("patient_sex : "); switch (mh->patient_sex[0]) { case 0: MdcPrntScrn("M\n"); break; case 1: MdcPrntScrn("F\n"); break; default: MdcPrntScrn("U\n"); } MdcPrntScrn("patient_dexterity : %c\n",mh->patient_dexterity[0]); MdcPrntScrn("patient_age : %f\n",mh->patient_age); MdcPrntScrn("patient_height : %f\n",mh->patient_height); MdcPrntScrn("patient_weight : %f\n",mh->patient_weight); MdcPrntScrn("patient_birth_date : %s\n" ,ctime((time_t *)&mh->patient_birth_date)); MdcGetSafeString(mdcbufr,mh->physician_name,32,32); MdcPrntScrn("physician_name : %s\n",mdcbufr); MdcGetSafeString(mdcbufr,mh->operator_name,32,32); MdcPrntScrn("operator_name : %s\n",mdcbufr); MdcGetSafeString(mdcbufr,mh->study_description,32,32); MdcPrntScrn("study_description : %s\n",mdcbufr); MdcPrntScrn("acquisition_type : %hd\n",mh->acquisition_type); MdcPrntScrn("patient_orientation : %hd\n",mh->patient_orientation); MdcGetSafeString(mdcbufr,mh->facility_name,20,20); MdcPrntScrn("facility_name : %s\n",mdcbufr); MdcPrntScrn("num_planes : %hd\n",mh->num_planes); MdcPrntScrn("num_frames : %hd\n",mh->num_frames); MdcPrntScrn("num_gates : %hd\n",mh->num_gates); MdcPrntScrn("num_bed_pos : %hd\n",mh->num_bed_pos); MdcPrntScrn("init_bed_position : %f\n",mh->init_bed_position); for (i=0; i<15; i++) MdcPrntScrn("bed_position[%2d] : %f\n",i,mh->bed_position[i]); MdcPrntScrn("plane_separation : %f [cm]\n",mh->plane_separation); MdcPrntScrn("lwr_sctr_thres : %hd [Kev]\n",mh->lwr_sctr_thres); MdcPrntScrn("lwr_true_thres : %hd [Kev]\n",mh->lwr_true_thres); MdcPrntScrn("upr_true_thres : %hd [Kev]\n",mh->upr_true_thres); MdcGetSafeString(mdcbufr,mh->user_process_code,10,10); MdcPrntScrn("user_process_code : %s\n",mdcbufr); MdcPrntScrn("acquisition_mode : %hd\n",mh->acquisition_mode); MdcPrntScrn("bin_size : %f [cm]\n",mh->bin_size); MdcPrntScrn("branching_fraction : %f\n",mh->branching_fraction); MdcPrntScrn("dose_start_time : %s\n" ,ctime((time_t *)&mh->dose_start_time)); MdcPrntScrn("dosage : %e [mCi]\n",mh->dosage); MdcPrntScrn("well_counter_corr_factor : %f\n",mh->well_counter_corr_factor); MdcGetSafeString(mdcbufr,mh->data_units,32,32); MdcPrntScrn("data_units : %s\n",mdcbufr); MdcPrntScrn("septa_state : %hd\n",mh->septa_state); for (i=0; i<6; i++) MdcPrntScrn("fill_cti[%d] : %hd\n",i,mh->fill_cti[i]); } void MdcEcatPrintImgSubHdr(Mdc_Image_subheader7 *ish, int nr) { MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("ECAT7 Image Sub Header %05d (%d bytes)\n",nr,ISH_72_SIZE); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("data_type : %hd\n",ish->data_type); MdcPrntScrn("num_dimensions : %hd\n",ish->num_dimensions); MdcPrntScrn("x_dimension : %hd\n",ish->x_dimension); MdcPrntScrn("y_dimension : %hd\n",ish->y_dimension); MdcPrntScrn("z_dimension : %hd\n",ish->z_dimension); MdcPrntScrn("x_offset : %f [cm]\n",ish->x_offset); MdcPrntScrn("y_offset : %f [cm]\n",ish->y_offset); MdcPrntScrn("z_offset : %f [cm]\n",ish->z_offset); MdcPrntScrn("recon_zoom : %f\n",ish->recon_zoom); MdcPrntScrn("scale_factor : %e\n",ish->scale_factor); MdcPrntScrn("image_min : %hd\n",ish->image_min); MdcPrntScrn("image_max : %hd\n",ish->image_max); MdcPrntScrn("x_pixel_size : %f [cm]\n",ish->x_pixel_size); MdcPrntScrn("y_pixel_size : %f [cm]\n",ish->y_pixel_size); MdcPrntScrn("z_pixel_size : %f [cm]\n",ish->z_pixel_size); MdcPrntScrn("frame_duration : %d [ms]\n",ish->frame_duration); MdcPrntScrn("frame_start_time : %d [ms]\n",ish->frame_start_time); MdcPrntScrn("filter_code : %hd\n",ish->filter_code); MdcPrntScrn("x_resolution : %g\n",ish->x_resolution); MdcPrntScrn("y_resolution : %g\n",ish->y_resolution); MdcPrntScrn("z_resolution : %g\n",ish->z_resolution); MdcPrntScrn("num_r_elements : %g\n",ish->num_r_elements); MdcPrntScrn("num_angles : %g\n",ish->num_angles); MdcPrntScrn("z_rotation_angle ; %g\n",ish->z_rotation_angle); MdcPrntScrn("decay_corr_fctr : %g\n",ish->decay_corr_fctr); MdcPrntScrn("processing_code : %d\n",ish->processing_code); MdcPrntScrn("gate_duration : %u\n",ish->gate_duration); MdcPrntScrn("r_wave_offset : %d\n",ish->r_wave_offset); MdcPrntScrn("num_accepted_beats : %d\n",ish->num_accepted_beats); MdcPrntScrn("filter_cutoff_frequency : %g\n",ish->filter_cutoff_frequency); MdcPrntScrn("filter_resolution : %g\n",ish->filter_resolution); MdcPrntScrn("filter_ramp_slope : %g\n",ish->filter_ramp_slope); MdcPrntScrn("filter_order : %hd\n",ish->filter_order); MdcPrntScrn("filter_scatter_fraction : %g\n",ish->filter_scatter_fraction); MdcPrntScrn("filter_scatter_slope : %g\n",ish->filter_scatter_slope); MdcGetSafeString(mdcbufr,ish->annotation,40,40); MdcPrntScrn("annotation : %s\n",mdcbufr); MdcPrntScrn("mt_1_1 : %g\n",ish->mt_1_1); MdcPrntScrn("mt_1_2 : %g\n",ish->mt_1_2); MdcPrntScrn("mt_1_3 : %g\n",ish->mt_1_3); MdcPrntScrn("mt_2_1 : %g\n",ish->mt_2_1); MdcPrntScrn("mt_2_2 : %g\n",ish->mt_2_2); MdcPrntScrn("mt_2_3 : %g\n",ish->mt_2_3); MdcPrntScrn("mt_3_1 : %g\n",ish->mt_3_1); MdcPrntScrn("mt_3_2 : %g\n",ish->mt_3_2); MdcPrntScrn("mt_3_3 : %g\n",ish->mt_3_3); MdcPrntScrn("rfilter_cutoff : %g\n",ish->rfilter_cutoff); MdcPrntScrn("rfilter_resolution : %g\n",ish->rfilter_resolution); MdcPrntScrn("rfilter_code : %hd\n",ish->rfilter_code); MdcPrntScrn("rfilter_order : %hd\n",ish->rfilter_order); MdcPrntScrn("zfilter_cutoff : %g\n",ish->zfilter_cutoff); MdcPrntScrn("zfilter_resolution : %g\n",ish->zfilter_resolution); MdcPrntScrn("zfilter_code : %hd\n",ish->zfilter_code); MdcPrntScrn("zfilter_order : %hd\n",ish->zfilter_order); MdcPrntScrn("mt_1_4 : %g\n",ish->mt_1_4); MdcPrntScrn("mt_2_4 : %g\n",ish->mt_2_4); MdcPrntScrn("mt_3_4 : %g\n",ish->mt_3_4); MdcPrntScrn("scatter_type : %hd\n",ish->scatter_type); MdcPrntScrn("recon_type : %hd\n",ish->recon_type); MdcPrntScrn("recon_views : %hd\n",ish->recon_views); MdcPrntScrn("fill_cti[87] : \n"); MdcPrntScrn("fill_user[48] : \n"); } void MdcEcatPrintAttnSubHdr(Mdc_Attn_subheader7 *ash, int nr) { int i; MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("ECAT7 Attenuation Sub Header %05d (%d bytes)\n",nr,ASH_72_SIZE); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("data_type : %hd\n",ash->data_type); MdcPrntScrn("num_dimensions : %hd\n",ash->num_dimensions); MdcPrntScrn("attenuation_type : %hd\n",ash->attenuation_type); MdcPrntScrn("num_r_elements : %hd\n",ash->num_r_elements); MdcPrntScrn("num_angles : %hd\n",ash->num_angles); MdcPrntScrn("num_z_elements : %hd\n",ash->num_z_elements); MdcPrntScrn("ring_difference : %hd\n",ash->ring_difference); MdcPrntScrn("x_resolution : %g [cm]\n",ash->x_resolution); MdcPrntScrn("y_resolution : %g [cm]\n",ash->y_resolution); MdcPrntScrn("z_resolution : %g [cm]\n",ash->z_resolution); MdcPrntScrn("w_resolution : %g\n",ash->w_resolution); MdcPrntScrn("scale_factor : %e\n",ash->scale_factor); MdcPrntScrn("x_offset : %g [cm]\n",ash->x_offset); MdcPrntScrn("y_offset : %g [cm]\n",ash->y_offset); MdcPrntScrn("x_radius : %g [cm]\n",ash->x_radius); MdcPrntScrn("y_radius : %g [cm]\n",ash->y_radius); MdcPrntScrn("tilt_angle : %g [degrees]\n",ash->tilt_angle); MdcPrntScrn("attenuation_coeff : %g [1/cm]\n",ash->attenuation_coeff); MdcPrntScrn("attenuation_min : %g\n",ash->attenuation_min); MdcPrntScrn("attenuation_max : %g\n",ash->attenuation_max); MdcPrntScrn("skull_thickness : %g [cm]\n",ash->skull_thickness); MdcPrntScrn("num_xtra_atten_coeff : %hd\n",ash->num_xtra_atten_coeff); for (i=0; i<8; i++) MdcPrntScrn("xtra_atten_coeff[%d] : %g\n",i,ash->xtra_atten_coeff[i]); MdcPrntScrn("edge_finding_threshold : %g\n",ash->edge_finding_threshold); MdcPrntScrn("storage_order : %hd\n",ash->storage_order); MdcPrntScrn("span : %hd\n",ash->span); for (i=0; i<64; i++) MdcPrntScrn("z_elements[%2d] : %hd\n",i,ash->z_elements[i]); MdcPrntScrn("fill_unused[86] : \n"); MdcPrntScrn("fill_user[50] : \n"); } void MdcEcatPrintScanSubHdr(Mdc_Scan_subheader7 *ssh) { MdcPrntScrn("data_type : %hd\n",ssh->data_type); MdcPrntScrn("num_dimensions : %hd\n",ssh->num_dimensions); MdcPrntScrn("num_r_elements : %hd\n",ssh->num_r_elements); MdcPrntScrn("num_angles : %hd\n",ssh->num_angles); MdcPrntScrn("corrections_applied : %hd\n",ssh->corrections_applied); MdcPrntScrn("num_z_elements : %hd\n",ssh->num_z_elements); MdcPrntScrn("ring_difference : %hd\n",ssh->ring_difference); MdcPrntScrn("x_resolution : %g [cm]\n",ssh->x_resolution); MdcPrntScrn("y_resolution : %g [cm]\n",ssh->y_resolution); MdcPrntScrn("z_resolution : %g [cm]\n",ssh->z_resolution); MdcPrntScrn("w_resolution : %g\n",ssh->w_resolution); MdcPrntScrn("fill[6] : \n"); MdcPrntScrn("gate_duration : %u [ms]\n",ssh->gate_duration); MdcPrntScrn("r_wave_offset : %d [ms]\n",ssh->r_wave_offset); MdcPrntScrn("num_accepted_beats : %d\n",ssh->num_accepted_beats); MdcPrntScrn("scale_factor : %e\n",ssh->scale_factor); MdcPrntScrn("scan_min : %hd\n",ssh->scan_min); MdcPrntScrn("scan_max : %hd\n",ssh->scan_max); MdcPrntScrn("prompts : %d\n",ssh->prompts); MdcPrntScrn("delayed : %d\n",ssh->delayed); MdcPrntScrn("multiples : %d\n",ssh->multiples); MdcPrntScrn("net_trues : %d\n",ssh->net_trues); MdcPrntScrn("cor_singles[16] : \n"); MdcPrntScrn("uncor_singles[16] : \n"); MdcPrntScrn("tot_avg_cor : %g\n",ssh->tot_avg_cor); MdcPrntScrn("tot_avg_uncor : %g\n",ssh->tot_avg_uncor); MdcPrntScrn("total_coin_rate : %d\n",ssh->total_coin_rate); MdcPrntScrn("frame_start_time : %u\n",ssh->frame_start_time); MdcPrntScrn("frame_duration : %u\n",ssh->frame_duration); MdcPrntScrn("deadtime_correction_factor: %g\n" ,ssh->deadtime_correction_factor); MdcPrntScrn("phy_planes[8] : \n"); MdcPrntScrn("cti_fill[90] : \n"); MdcPrntScrn("user_fill[50] : \n"); } void MdcEcatPrintNormSubHdr(Mdc_Norm_subheader7 *nsh) { MdcPrntScrn("data_type : %hd\n",nsh->data_type); MdcPrntScrn("num_dimensions : %hd\n",nsh->num_dimensions); MdcPrntScrn("num_r_elements : %hd\n",nsh->num_r_elements); MdcPrntScrn("num_angles : %hd\n",nsh->num_angles); MdcPrntScrn("num_z_elements : %hd\n",nsh->num_z_elements); MdcPrntScrn("ring_difference : %hd\n",nsh->ring_difference); MdcPrntScrn("scale_factor : %e\n",nsh->scale_factor); MdcPrntScrn("norm_min : %g\n",nsh->norm_min); MdcPrntScrn("norm_max : %g\n",nsh->norm_max); MdcPrntScrn("fov_source_width : %g\n",nsh->fov_source_width); MdcPrntScrn("norm_quality_factor : %g\n",nsh->norm_quality_factor); MdcPrntScrn("norm_quality_factor_code : %hd\n",nsh->norm_quality_factor_code); MdcPrntScrn("storage_order : %hd\n",nsh->storage_order); MdcPrntScrn("span : %hd\n",nsh->span); MdcPrntScrn("z_elements[64] : \n"); MdcPrntScrn("cti_fill[123] : \n"); MdcPrntScrn("user_fill[50] : \n"); } const char *MdcReadECAT7(FILEINFO *fi) { FILE *fp = fi->ifp; int i, error/*, UNSUPPORTED*/; const char *err; char *str; struct tm time, *ptime; Mdc_Main_header7 mh; Mdc_Image_subheader7 ish; Mdc_Attn_subheader7 ash; /* Mdc_Scan_subheader7 ssh; Mdc_Norm_subheader7 nsh; */ struct Mdc_MatDir entry, matrix_list[MDC_ECAT7_MAX_MATRICES]; struct Mdc_Matval matval; Uint32 number, slice, img=0, vol=0, bytes; Uint32 group=0, group_slice, skip_bytes=0, row, rbytes; int bed,gate,frame,plane,nb,ng,nf,np,nd; int matnum, startblk, endblk, num_matrices; IMG_DATA *id; DYNAMIC_DATA *dd=NULL; Int16 bits, type; Uint8 *mbufr, *pmbufr, *pbuf; float slice_position; if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Reading ECAT7:"); if (MDC_VERBOSE) MdcPrntMesg("ECAT7 Reading <%s> ...",fi->ifname); /* put some defaults we use */ fi->endian=MDC_FILE_ENDIAN=MDC_BIG_ENDIAN; fi->modality = M_PT; error = mdc_mat_read_main_header7(fp, &mh); if (error) return("ECAT7 Bad read main header"); if (MDC_INFO || MDC_INFO_DB) MdcEcatPrintMainHdr(&mh); if (MDC_INFO_DB) return(NULL); /* just needed db info */ /* check for supported file types * switch (mh.file_type) { case MDC_ECAT7_FILE_TYPE_IMAGE16 : case MDC_ECAT7_FILE_TYPE_VOLUME8 : case MDC_ECAT7_FILE_TYPE_VOLUME16: case MDC_ECAT7_FILE_TYPE_IMAGE8 : UNSUPPORTED = MDC_NO; break; default: UNSUPPORTED = MDC_YES; }*/ /* if (UNSUPPORTED == MDC_YES) return("ECAT7 Unsupported file type"); */ if (mh.num_frames <= 0 ) mh.num_frames = 1; if (mh.num_gates <= 0 ) mh.num_gates = 1; if (mh.num_bed_pos < 0 ) mh.num_bed_pos = 0; /* fill in global FILEINFO data */ fi->dim[0]= 6; fi->dim[3]= mh.num_planes; fi->dim[4]= mh.num_frames; fi->dim[5]= mh.num_gates; fi->dim[6]= mh.num_bed_pos + 1; /* must be 1-based */ /* check for unsupported bed overlap */ if (fi->dim[6] > 1) { float axial_width, bed_offset=mh.bed_position[0]; if (bed_offset < 0) bed_offset = -bed_offset; axial_width = mh.plane_separation * (float)fi->dim[3]; if ((axial_width - bed_offset) >= 1.0) { MdcPrntWarn("ECAT7 Bed overlaps unsupported"); } } for (i=3, number=1; i<=6; i++) number*=fi->dim[i]; if (number == 0) return("ECAT7 No valid images specified"); /* fill in orientation information */ switch (mh.patient_orientation) { case MDC_ECAT7_FEETFIRST_PRONE: fi->pat_slice_orient = MDC_PRONE_FEETFIRST_TRANSAXIAL; break; case MDC_ECAT7_HEADFIRST_PRONE: fi->pat_slice_orient = MDC_PRONE_HEADFIRST_TRANSAXIAL; break; case MDC_ECAT7_FEETFIRST_SUPINE: fi->pat_slice_orient = MDC_SUPINE_FEETFIRST_TRANSAXIAL; break; case MDC_ECAT7_HEADFIRST_SUPINE: fi->pat_slice_orient = MDC_SUPINE_HEADFIRST_TRANSAXIAL; break; case MDC_ECAT7_FEETFIRST_RIGHT: fi->pat_slice_orient = MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL; break; case MDC_ECAT7_HEADFIRST_RIGHT: fi->pat_slice_orient = MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL; break; case MDC_ECAT7_FEETFIRST_LEFT: fi->pat_slice_orient = MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL; break; case MDC_ECAT7_HEADFIRST_LEFT: fi->pat_slice_orient = MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL; break; default: fi->pat_slice_orient = MDC_SUPINE_HEADFIRST_TRANSAXIAL; MdcPrntWarn("ECAT7 unknown patient orientation"); } str = MdcGetStrPatPos(fi->pat_slice_orient); MdcStringCopy(fi->pat_pos,str,strlen(str)); str = MdcGetStrPatOrient(fi->pat_slice_orient); MdcStringCopy(fi->pat_orient,str,strlen(str)); /* fill in patient study related information */ switch (mh.patient_sex[0]) { case 0: fi->patient_sex[0] = 'M'; break; case 1: fi->patient_sex[0] = 'F'; break; default: fi->patient_sex[0] = 'U'; } fi->patient_sex[1]='\0'; MdcStringCopy(fi->patient_name,mh.patient_name,32); MdcStringCopy(fi->patient_id,mh.patient_id,16); fi->patient_height = mh.patient_height; fi->patient_weight = mh.patient_weight; ptime = &time; #ifdef HAVE_LOCALTIME_R localtime_r((time_t *)&(mh.patient_birth_date), ptime); #else ptime = localtime((time_t *)&(mh.patient_birth_date)); #endif if (ptime == NULL) { MdcPrntWarn("ECAT7: Couldn't resolve patient birth date"); strcpy(fi->patient_dob,"00000000"); }else{ sprintf(fi->patient_dob,"%.4d%.2d%.2d",ptime->tm_year + 1900 ,ptime->tm_mon + 1 ,ptime->tm_mday); } ptime = &time; #ifdef HAVE_LOCALTIME_R localtime_r((time_t *)&(mh.scan_start_time), ptime); #else ptime = localtime((time_t *)&(mh.scan_start_time)); #endif if (ptime == NULL) { MdcPrntWarn("ECAT7: Couldn't resolve scan start time"); fi->study_date_day = 0; fi->study_date_month = 1; fi->study_date_year = 1900; fi->study_time_hour = 0; fi->study_time_minute= 0; fi->study_time_second= 0; }else{ fi->study_date_day = ptime->tm_mday; fi->study_date_month = ptime->tm_mon + 1; fi->study_date_year = ptime->tm_year + 1900; fi->study_time_hour = ptime->tm_hour; fi->study_time_minute= ptime->tm_min; fi->study_time_second= ptime->tm_sec; } switch (mh.acquisition_type) { case MDC_ECAT7_SCAN_TRANSMISSION: case MDC_ECAT7_SCAN_STATIC_EMISSION: fi->acquisition_type = MDC_ACQUISITION_TOMO; break; case MDC_ECAT7_SCAN_DYNAMIC_EMISSION: fi->acquisition_type = MDC_ACQUISITION_DYNAMIC; break; case MDC_ECAT7_SCAN_GATED_EMISSION: fi->acquisition_type = MDC_ACQUISITION_GSPECT; break; case MDC_ECAT7_SCAN_BLANK: case MDC_ECAT7_SCAN_TRANS_RECTILINEAR: case MDC_ECAT7_SCAN_EMISSION_RECTILINEAR: default: fi->acquisition_type = MDC_ACQUISITION_UNKNOWN; break; } sprintf(mdcbufr,"ECAT%hd",mh.system_type); MdcStringCopy(fi->manufacturer,mdcbufr,strlen(mdcbufr)); MdcStringCopy(fi->operator_name,mh.operator_name,32); MdcStringCopy(fi->study_descr,mh.study_description,32); MdcStringCopy(fi->study_id,mh.study_type,12); MdcStringCopy(fi->institution,mh.facility_name,20); MdcStringCopy(fi->radiopharma,mh.radiopharmaceutical,32); MdcStringCopy(fi->isotope_code,mh.isotope_name,8); fi->isotope_halflife = mh.isotope_halflife; fi->injected_dose = MdcmCi2MBq(mh.dosage); fi->gantry_tilt = mh.gantry_tilt; if (MDC_ECHO_ALIAS == MDC_YES) { MdcEchoAliasName(fi); return(NULL); } if (!MdcGetStructID(fi,number)) return("ECAT7 Bad malloc IMG_DATA structs"); /* always malloc dyndata structs */ if (!MdcGetStructDD(fi,(Uint32)fi->dim[4]*fi->dim[5]*fi->dim[6])) return("ECAT7 Couldn't malloc DYNAMIC_DATA structs"); /* ECAT7: matrices for each volume */ num_matrices = mdc_mat_list7(fp, matrix_list, MDC_ECAT7_MAX_MATRICES); if (num_matrices == 0) return("ECAT7 No matrices found"); if ((Uint32)num_matrices > (fi->number / fi->dim[3])) return("ECAT7 Too many matrices found"); if (MDC_MY_DEBUG) { int t; MdcDebugPrint("%d.%d.%d.%d",fi->dim[3] ,fi->dim[4] ,fi->dim[5] ,fi->dim[6]); for (t=0; tdim[6]; bed++) for (gate=1; gate<=fi->dim[5]; gate++) for (frame=1; frame<=fi->dim[4]; frame++, vol++) for (plane=1; plane<=fi->dim[3]; ) { if (vol == num_matrices) break; if (fi->dynnr > 0) dd = &fi->dyndata[(fi->dim[4]*bed) + (frame-1)]; mdc_mat_numdoc(matrix_list[vol].matnum,&matval); nf = matval.frame; np = matval.plane; ng = matval.gate; nb = matval.bed; nd = matval.data; matnum = mdc_mat_numcod(nf,np,ng,nd,nb); MdcDebugPrint("matnum = %d",matnum); if (!mdc_mat_lookup7(fp, matnum, &entry)) continue; startblk = entry.strtblk + 1; endblk = entry.endblk - entry.strtblk; MdcDebugPrint("entry.endblk = %d",entry.endblk); MdcDebugPrint("entry.strtblk= %d",entry.strtblk); MdcDebugPrint("startblk = %d",startblk); MdcDebugPrint("endblk = %d",endblk); switch (mh.file_type) { case MDC_ECAT7_FILE_TYPE_IMAGE8 : case MDC_ECAT7_FILE_TYPE_IMAGE16 : case MDC_ECAT7_FILE_TYPE_VOLUME8 : case MDC_ECAT7_FILE_TYPE_VOLUME16: error = mdc_mat_read_image_subheader7(fp, startblk-1, &ish); if (error) return("ECAT7 Bad read image subheader"); if (MDC_INFO) MdcEcatPrintImgSubHdr(&ish, (int)(vol + 1)); fi->dim[1] = ish.x_dimension; fi->dim[2] = ish.y_dimension; #if MDC_NUM_PLANES_FIX if ((mh.num_planes != ish.z_dimension) && (vol == 0)) { MdcPrntWarn("ECAT7 Fix wrong num_planes value"); mh.num_planes = ish.z_dimension; fi->dim[3] = ish.z_dimension; for (i=3, number=1; i<=6; i++) number*=fi->dim[i]; if (!MdcGetStructID(fi,number)) return("ECAT7 Bad realloc IMG_DATA structs"); } #endif switch (ish.data_type) { case BYTE_TYPE: bits = 8; type = BIT8_U; break; case VAX_I2: case SUN_I2: bits = 16; type = BIT16_S; break; case VAX_I4: case SUN_I4: bits = 32; type = BIT32_S; break; case VAX_R4: case IEEE_R4: bits = 32; type = FLT32; break; default: return("ECAT7: Unsupported data type"); } /* fill in DYNAMIC_DATA structs */ if ((dd != NULL) && (plane == 1)) { /* just one subheader */ dd->nr_of_slices = fi->dim[3]; dd->time_frame_start = (float)ish.frame_start_time; dd->time_frame_duration = (float)ish.frame_duration; } /* bytes entire volume (matrix blocks) */ bytes = fi->dim[1] * fi->dim[2] * fi->dim[3] * MdcType2Bytes(type); MdcDebugPrint("volume: %d bytes",bytes); bytes = MdcMatrixBlocks(bytes); MdcDebugPrint("matrix: %d bytes",bytes); mbufr = malloc(bytes); if (mbufr == NULL) return("ECAT7 Bad malloc image matrix data buffer"); error = mdc_mat_read_mat_data(fp,startblk,endblk,mbufr,ish.data_type); if (error) { MdcPrntWarn("ECAT7 Bad read image matrix data"); err=MdcHandleTruncated(fi,img+1,MDC_YES); if(err != NULL) { MdcFree(mbufr); return(err); } } if (fi->truncated) break; /* bytes each image */ bytes = fi->dim[1] * fi->dim[2] * MdcType2Bytes(type); for (slice=0; slice < fi->dim[3]; slice++, img++, plane++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); /* fill in IMG_DATA struct */ id = &fi->image[img]; id->width = fi->dim[1]; id->height= fi->dim[2]; id->bits = bits; id->type = type; id->quant_units = 1; id->quant_scale = ish.scale_factor; id->calibr_units = mh.calibration_units; id->calibr_fctr = mh.ecat_calibration_factor; id->pixel_xsize = ish.x_pixel_size * 10.0; /* mm */ id->pixel_ysize = ish.y_pixel_size * 10.0; /* mm */ id->slice_width = ish.z_pixel_size * 10.0; /* mm */ id->slice_spacing = id->slice_width; /* slice position with bed offset (mm) */ if (bed == 0) { slice_position = mh.init_bed_position; }else{ slice_position = mh.init_bed_position + mh.bed_position[bed-1]; } slice_position *= 10.; /* mm */ MdcFillImgPos(fi,img,slice,slice_position); MdcFillImgOrient(fi,img); id->buf = MdcGetImgBuffer(bytes); if (id->buf == NULL) { MdcFree(mbufr); return("ECAT7 Bad malloc image buffer"); } memcpy(id->buf, mbufr + (bytes*slice), bytes); } MdcFree(mbufr); break; case MDC_ECAT7_FILE_TYPE_ATTNCORR: error = mdc_mat_read_attn_subheader7(fp, startblk-1, &ash); if (error) return("ECAT7 Bad read attenuation subheader"); if (MDC_INFO) MdcEcatPrintAttnSubHdr(&ash, (int)(vol + 1)); fi->dim[1] = ash.num_r_elements; fi->dim[2] = ash.num_angles; /* MARK: just retrieve group0 */ /* fi->dim[3] = ash.num_z_elements; */ /* MARK: or retrieve all */ fi->dim[3] = 0; for (i=0; ash.z_elements[i]; i++) fi->dim[3] += ash.z_elements[i]; for (i=3, number=1; i<=6; i++) number*=fi->dim[i]; if (!MdcGetStructID(fi,number)) return("ECAT7 Bad realloc IMG_DATA structs"); switch (ash.data_type) { case BYTE_TYPE: bits = 8; type = BIT8_U; break; case VAX_I2: case SUN_I2: bits = 16; type = BIT16_S; break; case VAX_I4: case SUN_I4: bits = 32; type = BIT32_S; break; case VAX_R4: case IEEE_R4: bits = 32; type = FLT32; break; default: return("ECAT7: Unsupported data type"); } /* bytes entire volume (matrix blocks) */ bytes = fi->dim[1] * fi->dim[2] * fi->dim[3] * MdcType2Bytes(type); MdcDebugPrint("volume: %d bytes",bytes); bytes = MdcMatrixBlocks(bytes); MdcDebugPrint("matrix: %d bytes",bytes); mbufr = malloc(bytes); if (mbufr == NULL) return("ECAT7 Bad malloc attenuation matrix data buffer"); endblk = startblk + (bytes / MdcMatBLKSIZE) - 1; error = mdc_mat_read_mat_data(fp,startblk,endblk,mbufr,ash.data_type); if (error) { MdcPrntWarn("ECAT7 Bad read attenuation matrix data"); err=MdcHandleTruncated(fi,img+1,MDC_YES); if(err != NULL) { MdcFree(mbufr); return(err); } } if (fi->truncated) break; /* bytes each image */ bytes = fi->dim[1] * fi->dim[2] * MdcType2Bytes(type); group_slice=0; for (slice=0; slice < fi->dim[3]; slice++, img++, plane++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); /* fill in IMG_DATA struct */ id = &fi->image[img]; id->width = fi->dim[1]; id->height= fi->dim[2]; id->bits = bits; id->type = type; id->quant_units = 1; id->quant_scale = ash.scale_factor; id->calibr_units = mh.calibration_units; id->calibr_fctr = mh.ecat_calibration_factor; id->pixel_xsize = ash.x_resolution * 10.0; /* mm */ id->pixel_ysize = ash.y_resolution * 10.0; /* mm */ id->slice_width = ash.z_resolution * 10.0; /* mm */ id->slice_spacing = id->slice_width; /* slice position with bed offset (mm) */ if (bed == 0) { slice_position = mh.init_bed_position; }else{ slice_position = mh.init_bed_position + mh.bed_position[bed-1]; } slice_position *= 10.; /* mm */ MdcFillImgPos(fi,img,slice,slice_position); MdcFillImgOrient(fi,img); id->buf = MdcGetImgBuffer(bytes); if (id->buf == NULL) { MdcFree(mbufr); return("ECAT7 Bad malloc image buffer"); } /* copy date */ if (ash.storage_order == 0) { /* view mode: for the first group of z_elements we have */ /* all 1st rows, all 2nd rows, etc. Then follows */ /* same storage for next group of z_elements, */ /* at least we think */ /* MARK: still not proper for all groups, actually only 1st ok*/ rbytes = fi->dim[1] * MdcType2Bytes(type); if (group_slice == ash.z_elements[group] ) { skip_bytes += ash.z_elements[group] * bytes; group += 1; group_slice = 0; } pmbufr = mbufr + skip_bytes + group_slice * rbytes; /* MARK */ /* MARK printf("DEBUG: skip_bytes(%u) + group_slice(%u) * rbytes (%u) = %u\n",skip_bytes,group_slice,rbytes,skip_bytes+group_slice*rbytes); */ for (row=0; row < fi->dim[2]; row++) { pbuf = id->buf+(rbytes * row); memcpy(pbuf, pmbufr, rbytes); pmbufr += ash.z_elements[group] * rbytes; } }else{ /* sinogram mode: fine, just copy */ memcpy(id->buf, mbufr + (bytes*slice), bytes); } group_slice++; } MdcFree(mbufr); break; default: return("ECAT7 Unsupported file type"); } } /* set remaing FILEINFO data */ id = &fi->image[0]; fi->bits = id->bits; fi->type = id->type; fi->pixdim[0] = 3; fi->pixdim[1] = id->pixel_xsize; fi->pixdim[2] = id->pixel_ysize; fi->pixdim[3] = id->slice_width; switch (mh.file_type) { case MDC_ECAT7_FILE_TYPE_IMAGE8 : case MDC_ECAT7_FILE_TYPE_IMAGE16 : case MDC_ECAT7_FILE_TYPE_VOLUME8 : case MDC_ECAT7_FILE_TYPE_VOLUME16: fi->reconstructed = MDC_YES; if (ish.decay_corr_fctr > 1.0) fi->decay_corrected = MDC_YES; break; default: fi->reconstructed = MDC_NO; } MdcCloseFile(fi->ifp); if (fi->truncated) return("ECAT7 Truncated image file"); return(NULL); } #if MDC_INCLUDE_TPC /*! * Converts FILEINFO structure and MDC mainheader to TPC ecat7 mainheader * * @param mh pointer to MDC mainheader * @param h pointer to TPC imageheader * @param image_i image index number [0..fi->number-1] * @param frame_i frame index number [0..fi->dim[4]-1] */ int MdcConvertToTPCEcat7image(FILEINFO* fi, ECAT7_imageheader* h, int image_i, int frame_i) { int i = 0; /* short int <- ECAT7_SUNI2 (must be for matrix writing) */ h->data_type = ECAT7_SUNI2; h->num_dimensions = fi->dim[0]; switch (fi->pat_slice_orient) { #if MDC_TPC_SITE case MDC_SAGITTAL: /* short int <- Int16 */ h->x_dimension = fi->dim[3]; h->y_dimension = fi->dim[2]; h->z_dimension = fi->dim[1]; /* float <- ??? */ h->x_offset = 0; h->y_offset = 0; h->z_offset = 0; h->x_pixel_size = fi->pixdim[3]/10; h->y_pixel_size = fi->pixdim[2]/10; h->z_pixel_size = fi->pixdim[1]/10; /* float <- ??? */ h->x_resolution = 0.0f; h->y_resolution = 0.0f; h->z_resolution = 0.0f; break; case MDC_CORONAL: /* short int <- Int16 */ h->x_dimension = fi->dim[1]; h->y_dimension = fi->dim[3]; h->z_dimension = fi->dim[2]; /* float <- ??? */ h->x_offset = 0; h->y_offset = 0; h->z_offset = 0; h->x_pixel_size = fi->pixdim[1]/10; h->y_pixel_size = fi->pixdim[3]/10; h->z_pixel_size = fi->pixdim[2]/10; /* float <- ??? */ h->x_resolution = 0.0f; h->y_resolution = 0.0f; h->z_resolution = 0.0f; break; #endif default: /* short int <- Int16 */ h->x_dimension = fi->dim[1]; h->y_dimension = fi->dim[2]; h->z_dimension = fi->dim[3]; /* float <- ??? */ h->x_offset = 0; h->y_offset = 0; h->z_offset = 0; h->x_pixel_size = fi->pixdim[1]/10; h->y_pixel_size = fi->pixdim[2]/10; h->z_pixel_size = fi->pixdim[3]/10; /* float <- ??? */ h->x_resolution = 0.0f; h->y_resolution = 0.0f; h->z_resolution = 0.0f; break; } if (fi->image) { /* eNlf: MARK - leave out for now, currently no slice_location in IMG_DATA switch(fi->pat_slice_orient) { #if MDC_TPC_SITE case MDC_SAGITTAL: if(fi->dim[3] > 1 && fabs(fi->image[fi->number-1].slice_location - fi->image[0].slice_location) != 0) h->x_pixel_size = fabs(fi->image[fi->number-1].slice_location - fi->image[0].slice_location)/((fi->dim[3]-1)*10.0f); else h->x_pixel_size = fi->image[0].slice_width/10; break; case MDC_CORONAL: if(fi->dim[3] > 1 && fabs(fi->image[fi->number-1].slice_location - fi->image[0].slice_location) != 0) h->y_pixel_size = fabs(fi->image[fi->number-1].slice_location - fi->image[0].slice_location)/((fi->dim[3]-1)*10.0f); else h->y_pixel_size = fi->image[0].slice_width/10; break; #endif default: if(fi->dim[3] > 1 && fabs(fi->image[fi->number-1].slice_location - fi->image[0].slice_location) != 0) h->z_pixel_size = fabs(fi->image[fi->number-1].slice_location - fi->image[0].slice_location)/((fi->dim[3]-1)*10.0f); else h->z_pixel_size = fi->image[0].slice_width/10; } */ h->recon_zoom = fi->image[image_i].recon_scale; if (fi->image[image_i].rescaled) { h->scale_factor = fi->image[image_i].rescaled_fctr; }else{ h->scale_factor = 1.; } /* short int <- double */ h->image_min = fi->image[image_i].min; h->image_max = fi->image[image_i].max; } if (fi->dyndata && frame_i < fi->dynnr) { /* int <- float (ms) */ h->frame_duration = fi->dyndata[frame_i].time_frame_duration; /* int <- float (ms) */ h->frame_start_time = fi->dyndata[frame_i].time_frame_start; } /* short int <- ??? */ h->filter_code = 0; /* float <- ??? */ h->num_r_elements = 0; /* float <- ??? */ h->num_angles = 0.0f; /* float <- ??? */ h->z_rotation_angle = 0.0f; /* float <- ??? */ h->decay_corr_fctr = 0.0f; /* int <- ??? */ h->processing_code = 0; if (fi->gdata) { /* int <- float (ms) */ h->gate_duration = fi->gdata->image_duration; /* int <- float (ms) */ h->r_wave_offset = fi->gdata->window_low; h->num_accepted_beats = fi->gdata->cycles_acquired; } /* float <- ??? */ h->filter_cutoff_frequency = 0.0f; /* float <- ??? */ h->filter_resolution = 0.0f; /* float <- ??? */ h->filter_ramp_slope = 0.0f; /* short int <- ??? */ h->filter_order = 0; /* float <- ??? */ h->filter_scatter_fraction = 0.0f; /* float <- ??? */ h->filter_scatter_slope = 0.0f; /* char annotation[40]; */ /* float <- ??? */ h->mt_1_1 = 0.0f; /* float <- ??? */ h->mt_1_2 = 0.0f; /* float <- ??? */ h->mt_1_3 = 0.0f; /* float <- ??? */ h->mt_2_1 = 0.0f; /* float <- ??? */ h->mt_2_2 = 0.0f; /* float <- ??? */ h->mt_2_3 = 0.0f; /* float <- ??? */ h->mt_3_1 = 0.0f; /* float <- ??? */ h->mt_3_2 = 0.0f; /* float <- ??? */ h->mt_2_3 = 0.0f; /* float <- ??? */ h->rfilter_cutoff = 0.0f; /* float <- ??? */ h->rfilter_resolution = 0.0f; /* short int <- ??? */ h->rfilter_code = 0.0f; /* short int <- ??? */ h->rfilter_order = 0.0f; /* float <- ??? */ h->zfilter_cutoff = 0.0f; /* float <- ??? */ h->zfilter_resolution = 0.0f; /* short int <- ??? */ h->zfilter_code = 0; /* short int <- ??? */ h->zfilter_order = 0; /* float <- ??? */ h->mt_1_4 = 0.0f; /* float <- ??? */ h->mt_2_4 = 0.0f; /* float <- ??? */ h->mt_3_4 = 0.0f; /* short int <- ??? */ h->scatter_type = 0; /* short int <- ??? */ h->recon_type = 0; /* short int <- ??? */ h->recon_views = 0; /* short int <- ??? */ for(i = 0; i < 87; i++) h->fill_cti[i] = 0; /* short int <- ??? */ for(i = 0; i < 49; i++) h->fill_user[i] = 0; return 0; } /*! * Converts FILEINFO structure and MDC mainheader to TPC ecat7 mainheader * * @param fi file structure * @param mh pointer to MDC mainheader * @param h pointer to TPC mainheader */ int MdcConvertToTPCEcat7(FILEINFO* fi, Mdc_Main_header* mh, ECAT7_mainheader* h) { struct tm timeinfo; int i = 0; char number[5]; /* use default ecat7 magic number */ strncpy(h->magic_number, ECAT7V_MAGICNR,14); strncpy(h->original_file_name,mh->original_file_name,20); h->sw_version = 72; /* short int <- Int16 */ h->system_type = mh->system_type; /* short int <- ECAT7_VOLUME16 */ h->file_type = ECAT7_VOLUME16; strncpy(h->serial_number,"unknown",10); /* int <- Int16 Int16 Int16 Int16 */ memset((void *)&timeinfo,0,sizeof(timeinfo)); timeinfo.tm_year = mh->scan_start_year-1900; timeinfo.tm_mon = mh->scan_start_month-1; timeinfo.tm_mday = mh->scan_start_day; timeinfo.tm_hour = mh->scan_start_hour; timeinfo.tm_min = mh->scan_start_minute; timeinfo.tm_sec = mh->scan_start_second; timeinfo.tm_isdst= -1; h->scan_start_time = (unsigned int)mktime(&timeinfo); strncpy(h->isotope_name,fi->isotope_code,(8isotope_halflife = mh->isotope_halflife; strncpy(h->radiopharmaceutical, fi->radiopharma,(32gantry_tilt = mh->gantry_tilt; h->gantry_rotation = mh->gantry_rotation; h->bed_elevation = mh->bed_elevation; /* float <- ??? */ h->intrinsic_tilt = 0.0f; /* short int <- Int16 */ h->wobble_speed = mh->wobble_speed; /* short int <- Int16 */ h->transm_source_type = mh->transm_source_type; /* float <- ??? */ h->distance_scanned = 0.0f; h->transaxial_fov = mh->transaxial_fov; /* short int <- Int16 */ h->angular_compression = mh->compression_code; /* short int <- Int16 */ h->coin_samp_mode = mh->coin_samp_mode; /* short int <- Int16 */ h->axial_samp_mode = mh->axial_samp_mode; h->ecat_calibration_factor = 1.; /* eNlf: global, prefer scale per plane*/ /* short int <- Int16 */ h->calibration_units = mh->calibration_units; /* short int <- ??? */ h->calibration_units_label = 0; /* short int <- Int16 */ h->compression_code = mh->compression_code; strncpy(h->study_type,mh->study_name,12); strncpy(h->patient_id,mh->patient_id,16); strncpy(h->patient_name,mh->patient_name,32); switch (fi->patient_sex[0]) { case 'M': h->patient_sex = 0; break; case 'F': h->patient_sex = 1; break; default : h->patient_sex = 3; } h->patient_dexterity = mh->patient_dexterity; sscanf(mh->patient_age,"%f",&h->patient_age); h->patient_height = fi->patient_height; h->patient_weight = fi->patient_weight; /* patient_dob: YYYYMMDD -> tm_year, tm_mon, tm_day -> unsigned int*/ memset((void *)&timeinfo,0,sizeof(timeinfo)); /* YYYY */ memcpy(number,&fi->patient_dob[0],4); number[4]='\0'; timeinfo.tm_year = atoi(number) - 1900; /* MM */ memcpy(number,&fi->patient_dob[4],2); number[2]='\0'; timeinfo.tm_mon = atoi(number) - 1; /* DD */ memcpy(number,&fi->patient_dob[6],2); number[2]='\0'; timeinfo.tm_mday = atoi(number); h->patient_birth_date = (unsigned int)mktime(&timeinfo); strncpy(h->physician_name,mh->physician_name,32); strncpy(h->operator_name,mh->operator_name,32); strncpy(h->study_description,mh->study_description,32); /* short int <- Int16 */ h->acquisition_type = mh->acquisition_type; /* short int <- char[MDC_MAXSTR] */ h->patient_orientation = 0; if(strncmp(fi->pat_pos,"FFP",3) == 0) h->patient_orientation = 0; else if(strncmp(fi->pat_pos,"HFP",3) == 0) h->patient_orientation = 1; else if(strncmp(fi->pat_pos,"FFS",3) == 0) h->patient_orientation = 2; else if(strncmp(fi->pat_pos,"HFS",3) == 0) h->patient_orientation = 3; else if(strncmp(fi->pat_pos,"FFDR",4) == 0) h->patient_orientation = 4; else if(strncmp(fi->pat_pos,"HFDR",4) == 0) h->patient_orientation = 5; else if(strncmp(fi->pat_pos,"FFDL",4) == 0) h->patient_orientation = 6; else if(strncmp(fi->pat_pos,"HFDL",4) == 0) h->patient_orientation = 7; else MdcPrntWarn("Unrecognized patient position: %s\n",fi->pat_pos); #if MDC_TPC_SITE strncpy(h->facility_name,mh->original_file_name,20); #else strncpy(h->facility_name,fi->institution,20); #endif /* short int <- Int16 */ switch (fi->pat_slice_orient) { #if MDC_TPC_SITE case MDC_SAGITTAL: h->num_planes = fi->dim[1]; break; case MDC_CORONAL: h->num_planes = fi->dim[2]; break; #endif default: h->num_planes = fi->dim[3]; break; } /* short int <- Int16 */ h->num_frames = fi->dim[4]; /* short int <- Int16 */ h->num_gates = fi->dim[5]; /* short int (zero-based value) <- Int16 (one-based value) */ h->num_bed_pos = (fi->dim[6]>=1 ? fi->dim[6]-1 : 0); h->init_bed_position = mh->init_bed_position; for (i = 0; i < 15; i++) h->bed_position[i] = mh->bed_offset[i]; h->plane_separation = mh->plane_separation; /* short int <- Int16 */ h->lwr_sctr_thres = mh->lwr_sctr_thres; /* short int <- Int16 */ h->lwr_true_thres = mh->lwr_true_thres; /* short int <- Int16 */ h->upr_true_thres = mh->upr_true_thres; strncpy(h->user_process_code,mh->original_file_name,10); /* short int <- Int16 */ h->acquisition_mode = mh->acquisition_mode; /* float <- ?? */ h->bin_size = 0.0f; /* float <- ?? */ h->branching_fraction = 0.0f; /* int <- Int16 Int16 Int16 Int16 */ timeinfo.tm_year = fi->study_date_year-1900; timeinfo.tm_mon = fi->study_date_month-1; timeinfo.tm_mday = fi->study_date_day; timeinfo.tm_hour = fi->dose_time_hour; timeinfo.tm_min = fi->dose_time_minute; timeinfo.tm_sec = fi->dose_time_second; h->dose_start_time = (unsigned int)mktime(&timeinfo); h->dosage = MdcMBq2mCi(fi->injected_dose); /* float <- ?? */ h->well_counter_corr_factor = 0.0f; /* char[32] <- char[MDC_MAXSTR] */ strncpy(h->data_units,"unknown",32); /* eNlf: MARK - doesn't belong in modality XA if (fi->mod) { if ( strcmp(fi->mod->xa_info.Photo_Interp,"BQML") == 0 ) strncpy(h->data_units,"kBq/ml",32); } */ /* int <- ??? */ h->septa_state = 0; /* int[6] <- ??? */ for(i = 0; i < 6; i++) h->fill_cti[i] = 0; return 0; } /*! * Modified to execute TPC ecat7 writing * * @param fi file structure * @return Error message, or NULL if successfull */ const char *MdcWriteECAT7(FILEINFO *fi) { int ret = 0; int bytes = 0; ECAT7_mainheader h; ECAT7_imageheader ih; float* TPC_frame = 0; float* TPC_frame_start = 0; int frame_size = 0; /* int plane_dir = 0;*/ Uint32 uwidth, uheight; IMG_DATA *id; Mdc_Main_header mh; Uint8 *buf, *maxbuf; Int16 type; Int32 matnum, bed, gate, frame, plane, img=0; #if MDC_TPC_SITE Int32 column, row; float flt32=0; #else Uint32 size; #endif if (MDC_FILE_STDOUT == MDC_YES) return("ECAT7 Writing to stdout unsupported for this format"); MDC_WRITE_ENDIAN = MDC_LITTLE_ENDIAN; /* always (VAX) */ if (XMDC_GUI == MDC_NO) { MdcDefaultName(fi,MDC_FRMT_ECAT7,fi->ofname,fi->ifname); } if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Writing ECAT7:"); if (MDC_VERBOSE) MdcPrntMesg("ECAT7 Writing <%s> ...",fi->ofname); /* check for colored files */ if (fi->map == MDC_MAP_PRESENT) return("ECAT7 Colored files unsupported"); if (MdcKeepFile(fi->ofname)) { return("ECAT7 File exists!!"); } if (MDC_FORCE_INT != MDC_NO) { if (MDC_FORCE_INT != BIT16_S) { MdcPrntWarn("ECAT7 Only Int16 pixels supported"); } } /* check some integrities */ /* check integrity of planes, frames, gates, beds */ if (fi->dim[3] > MDC_ECAT7_MAX_PLANES) return("ECAT7 number of planes too big (1024)"); if (fi->dim[4] > MDC_ECAT7_MAX_FRAMES) return("ECAT7 number of frames too big (512)"); if (fi->dim[5] > MDC_ECAT7_MAX_GATES) return("ECAT7 number of gates too big (32)"); if ((fi->dim[6]*fi->dim[7]) > MDC_ECAT7_MAX_BEDS) return("ECAT7 number of beds too big (32)"); /* use TPC library to open file */ MdcFillMainHeader(fi,&mh); MdcConvertToTPCEcat7(fi,&mh,&h); fi->ofp=ecat7Create(fi->ofname, &h); if (fi->ofp == NULL) { return("ECAT7 Failed to open file for writing"); } /* write all planes */ frame_size = mh.num_planes*fi->mwidth*fi->mheight; TPC_frame_start = (float*)malloc(frame_size*sizeof(float)); if (TPC_frame_start == NULL) { MdcCloseFile(fi->ofp); return("ECAT7 Failed to allocate frame buffer"); } if ( ! ( fi->pat_slice_orient == MDC_TRANSAXIAL || fi->pat_slice_orient == MDC_CORONAL || fi->pat_slice_orient == MDC_SAGITTAL )) { MdcPrntWarn("ECAT7 Couldn't resolve slice orientation, using transaxial\n"); } /* head feet direction L\P,L\FP,P\F,L\F,P\FR,R\F plane_dir = MDC_HEADFIRST; if (strcmp(fi->pat_orient,"L\\P") == 0) plane_dir = MDC_FEETFIRST; else if (strcmp(fi->pat_orient,"R\\P") == 0) plane_dir = MDC_FEETFIRST; else if (strcmp(fi->pat_orient,"L\\FP") == 0) plane_dir = MDC_HEADFIRST; else if (strcmp(fi->pat_orient,"P\\F") == 0) plane_dir = MDC_HEADFIRST; else if (strcmp(fi->pat_orient,"L\\F") == 0) plane_dir = MDC_HEADFIRST; else if (strcmp(fi->pat_orient,"P\\FR") == 0) plane_dir = MDC_HEADFIRST; else if (strcmp(fi->pat_orient,"R\\F") == 0) plane_dir = MDC_HEADFIRST; else { MdcPrntWarn("ECAT7 Unrecognized patient orientation: %s\n",fi->pat_orient); }*/ for (bed=0; bed <= mh.num_bed_pos; bed++) for (gate=1; gate <= mh.num_gates; gate++) for (frame=1; frame <= h.num_frames; frame++) { TPC_frame = TPC_frame_start; #if MDC_TPC_SITE for (plane = 0; plane < fi->dim[3]; plane++) { #else for (plane = 0; plane < fi->dim[3]; plane++, img++) { #endif if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); if (img < 0) { img = fi->number-1; MdcPrntWarn("ECAT7 underflow %d %d %d %d\n", mh.num_bed_pos,mh.num_gates,h.num_frames,fi->dim[3]); } if (img >= fi->number) { img = fi->number-1; MdcPrntWarn("ECAT7 overflow %d %d %d %d\n", mh.num_bed_pos,mh.num_gates,h.num_frames,fi->dim[3]); } #if MDC_TPC_SITE img = (h.num_frames - frame)*fi->dim[3]+plane; id = &fi->image[img]; #else id = &fi->image[img]; #endif /* TPC requires float buffer */ buf = MdcGetImgFLT32(fi, (Uint32)img); if (buf == NULL) { MdcFree(TPC_frame_start); return("ECAT7 Bad malloc float buf"); } type= FLT32; if (fi->diff_size) { uwidth = fi->mwidth; uheight = fi->mheight; maxbuf = MdcGetResizedImage(fi, buf, type, (Uint32)img); if (maxbuf == NULL) { MdcFree(buf); MdcFree(TPC_frame_start); return("ECAT7 Bad malloc maxbuf"); } MdcFree(buf); }else{ uwidth = id->width; uheight = id->height; maxbuf = buf; } bytes = MdcType2Bytes(type); #if MDC_TPC_SITE /* copy plane to row-column-plane orientation as scaled float data */ for (column=0; column < uwidth; column++) for (row=0; row < uheight*bytes; row+=bytes) { flt32 = *((float*)&maxbuf[column*uheight*bytes+row]); *(TPC_frame + ((plane)*uheight*uwidth + column*uheight + (row/bytes))) = flt32; } #else /* copy plane at once */ size = uwidth * uheight; TPC_frame = TPC_frame_start + (size*plane); memcpy(TPC_frame,maxbuf,size*bytes); #endif MdcFree(maxbuf); } TPC_frame = TPC_frame_start; matnum = mdc_mat_numcod(frame,1,1,0,0); MdcConvertToTPCEcat7image(fi,&ih,img-1,frame-1); ret = ecat7WriteImageMatrix(fi->ofp, matnum, &ih, TPC_frame); if (ret) { MdcFree(maxbuf); MdcFree(TPC_frame); MdcPrntWarn("ECAT7: Matrix write error code=%d\n",ret); return("ECAT7 Bad write image matrix"); } } MdcFree(TPC_frame); MdcCloseFile(fi->ofp); MdcCheckQuantitation(fi); return(NULL); } #else const char *MdcWriteECAT7(FILEINFO *fi) { return("ECAT7 Writing not yet supported"); } #endif xmedcon-0.14.1/source/m-debug.h0000644000175000017510000000354512636253502013160 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-debug.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-debug.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-debug.h,v 1.18 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_DEBUG_H__ #define __M_DEBUG_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void MdcPrintFI(FILEINFO *fi); void MdcDebugPrint(char *fmt, ...); #endif xmedcon-0.14.1/source/m-init.c0000644000175000017510000001000512636253502013015 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-init.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : initialize library * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcIgnoreSIGFPE() - ignore floating point exception * * MdcAcceptSIGFPE() - accept floating point exception * * MdcSetLocale() - set POSIX locale and preserve * * MdcUnsetLocale() - unset POSIX locale and retore * * MdcInit() - library usage initialized * * MdcFinish() - library usage finished * * * * Notes : no dynamic memory allocations here * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-init.c,v 1.16 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #include #ifdef HAVE_STRING_H #include #endif #include "m-init.h" /**************************************************************************** D E F I N E S ****************************************************************************/ static void (*mdc_old_handler)(int); static char *mdc_old_locale = NULL; /**************************************************************************** F U N C T I O N S ****************************************************************************/ void MdcIgnoreSIGFPE(void) /* before Accept! */ { mdc_old_handler = signal(SIGFPE, SIG_IGN); } void MdcAcceptSIGFPE(void) /* after Ignore! */ { signal(SIGFPE, mdc_old_handler); } void MdcSetLocale(void) { char *cur_locale; static char locale_string[30]; /* preserve current locale */ cur_locale = setlocale(LC_ALL,NULL); if (cur_locale == NULL) return; if (strlen(cur_locale) >= 30) return; strcpy(locale_string,cur_locale); mdc_old_locale = locale_string; /* set POSIX locale */ setlocale(LC_ALL, "POSIX"); } void MdcUnsetLocale(void) { if (mdc_old_locale == NULL) return; /* restore previous locale */ setlocale(LC_ALL,mdc_old_locale); /* clean up */ mdc_old_locale = NULL; } void MdcInit(void) { /* ignore floating point exception */ MdcIgnoreSIGFPE(); /* set POSIX locale */ MdcSetLocale(); } void MdcFinish(void) { /* accept floating point exception */ MdcAcceptSIGFPE(); /* unset POSIX locale */ MdcUnsetLocale(); } xmedcon-0.14.1/source/xicons.c0000644000175000017510000002221107555632267013142 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xicons.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : define some icons * * * * project : (X)MedCon by Erik Nolf * * * * note : Shamelessly copied from the `imlib_config` utility * * so no copyright here. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xicons.c,v 1.2 2002/10/23 23:45:59 enlf Exp $ */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** D E F I N E S ****************************************************************************/ const unsigned char xmdc_brightness_icon[] = { 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x4c, 0x4c, 0x4c, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0x4c, 0x4c, 0x4c, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0xb2, 0xb2, 0xb2, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb2, 0xb2, 0xb2, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0xb2, 0xb2, 0xb2, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb2, 0xb2, 0xb2, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x4c, 0x4c, 0x4c, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0x4c, 0x4c, 0x4c, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xa, }; const unsigned char xmdc_contrast_icon[] = { 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x33, 0x33, 0x33, 0x7f, 0x7f, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x33, 0x33, 0x33, 0x7f, 0x7f, 0x7f, 0xcc, 0xcc, 0xcc, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x33, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x33, 0x33, 0x33, 0xcc, 0xcc, 0xcc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x7f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x33, 0x33, 0x33, 0x7f, 0x7f, 0x7f, 0xcc, 0xcc, 0xcc, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x33, 0x33, 0x33, 0x7f, 0x7f, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xff, 0x0, 0xff, 0xa, }; const unsigned char xmdc_gamma_icon[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f, 0x7f, 0x7f, 0xcc, 0xcc, 0xcc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb2, 0xb2, 0xb2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcc, 0xcc, 0xcc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb2, 0xb2, 0xb2, 0x7f, 0x7f, 0x7f, 0x4c, 0x4c, 0x4c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb2, 0xb2, 0xb2, 0x7f, 0x7f, 0x7f, 0x4c, 0x4c, 0x4c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb2, 0xb2, 0xb2, 0x7f, 0x7f, 0x7f, 0x4c, 0x4c, 0x4c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb2, 0xb2, 0xb2, 0x7f, 0x7f, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0x7f, 0x4c, 0x4c, 0x4c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xb2, 0xb2, 0xb2, 0x4c, 0x4c, 0x4c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x4c, 0x4c, 0x4c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb2, 0xb2, 0xb2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa, }; xmedcon-0.14.1/source/m-rslice.h0000644000175000017510000000376412636253502013356 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-rslice.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-rslice.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-rslice.h,v 1.17 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_RSLICE_H__ #define __M_RSLICE_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ Int8 MdcGetSliceProjection(FILEINFO *cur); Int8 MdcGetNewPatSliceOrient(FILEINFO *cur, Int8 newproj); char *MdcCheckReslice(FILEINFO *cur, Int8 newproj); char *MdcResliceImages(FILEINFO *cur, Int8 newproj); #endif xmedcon-0.14.1/source/xfilesel.c0000644000175000017510000006126712636253502013453 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xfilesel.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : file selection routines * * * * project : (X)MedCon by Erik Nolf * * * * Note : basic code extracted from Gtk+ tutorial * * * * Functions : XMdcFileSelOpenCallbackOk() - Open Ok callback * * XMdcFileSelOpen() - Open file selection * * XMdcFileSelSaveCreateFormatMenu() - Create Format menu * * XMdcFileSelSaveCreateDefaultName()- Create Default name * * XMdcFileSelSaveCallbackAlias() - Get alias filename * * XMdcFileSelSaveCallbackDefault() - Get default filename * * XMdcFileSelSaveCallbackCancel() - Save Cancel callback * * XMdcFileSelSaveCallbackOk() - Save Ok callback * * XMdcFileSelSave() - Save file selection * * XMdcLutSelOpenCallbackOk() - LUT Open Ok callback * * XMdcLutSelOpen() - LUT open file * * XMdcRawPredefSelSaveCallbackOk() - Raw Predef Save Ok * * XMdcRawPredefSelSave() - Raw Predef Save * * XMdcRawPredefSelOpenCallbackOk() - Raw Predef Load Ok * * XMdcRawPredefSelOpen() - Raw Predef Load * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xfilesel.c,v 1.42 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "xmedcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ static guint format_to_use[MDC_MAX_FRMTS], mitem_nr[MDC_MAX_FRMTS]; static guint OPEN_TYPE=XMDC_NORMAL; static GtkWidget *ofilew=NULL, *sfilew=NULL, *olutw=NULL, *formatmenu=NULL; static GtkWidget *opredefw=NULL, *spredefw=NULL; static GtkWidget *default_name=NULL; /**************************************************************************** F U N C T I O N S ****************************************************************************/ /* Get the selected filename and display */ void XMdcFileSelOpenCallbackOk(GtkWidget *w, GtkWidget *fs) { const char *fname; if (OPEN_TYPE == XMDC_RAW) { XMdcRawReadInteractive(fs); }else if(OPEN_TYPE == XMDC_PREDEF) { XMdcRawReadPredef(fs); }else{ XMdcMainWidgetsInsensitive(); fname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs)); XMdcDisplayFile(fname); XMdcMainWidgetsResensitive(); } } void XMdcFileSelOpen(GtkWidget *widget, guint otype) { OPEN_TYPE = otype; if (ofilew == NULL) { /* Create a new file selection widget */ ofilew = gtk_file_selection_new ("Open File"); gtk_signal_connect(GTK_OBJECT (ofilew), "destroy", GTK_SIGNAL_FUNC(XMdcMedconQuit), NULL); gtk_signal_connect(GTK_OBJECT (ofilew), "delete_event", GTK_SIGNAL_FUNC(XMdcHandlerToHide), NULL); /* Connect the ok_button to file_ok_sel function */ gtk_signal_connect_object( GTK_OBJECT(GTK_FILE_SELECTION(ofilew)->ok_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(ofilew)); gtk_signal_connect(GTK_OBJECT (GTK_FILE_SELECTION (ofilew)->ok_button), "clicked", GTK_SIGNAL_FUNC(XMdcFileSelOpenCallbackOk),ofilew); /* Connect the cancel_button to hide the widget */ gtk_signal_connect_object(GTK_OBJECT (GTK_FILE_SELECTION (ofilew)->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(ofilew)); } if (OPEN_TYPE == XMDC_RAW) { gtk_window_set_title(GTK_WINDOW(ofilew),"Open RAW File (interactive)"); }else if (OPEN_TYPE == XMDC_PREDEF) { gtk_window_set_title(GTK_WINDOW(ofilew),"Open RAW File (predefined)"); }else{ gtk_window_set_title(GTK_WINDOW(ofilew),"Open File"); } /* Lets set the filename, as if this were a save dialog, and we are giving a default filename */ gtk_file_selection_set_filename (GTK_FILE_SELECTION(ofilew), ""); XMdcShowWidget(ofilew); switch (XMDC_FILE_TYPE) { case XMDC_RAW : XMdcDisplayWarn("RAW file was not saved"); break; case XMDC_PREDEF : XMdcDisplayWarn("RAW file was not saved"); break; case XMDC_EXTRACT: XMdcDisplayWarn("Extracted images were not saved"); break; case XMDC_RESLICE: XMdcDisplayWarn("Resliced images not saved"); break; case XMDC_TRANSF : XMdcDisplayWarn("Transformed images not saved"); break; case XMDC_EDITFI : XMdcDisplayWarn("Changed FileInfo not saved"); break; } } void XMdcFileSelSaveCreateFormatMenu(GtkWidget *fs, guint format) { GtkWidget *menu=NULL; GtkWidget *menuitem; guint item=0, selected=0; Uint8 LOOK=MDC_YES; formatmenu = gtk_option_menu_new(); menu = gtk_menu_new(); memset(format_to_use,MDC_FRMT_NONE,MDC_MAX_FRMTS); memset(mitem_nr,-1,MDC_MAX_FRMTS); /* format Raw Binary */ if (LOOK && (format == MDC_FRMT_RAW)) { XMDC_WRITE_FRMT = MDC_FRMT_RAW; LOOK = MDC_NO; selected = item; } format_to_use[MDC_FRMT_RAW]=MDC_FRMT_RAW; mitem_nr[MDC_FRMT_RAW] = item++; menuitem = gtk_menu_item_new_with_label(FrmtString[MDC_FRMT_RAW]); gtk_signal_connect( GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(XMdcFileSelSaveCallbackFormatMenu), &format_to_use[MDC_FRMT_RAW]); gtk_menu_append(GTK_MENU(menu),menuitem); gtk_widget_show(menuitem); /* format Raw Ascii */ if (LOOK && (format == MDC_FRMT_ASCII)) { XMDC_WRITE_FRMT = MDC_FRMT_ASCII; LOOK = MDC_NO; selected = item; } format_to_use[MDC_FRMT_ASCII]=MDC_FRMT_ASCII; mitem_nr[MDC_FRMT_ASCII] = item++; menuitem = gtk_menu_item_new_with_label(FrmtString[MDC_FRMT_ASCII]); gtk_signal_connect( GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(XMdcFileSelSaveCallbackFormatMenu), &format_to_use[MDC_FRMT_ASCII]); gtk_menu_append(GTK_MENU(menu),menuitem); gtk_widget_show(menuitem); #if MDC_INCLUDE_ACR if (LOOK && (format == MDC_FRMT_ACR)) { XMDC_WRITE_FRMT = MDC_FRMT_ACR; LOOK = MDC_NO; selected = item; } format_to_use[MDC_FRMT_ACR]=MDC_FRMT_ACR; mitem_nr[MDC_FRMT_ACR] = item++; menuitem = gtk_menu_item_new_with_label(FrmtString[MDC_FRMT_ACR]); gtk_signal_connect( GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(XMdcFileSelSaveCallbackFormatMenu), &format_to_use[MDC_FRMT_ACR]); gtk_menu_append(GTK_MENU(menu),menuitem); gtk_widget_show(menuitem); #endif #if MDC_INCLUDE_ANLZ if (LOOK && (format == MDC_FRMT_ANLZ)) { XMDC_WRITE_FRMT = MDC_FRMT_ANLZ; LOOK = MDC_NO; selected = item; } format_to_use[MDC_FRMT_ANLZ]=MDC_FRMT_ANLZ; mitem_nr[MDC_FRMT_ANLZ] = item++; menuitem = gtk_menu_item_new_with_label(FrmtString[MDC_FRMT_ANLZ]); gtk_signal_connect( GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(XMdcFileSelSaveCallbackFormatMenu), &format_to_use[MDC_FRMT_ANLZ]); gtk_menu_append(GTK_MENU(menu),menuitem); gtk_widget_show(menuitem); #endif #if MDC_INCLUDE_CONC if (LOOK && (format == MDC_FRMT_CONC)) { XMDC_WRITE_FRMT = MDC_FRMT_CONC; LOOK = MDC_NO; selected = item; } format_to_use[MDC_FRMT_CONC]=MDC_FRMT_CONC; mitem_nr[MDC_FRMT_CONC] = item++; menuitem = gtk_menu_item_new_with_label(FrmtString[MDC_FRMT_CONC]); gtk_signal_connect( GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(XMdcFileSelSaveCallbackFormatMenu), &format_to_use[MDC_FRMT_CONC]); gtk_menu_append(GTK_MENU(menu),menuitem); gtk_widget_show(menuitem); #endif #if MDC_INCLUDE_DICM if (LOOK && (format == MDC_FRMT_DICM)) { XMDC_WRITE_FRMT = MDC_FRMT_DICM; LOOK = MDC_NO; selected = item; } format_to_use[MDC_FRMT_DICM]=MDC_FRMT_DICM; mitem_nr[MDC_FRMT_DICM] = item++; menuitem = gtk_menu_item_new_with_label(FrmtString[MDC_FRMT_DICM]); gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(XMdcFileSelSaveCallbackFormatMenu), &format_to_use[MDC_FRMT_DICM]); gtk_menu_append(GTK_MENU(menu),menuitem); gtk_widget_show(menuitem); #endif #if MDC_INCLUDE_ECAT if (LOOK && (format == MDC_FRMT_ECAT6)) { XMDC_WRITE_FRMT = MDC_FRMT_ECAT6; LOOK = MDC_NO; selected = item; } format_to_use[MDC_FRMT_ECAT6]=MDC_FRMT_ECAT6; mitem_nr[MDC_FRMT_ECAT6] = item++; menuitem = gtk_menu_item_new_with_label(FrmtString[MDC_FRMT_ECAT6]); gtk_signal_connect( GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(XMdcFileSelSaveCallbackFormatMenu), &format_to_use[MDC_FRMT_ECAT6]); gtk_menu_append(GTK_MENU(menu),menuitem); gtk_widget_show(menuitem); #if MDC_INCLUDE_TPC if (LOOK && (format == MDC_FRMT_ECAT7)) { XMDC_WRITE_FRMT = MDC_FRMT_ECAT7; LOOK = MDC_NO; selected = item; } format_to_use[MDC_FRMT_ECAT7]=MDC_FRMT_ECAT7; mitem_nr[MDC_FRMT_ECAT7] = item++; menuitem = gtk_menu_item_new_with_label(FrmtString[MDC_FRMT_ECAT7]); gtk_signal_connect( GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(XMdcFileSelSaveCallbackFormatMenu), &format_to_use[MDC_FRMT_ECAT7]); gtk_menu_append(GTK_MENU(menu),menuitem); gtk_widget_show(menuitem); #endif #endif #if MDC_INCLUDE_GIF if (LOOK && (format == MDC_FRMT_GIF)) { XMDC_WRITE_FRMT = MDC_FRMT_GIF; LOOK = MDC_NO; selected = item; } format_to_use[MDC_FRMT_GIF]=MDC_FRMT_GIF; mitem_nr[MDC_FRMT_GIF] = item++; menuitem = gtk_menu_item_new_with_label(FrmtString[MDC_FRMT_GIF]); gtk_signal_connect( GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(XMdcFileSelSaveCallbackFormatMenu), &format_to_use[MDC_FRMT_GIF]); gtk_menu_append(GTK_MENU(menu),menuitem); gtk_widget_show(menuitem); #endif #if MDC_INCLUDE_INTF if (LOOK && (format == MDC_FRMT_INTF)) { XMDC_WRITE_FRMT = MDC_FRMT_INTF; LOOK = MDC_NO; selected = item; } format_to_use[MDC_FRMT_INTF]=MDC_FRMT_INTF; mitem_nr[MDC_FRMT_INTF] = item++; menuitem = gtk_menu_item_new_with_label(FrmtString[MDC_FRMT_INTF]); gtk_signal_connect( GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(XMdcFileSelSaveCallbackFormatMenu), &format_to_use[MDC_FRMT_INTF]); gtk_menu_append(GTK_MENU(menu),menuitem); gtk_widget_show(menuitem); #endif #if MDC_INCLUDE_INW if (LOOK && (format == MDC_FRMT_INW)) { XMDC_WRITE_FRMT = MDC_FRMT_INW; LOOK = MDC_NO; selected = item; } format_to_use[MDC_FRMT_INW]=MDC_FRMT_INW; mitem_nr[MDC_FRMT_INW] = item++; menuitem = gtk_menu_item_new_with_label(FrmtString[MDC_FRMT_INW]); gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(XMdcFileSelSaveCallbackFormatMenu), &format_to_use[MDC_FRMT_INW]); gtk_menu_append(GTK_MENU(menu),menuitem); gtk_widget_show(menuitem); #endif #if MDC_INCLUDE_NIFTI if (LOOK && (format == MDC_FRMT_NIFTI)) { XMDC_WRITE_FRMT = MDC_FRMT_NIFTI; LOOK = MDC_NO; selected = item; } format_to_use[MDC_FRMT_NIFTI]=MDC_FRMT_NIFTI; mitem_nr[MDC_FRMT_NIFTI] = item++; menuitem = gtk_menu_item_new_with_label(FrmtString[MDC_FRMT_NIFTI]); gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(XMdcFileSelSaveCallbackFormatMenu), &format_to_use[MDC_FRMT_NIFTI]); gtk_menu_append(GTK_MENU(menu),menuitem); gtk_widget_show(menuitem); #endif #if MDC_INCLUDE_PNG if (LOOK && (format == MDC_FRMT_PNG)) { XMDC_WRITE_FRMT = MDC_FRMT_PNG; LOOK = MDC_NO; selected = item; } format_to_use[MDC_FRMT_PNG]=MDC_FRMT_PNG; mitem_nr[MDC_FRMT_PNG] = item++; menuitem = gtk_menu_item_new_with_label(FrmtString[MDC_FRMT_PNG]); gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(XMdcFileSelSaveCallbackFormatMenu), &format_to_use[MDC_FRMT_PNG]); gtk_menu_append(GTK_MENU(menu),menuitem); gtk_widget_show(menuitem); #endif if (LOOK) XMdcDisplayFatalErr(MDC_BAD_CODE,"Unexpected format to save"); XMdcFileSelSaveCreateDefaultName(fs); gtk_option_menu_set_menu(GTK_OPTION_MENU(formatmenu),menu); gtk_option_menu_set_history(GTK_OPTION_MENU(formatmenu),selected); gtk_box_pack_start(GTK_BOX(GTK_FILE_SELECTION(fs)->action_area), formatmenu,FALSE,FALSE,0); gtk_widget_show(formatmenu); } void XMdcFileSelSaveCreateDefaultName(GtkWidget *fs) { MdcDefaultName(my.fi,XMDC_WRITE_FRMT,my.fi->ofname,my.fi->ifname); gtk_file_selection_set_filename(GTK_FILE_SELECTION(fs),my.fi->ofname); } void XMdcFileSelSaveCallbackFormatMenu(GtkWidget *fs, guint *selected_format) { XMDC_WRITE_FRMT = (Int8)(*selected_format); XMdcFileSelSaveCreateDefaultName(sfilew); } void XMdcFileSelSaveCallbackAlias(GtkObject *fs, char *filename) { Int8 prev = MDC_ALIAS_NAME; MDC_ALIAS_NAME = MDC_YES; MdcDefaultName(my.fi,XMDC_WRITE_FRMT,my.fi->ofname,my.fi->ifname); gtk_file_selection_set_filename(GTK_FILE_SELECTION(fs),my.fi->ofname); MDC_ALIAS_NAME = prev; } void XMdcFileSelSaveCallbackDefault(GtkObject *fs, char *filename) { MdcDefaultName(my.fi,XMDC_WRITE_FRMT,my.fi->ofname,my.fi->ifname); gtk_file_selection_set_filename(GTK_FILE_SELECTION(fs),my.fi->ofname); } void XMdcFileSelSaveCallbackCancel(GtkWidget *widget, GtkWidget *fs) { write_counter-=1; } void XMdcFileSelSaveCallbackOk(GtkWidget *widget, GtkWidget *fs) { strcpy(my.fi->opath,gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs))); MdcSplitPath(my.fi->opath,my.fi->odir,my.fi->ofname); if (my.fi->ofname[0] == '\0') { XMdcDisplayErr("No file specified"); write_counter-=1; return; } MdcMergePath(my.fi->opath,my.fi->odir,my.fi->ofname); if (XMdcWriteFile(XMDC_WRITE_FRMT)) { if (XMDC_FILE_TYPE >= XMDC_UNSAVED) XMDC_FILE_TYPE = XMDC_SAVED; } XMdcProgressBar(MDC_PROGRESS_END,0.,NULL); } void XMdcFileSelSave(GtkWidget *widget, guint format) { GtkWidget *button; GtkWidget *menu=NULL; GtkWidget *active=NULL; guint nr; nr = (format < MDC_MAX_FRMTS) ? mitem_nr[format] : 1; if (XMdcNoFileOpened()) return; MdcPrefix((signed)write_counter++); if (sfilew == NULL) { /* first call "Save": no format set before */ /* so we use default value this first time */ if (format == MDC_MAX_FRMTS) format = XMDC_DEFAULT_FRMT; /* Create a new file selection widget */ sfilew = gtk_file_selection_new ("Save File"); gtk_signal_connect(GTK_OBJECT(sfilew), "destroy", GTK_SIGNAL_FUNC(XMdcMedconQuit), NULL); gtk_signal_connect(GTK_OBJECT(sfilew), "delete_event", GTK_SIGNAL_FUNC(XMdcHandlerToHide), NULL); /* Connect the ok_button to file_ok_sel function */ gtk_signal_connect_object( GTK_OBJECT(GTK_FILE_SELECTION (sfilew)->ok_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(sfilew)); gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION (sfilew)->ok_button), "clicked", GTK_SIGNAL_FUNC(XMdcFileSelSaveCallbackOk), sfilew); /* Connect the cancel_button to hide the widget, decrease counter */ gtk_signal_connect_object( GTK_OBJECT(GTK_FILE_SELECTION (sfilew)->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(sfilew)); gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION (sfilew)->cancel_button), "clicked", GTK_SIGNAL_FUNC(XMdcFileSelSaveCallbackCancel), NULL); XMdcFileSelSaveCreateFormatMenu(sfilew,format); button = gtk_button_new_with_label("Alias Name"); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcFileSelSaveCallbackAlias), GTK_OBJECT(sfilew)); gtk_box_pack_start(GTK_BOX(GTK_FILE_SELECTION(sfilew)->action_area), button, TRUE, TRUE, 0); gtk_widget_show(button); button = gtk_button_new_with_label("Default Name"); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcFileSelSaveCallbackDefault), GTK_OBJECT(sfilew)); gtk_box_pack_start(GTK_BOX(GTK_FILE_SELECTION(sfilew)->action_area), button, TRUE, TRUE, 0); gtk_widget_show(button); default_name = button; }else{ if (format == MDC_MAX_FRMTS) { /* Save: use previous selected format */ menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(formatmenu)); active = gtk_menu_get_active(GTK_MENU(menu)); gtk_menu_item_activate(GTK_MENU_ITEM(active)); }else{ /* Save As: use given format */ nr=mitem_nr[format]; gtk_option_menu_set_history(GTK_OPTION_MENU(formatmenu),nr); menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(formatmenu)); gtk_menu_set_active(GTK_MENU(menu),nr); active = gtk_menu_get_active(GTK_MENU(menu)); gtk_menu_item_activate(GTK_MENU_ITEM(active)); } } if (MDC_ALIAS_NAME == MDC_YES) gtk_widget_hide(default_name); else gtk_widget_show(default_name); XMdcShowWidget(sfilew); } void XMdcLutSelOpenCallbackOk(GtkWidget *w, GtkWidget *fs) { const char *fname; fname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs)); XMdcLoadLUT(fname); } void XMdcLutSelOpen(GtkWidget *widget, gpointer data) { if (olutw == NULL) { /* Create a new file selection widget */ olutw = gtk_file_selection_new ("Select LUT File"); gtk_signal_connect(GTK_OBJECT (olutw), "destroy", GTK_SIGNAL_FUNC(XMdcMedconQuit), NULL); gtk_signal_connect(GTK_OBJECT (olutw), "delete_event", GTK_SIGNAL_FUNC(XMdcHandlerToHide), NULL); /* Connect the ok_button to file_ok_sel function */ gtk_signal_connect_object( GTK_OBJECT(GTK_FILE_SELECTION(olutw)->ok_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(olutw)); gtk_signal_connect(GTK_OBJECT (GTK_FILE_SELECTION (olutw)->ok_button), "clicked", GTK_SIGNAL_FUNC(XMdcLutSelOpenCallbackOk),olutw); /* Connect the cancel_button to hide the widget */ gtk_signal_connect_object(GTK_OBJECT (GTK_FILE_SELECTION (olutw)->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(olutw)); } /* Lets set the filename, as if this were a save dialog, and we are giving * a default filename */ if (XMEDCONLUT != NULL) { strncpy(xmdcstr,XMEDCONLUT,MDC_1KB_OFFSET); xmdcstr[MDC_1KB_OFFSET]='\0'; if (xmdcstr[strlen(xmdcstr)-1] != MDC_PATH_DELIM_CHR) strcat(xmdcstr,MDC_PATH_DELIM_STR); gtk_file_selection_set_filename(GTK_FILE_SELECTION(olutw),xmdcstr); }else{ /* installation dir */ gtk_file_selection_set_filename(GTK_FILE_SELECTION(olutw),XMDCLUT); } gtk_file_selection_complete(GTK_FILE_SELECTION(olutw),"*.lut"); XMdcShowWidget(olutw); } void XMdcRawPredefSelSaveCallbackOk(GtkWidget *widget, GtkWidget *fs) { const gchar *fname; gchar *msg; fname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs)); if ((msg = MdcWritePredef(fname)) != NULL) { XMdcDisplayWarn("%s",msg); }else{ XMdcDisplayMesg("File successfully written"); } } void XMdcRawPredefSelSave(GtkWidget *widget, gpointer data) { if (spredefw == NULL) { /* Create a new file selection widget */ spredefw = gtk_file_selection_new ("Save Raw Predef File"); gtk_signal_connect(GTK_OBJECT(spredefw), "destroy", GTK_SIGNAL_FUNC(XMdcMedconQuit), NULL); gtk_signal_connect(GTK_OBJECT(spredefw), "delete_event", GTK_SIGNAL_FUNC(XMdcHandlerToHide), NULL); /* Connect the ok_button to save_ok_sel function */ gtk_signal_connect_object( GTK_OBJECT(GTK_FILE_SELECTION (spredefw)->ok_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(spredefw)); gtk_signal_connect( GTK_OBJECT(GTK_FILE_SELECTION (spredefw)->ok_button), "clicked", GTK_SIGNAL_FUNC(XMdcRawPredefSelSaveCallbackOk), GTK_OBJECT(spredefw)); /* Connect the cancel_button to hide the widget */ gtk_signal_connect_object( GTK_OBJECT(GTK_FILE_SELECTION (spredefw)->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(spredefw)); } if (XMEDCONRPI != NULL) { strncpy(xmdcstr,XMEDCONRPI,MDC_1KB_OFFSET); xmdcstr[MDC_1KB_OFFSET]='\0'; if (xmdcstr[strlen(xmdcstr)-1] != MDC_PATH_DELIM_CHR) strcat(xmdcstr,MDC_PATH_DELIM_STR); gtk_file_selection_set_filename(GTK_FILE_SELECTION(spredefw),xmdcstr); gtk_file_selection_complete(GTK_FILE_SELECTION(spredefw),"predef.rpi"); }else{ gtk_file_selection_set_filename(GTK_FILE_SELECTION(spredefw),"predef.rpi"); } XMdcShowWidget(spredefw); } void XMdcRawPredefSelOpenCallbackOk(GtkWidget *w, GtkWidget *fs) { const gchar *fname; char *msg; fname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs)); if (MdcCheckPredef(fname) == MDC_NO) { XMdcDisplayWarn("Invalid raw predef input file"); return; } msg = MdcReadPredef(fname); if (msg != NULL) XMdcDisplayWarn(msg); } void XMdcRawPredefSelOpen(GtkWidget *widget, gpointer data) { if (opredefw == NULL) { /* Create a new file selection widget */ opredefw = gtk_file_selection_new ("Load Raw Predef File"); gtk_signal_connect(GTK_OBJECT (opredefw), "destroy", GTK_SIGNAL_FUNC(XMdcMedconQuit), NULL); gtk_signal_connect(GTK_OBJECT (opredefw), "delete_event", GTK_SIGNAL_FUNC(XMdcHandlerToHide), NULL); /* Connect the ok_button to file_ok_sel function */ gtk_signal_connect_object( GTK_OBJECT(GTK_FILE_SELECTION(opredefw)->ok_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(opredefw)); gtk_signal_connect(GTK_OBJECT (GTK_FILE_SELECTION (opredefw)->ok_button), "clicked", GTK_SIGNAL_FUNC(XMdcRawPredefSelOpenCallbackOk),opredefw); /* Connect the cancel_button to hide the widget */ gtk_signal_connect_object(GTK_OBJECT (GTK_FILE_SELECTION (opredefw)->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(opredefw)); } if (XMEDCONRPI != NULL) { strncpy(xmdcstr,XMEDCONRPI,MDC_1KB_OFFSET); xmdcstr[MDC_1KB_OFFSET]='\0'; if (xmdcstr[strlen(xmdcstr)-1] != MDC_PATH_DELIM_CHR) strcat(xmdcstr,MDC_PATH_DELIM_STR); gtk_file_selection_set_filename(GTK_FILE_SELECTION(opredefw),xmdcstr); gtk_file_selection_complete(GTK_FILE_SELECTION(opredefw),"*.rpi"); }else{ gtk_file_selection_set_filename(GTK_FILE_SELECTION(opredefw),"*.rpi"); } XMdcShowWidget(opredefw); } xmedcon-0.14.1/source/xcolgbc.c0000644000175000017510000003103412636253502013246 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xcolgbc.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : color corrections * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcColGbcCorrectExpose() - Expose wrapper Update * * XMdcColGbcCorrectUpdate() - Update GBC image * * XMdcColGbcCorrectMakeIcons() - Make slider icons * * XMdcColGbcCorrectAddImg() - Add example image * * XMdcColGbcCorrectModValue() - Modify slider values * * XMdcColGbcCorrectResetValue() - Reset slider values * * XMdcColGbcCorrectAddOneSlider() - Add one slider * * XMdcColGbcCorrectAddSliders(); - Add all sliders * * XMdcColGbcCorrectApply(); - Apply callback * * XMdcColGbcCorrectCancel(); - Cancel callback * * XMdcColGbcCorrectSel(); - GBC selection * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xcolgbc.c,v 1.28 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "xmedcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ static GtkWidget *wgbc=NULL; static ColorModifier modtmp; static SliderValueStruct svgamma, svbrightness, svcontrast; /**************************************************************************** F U N C T I O N S ****************************************************************************/ gboolean XMdcColGbcCorrectExpose(GtkWidget *widget, GdkEventExpose *event, gpointer data) { XMdcColGbcCorrectUpdate(); return(TRUE); } void XMdcColGbcCorrectUpdate(void) { GtkWidget *area; GdkPixbuf *imtmp, *imnew; GdkGC *gc; int w, h; area = sGbc.area; gc = area->style->white_gc; XMdcSetGbcCorrection(&modtmp); imtmp = XMdcBuildGdkPixbuf(sGbc.img8,sGbc.w,sGbc.h,sGbc.t,modtmp.vgbc); w = gdk_pixbuf_get_width(sGbc.im); h = gdk_pixbuf_get_height(sGbc.im); g_object_unref(sGbc.im); imnew = gdk_pixbuf_scale_simple(imtmp,w,h,sRenderSelection.Interp); g_object_unref(imtmp); sGbc.im = imnew; gdk_pixbuf_render_to_drawable(sGbc.im,area->window,gc,0,0,0,0,w,h, sRenderSelection.Dither,0,0); } void XMdcColGbcCorrectMakeIcons(void) { GdkPixbuf *im0, *im; im0=gdk_pixbuf_new_from_data(xmdc_brightness_icon, GDK_COLORSPACE_RGB, FALSE, 8, 12, 12, 3*12, (void(*)())NULL, NULL); im = gdk_pixbuf_add_alpha(im0,TRUE,0xff,0x00,0xff); gdk_pixbuf_render_pixmap_and_mask(im,&sGbc.brightness_pmap ,&sGbc.brightness_mask,254); g_object_unref(im); g_object_unref(im0); im0=gdk_pixbuf_new_from_data(xmdc_contrast_icon, GDK_COLORSPACE_RGB, FALSE, 8, 12, 12, 3*12, (void(*)())NULL, NULL); im = gdk_pixbuf_add_alpha(im0,TRUE,0xff,0x00,0xff); gdk_pixbuf_render_pixmap_and_mask(im,&sGbc.contrast_pmap ,&sGbc.contrast_mask,254); g_object_unref(im); g_object_unref(im0); im0=gdk_pixbuf_new_from_data(xmdc_gamma_icon, GDK_COLORSPACE_RGB, FALSE, 8, 12, 12, 3*12, (void(*)())NULL, NULL); im = gdk_pixbuf_add_alpha(im0,TRUE,0xff,0x00,0xff); gdk_pixbuf_render_pixmap_and_mask(im,&sGbc.gamma_pmap ,&sGbc.gamma_mask,254); g_object_unref(im); g_object_unref(im0); } void XMdcColGbcCorrectAddImg(GtkWidget *w) { GtkWidget *box, *area, *imgbox; int rw, rh; rw = (signed)XMdcScaleW(sGbc.w); rh = (signed)XMdcScaleH(sGbc.h); box = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(w), box, FALSE, FALSE, 0); gtk_widget_show(box); imgbox = gtk_hbox_new(FALSE,2); gtk_box_pack_start(GTK_BOX(box), imgbox, TRUE, TRUE, 0); gtk_widget_show(imgbox); area = gtk_drawing_area_new(); gtk_widget_set_events(area, GDK_EXPOSURE_MASK); gtk_drawing_area_size(GTK_DRAWING_AREA(area), rw, rh); gtk_box_pack_start(GTK_BOX(imgbox), area, FALSE, FALSE, 0); gtk_widget_show(area); gtk_signal_connect(GTK_OBJECT(area),"expose_event", GTK_SIGNAL_FUNC(XMdcColGbcCorrectExpose), NULL); sGbc.area = area; } void XMdcColGbcCorrectModValue(GtkWidget *widget, SliderValueStruct *v) { (*(v->value)) = (int)GTK_ADJUSTMENT(v->adj)->value; XMdcColGbcCorrectUpdate(); } void XMdcColGbcCorrectResetValue(GtkWidget *widget, SliderValueStruct *v) { (*(v->value)) = 255; #ifdef GTKONE GTK_ADJUSTMENT(v->adj)->value = (gfloat)(*(v->value)); gtk_range_set_adjustment(GTK_RANGE(v->range), GTK_ADJUSTMENT(v->adj)); gtk_range_slider_update(GTK_RANGE(v->range)); #else gtk_range_set_value(GTK_RANGE(v->range), (gfloat)(*(v->value))); #endif XMdcColGbcCorrectUpdate(); } void XMdcColGbcCorrectAddOneSlider(GtkWidget *w, int *value, GtkWidget *ic, SliderValueStruct *sv) { GtkObject *adj; GtkWidget *range, *button, *box; box = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(w), box, FALSE, FALSE, 0); gtk_widget_show(box); adj = gtk_adjustment_new((gfloat)(*value), 0.0, 1024.0, 1.0, 8.0, 0.0); range = gtk_hscale_new(GTK_ADJUSTMENT(adj)); gtk_widget_set_usize(range, 200, 12); gtk_range_set_update_policy(GTK_RANGE(range), GTK_UPDATE_CONTINUOUS); gtk_scale_set_draw_value(GTK_SCALE(range), FALSE); sv->adj = adj; sv->range = range; sv->value = value; gtk_signal_connect(GTK_OBJECT(adj), "value_changed", GTK_SIGNAL_FUNC(XMdcColGbcCorrectModValue), sv); gtk_box_pack_start(GTK_BOX(box), range, FALSE, FALSE, 0); gtk_widget_show(range); button = gtk_button_new(); gtk_container_add(GTK_CONTAINER(button), ic); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcColGbcCorrectResetValue), sv); gtk_widget_show(button); gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); } void XMdcColGbcCorrectAddSliders(GtkWidget *w) { GtkWidget *frame, *box, *box0, *box1, *i1, *i2, *i3; XMdcColGbcCorrectMakeIcons(); box0 = gtk_hbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(w), box0); gtk_widget_show(box0); box1 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(box0), box1); gtk_widget_show(box1); i1 = gtk_pixmap_new(sGbc.gamma_pmap, sGbc.gamma_mask); gtk_widget_show(i1); i2 = gtk_pixmap_new(sGbc.brightness_pmap, sGbc.brightness_mask); gtk_widget_show(i2); i3 = gtk_pixmap_new(sGbc.contrast_pmap, sGbc.contrast_mask); gtk_widget_show(i3); frame = gtk_aspect_frame_new("Base Levels", 0.5, 0.5, 0.0, TRUE); gtk_box_pack_start(GTK_BOX(box1), frame, FALSE, FALSE, 4); gtk_widget_show(frame); box = gtk_vbox_new(TRUE, 0); gtk_container_add(GTK_CONTAINER(frame), box); gtk_widget_show(box); XMdcColGbcCorrectAddOneSlider(box,(int *)&modtmp.gamma,i1,&svgamma); XMdcColGbcCorrectAddOneSlider(box,(int *)&modtmp.brightness,i2,&svbrightness); XMdcColGbcCorrectAddOneSlider(box,(int *)&modtmp.contrast,i3,&svcontrast); XMdcColGbcCorrectAddImg(box0); gdk_pixmap_unref(sGbc.gamma_pmap); gdk_pixmap_unref(sGbc.brightness_pmap); gdk_pixmap_unref(sGbc.contrast_pmap); } void XMdcColGbcCorrectApply(GtkWidget *widget, gpointer data) { sGbc.mod.gamma = modtmp.gamma; sGbc.mod.brightness = modtmp.brightness; sGbc.mod.contrast = modtmp.contrast; memcpy(sGbc.mod.vgbc,modtmp.vgbc,256); if (XMDC_FILE_OPEN == MDC_YES) { gtk_widget_set_sensitive(my.viewwindow,FALSE); XMdcRemovePreviousColorMap(); XMdcRemovePreviousImages(); XMdcBuildColorMap(); XMdcBuildCurrentImages(); gtk_widget_set_sensitive(my.viewwindow,TRUE); } } void XMdcColGbcCorrectSel(GtkWidget *widget, Uint32 nr) { GtkWidget *box1; GtkWidget *box2; GtkWidget *button; GtkWidget *separator; GdkPixbuf *im; int rw, rh; sGbc.nr = nr; sGbc.i = my.realnumber[nr]; sGbc.w = my.fi->image[sGbc.i].width; sGbc.h = my.fi->image[sGbc.i].height; sGbc.t = my.fi->image[sGbc.i].type; modtmp.gamma = sGbc.mod.gamma; modtmp.brightness = sGbc.mod.brightness; modtmp.contrast = sGbc.mod.contrast; XMdcSetGbcCorrection(&modtmp); rw = (signed)XMdcScaleW(sGbc.w); rh = (signed)XMdcScaleH(sGbc.h); MdcFree(sGbc.img8); sGbc.img8 = MdcGetDisplayImage(my.fi,sGbc.i); if (sGbc.img8 == NULL) { XMdcDisplayErr("Couldn't alloc byte buffer"); return; } im = XMdcBuildGdkPixbuf(sGbc.img8,sGbc.w,sGbc.h,sGbc.t,modtmp.vgbc); if (im == NULL) { MdcFree(sGbc.img8); XMdcDisplayErr("Couldn't create GdkPixbuf"); return; } if ( wgbc == NULL ) { sGbc.im = im; wgbc = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_policy(GTK_WINDOW(wgbc), TRUE, TRUE, TRUE); gtk_signal_connect(GTK_OBJECT(wgbc),"destroy", GTK_SIGNAL_FUNC(XMdcMedconQuit), NULL); gtk_signal_connect(GTK_OBJECT(wgbc),"delete_event", GTK_SIGNAL_FUNC(XMdcHandlerToHide), NULL); gtk_window_set_title(GTK_WINDOW(wgbc),"Color Correction"); gtk_container_set_border_width(GTK_CONTAINER(wgbc), 1); box1 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(wgbc), box1); gtk_widget_show(box1); /* create sliders for correction */ XMdcColGbcCorrectAddSliders(box1); /* create horizontal separator */ separator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(box1), separator, FALSE, FALSE, 0); gtk_widget_show(separator); /* create bottom button box */ box2 = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(box1), box2, TRUE, TRUE, 2); gtk_widget_show(box2); button = gtk_button_new_with_label("Apply"); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 2); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide),GTK_OBJECT(wgbc)); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcColGbcCorrectApply), NULL); gtk_widget_show(button); button = gtk_button_new_with_label("Cancel"); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 2); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide),GTK_OBJECT(wgbc)); gtk_widget_show(button); }else{ /* replace image / update sliders */ gtk_window_set_policy(GTK_WINDOW(wgbc), TRUE, TRUE, TRUE); g_object_unref(sGbc.im); sGbc.im = im; gdk_window_clear(sGbc.area->window); gtk_drawing_area_size(GTK_DRAWING_AREA(sGbc.area), rw, rh); GTK_ADJUSTMENT(svgamma.adj)->value = sGbc.mod.gamma; GTK_ADJUSTMENT(svbrightness.adj)->value = sGbc.mod.brightness; GTK_ADJUSTMENT(svcontrast.adj)->value = sGbc.mod.contrast; XMdcColGbcCorrectUpdate(); } gtk_window_set_policy(GTK_WINDOW(wgbc), FALSE, FALSE, TRUE); XMdcShowWidget(wgbc); } xmedcon-0.14.1/source/m-acr.c0000644000175000017510000044477412636253501012646 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-acr.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : read and write ACR/NEMA files * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcCheckACR() - Check ACR/NEMA format * * MdcSwapTag() - Swap bytes in tag * * MdcFindAcrInfo() - Find readable tags in hacked file * * MdcGetAcrInfo() - Get data from tags in hacked file * * MdcHackACR() - Hack a file for ACR/NEMA tags * * MdcReadACR() - Read ACR/NEMA file * * MdcPrintTag() - Display tag content * * MdcGetStrVM() - Get VM string from an element * * MdcDicomInitStuff()- Initialize dicom stuff struct * * MdcDicomCheckVect()- Check dicom vector tags * * MdcDicomNrOfVect() - Give true number of vector items * * MdcDicomDoAcqData()- Check wheter to fill acq data * * MdcDicomSOPClass() - Handle SOP Class (modality) * * MdcGetHHMMSS() - Get hour, minute, sec from string * * MdcDoTag() - Handle the tag * * MdcPutGroupLength()- Write the group length * * MdcPutTag() - Write tag to file * * MdcPutGroup() - Write group to file * * MdcWriteACR() - Write ACR/NEMA file * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-acr.c,v 1.139 2015/12/22 13:59:29 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "medcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_TAGS_NEEDED 3 static Uint32 MDC_HACK_BYTES = 2048; static int MDC_HACK_SUCCESS; static long FP_G0008_E0001; MDC_DICOM_STUFF_T mdc_dicom_stuff; /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcCheckACR(FILEINFO *fi) { MDC_ACR_TAG acrtag[3], *tag; Int8 FRMT = MDC_FRMT_NONE; int r; r = fread((Uint8 *)&acrtag[0], 1, MDC_ACR_TAG_SIZE, fi->ifp); if (r != MDC_ACR_TAG_SIZE) return (MDC_BAD_READ); if (acrtag[0].group == 0x0008) MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; else { MDC_FILE_ENDIAN = !MDC_HOST_ENDIAN; } MdcSwapTag(&acrtag[0]); if (acrtag[0].group != 0x0008) return(MDC_FRMT_NONE); fseek(fi->ifp,(signed)acrtag[0].length,SEEK_CUR); r = fread((Uint8 *)&acrtag[1], 1, MDC_ACR_TAG_SIZE, fi->ifp); if (r != MDC_ACR_TAG_SIZE) return (MDC_BAD_READ); MdcSwapTag(&acrtag[1]); fseek(fi->ifp, (signed)acrtag[1].length, SEEK_CUR); r = fread((Uint8 *)&acrtag[2], 1, MDC_ACR_TAG_SIZE, fi->ifp); if (r != MDC_ACR_TAG_SIZE) return (MDC_BAD_READ); MdcSwapTag(&acrtag[2]); if (acrtag[1].group != 0x0008) return(MDC_FRMT_NONE); if (acrtag[2].group != 0x0008) return (MDC_FRMT_NONE); /* return(MDC_FRMT_ACR) */ /* test on Acr/Nema Recognition code as well */ /* to prevent little implicit DICOM files */ fseek(fi->ifp,(signed)0,SEEK_SET); tag = (MDC_ACR_TAG *)&acrtag[0]; while( ftell(fi->ifp) < MDC_HACK_BYTES) { if (fread((Uint8 *)tag,1,MDC_ACR_TAG_SIZE,fi->ifp) != MDC_ACR_TAG_SIZE) return(MDC_BAD_READ); MdcSwapTag(tag); if (tag->length == 0xffffffff) tag->length = 0; if ((tag->group == 0x0008) && (tag->element == 0x0010)) { if ((tag->data=malloc(tag->length+1)) == NULL) return(MDC_BAD_ALLOC); tag->data[tag->length]='\0'; if (fread(tag->data,1,tag->length,fi->ifp) != tag->length) { MdcFree(tag->data); return(MDC_BAD_READ); } MdcLowStr((char *)tag->data); if (strstr((char *)tag->data,"acr-nema") != NULL) FRMT = MDC_FRMT_ACR; MdcFree(tag->data); return(FRMT); }else{ fseek(fi->ifp,(signed)tag->length,SEEK_CUR); } if (ferror(fi->ifp)) return(MDC_BAD_READ); } return(FRMT); } void MdcSwapTag(MDC_ACR_TAG *tag) { MdcSWAP(tag->group); MdcSWAP(tag->element); MdcSWAP(tag->length); } int MdcFindAcrInfo(FILEINFO *fi,Uint32 filesize, Uint32 *BeginAddress) { FILE *fp=fi->ifp; MDC_ACR_TAG acrtag, *tag=NULL; Uint32 AddressFound=(*BeginAddress); int HackSuccess=0, i, r; tag = (MDC_ACR_TAG *)&acrtag; fseek(fp,(signed)AddressFound,SEEK_SET); while( (ftell(fp) < MDC_HACK_BYTES) && (HackSuccesslength == 0xffffffff ) tag->length = 0; fseek(fp,(signed)tag->length,SEEK_CUR); tag->data=NULL; tag->length=0; /* leave data out */ MdcDoTag(NULL,tag,fi,0); if (MDC_HACK_SUCCESS) { MDC_HACK_SUCCESS = MDC_NO; HackSuccess+=1; }else{ MDC_HACK_SUCCESS = MDC_NO; HackSuccess=0; } } if (HackSuccess < MDC_TAGS_NEEDED) { AddressFound+=1; fseek(fp,(signed)AddressFound,SEEK_SET); } } *BeginAddress = AddressFound; if (HackSuccess < MDC_TAGS_NEEDED) return(MDC_NO); return(MDC_YES); } int MdcGetAcrInfo(FILEINFO *fi, Uint32 filesize, Uint32 offset) { FILE *fp = fi->ifp; MDC_ACR_TAG acrtag, *tag=NULL; Uint32 BytesPerImage; tag = (MDC_ACR_TAG *)&acrtag; fseek(fp,(signed)offset,SEEK_SET); while ( (ftell(fp) + MDC_ACR_TAG_SIZE) < filesize ) { if (fread((Uint8 *)tag,1,MDC_ACR_TAG_SIZE,fp) != MDC_ACR_TAG_SIZE) continue; MdcSwapTag(tag); if (tag->length == 0xffffffff) tag->length = 0; if ((tag->data=malloc(tag->length+1)) == NULL) { fseek(fp,(signed)tag->length,SEEK_CUR); continue; } tag->data[tag->length]='\0'; if (fread(tag->data,1,tag->length,fp) != tag->length) { MdcFree(tag->data); continue; } MdcDoTag(NULL,tag,fi,0); MdcFree(tag->data); } BytesPerImage = fi->image[0].width*fi->image[0].height; BytesPerImage *= MdcPixels2Bytes(fi->image[0].bits); if (BytesPerImage > 0 ) return(MDC_YES); return(MDC_NO); } /* experimental and will fail for images with different sizes */ char *MdcHackACR(FILEINFO *fi) { FILE *fp = fi->ifp; MDC_ACR_TAG acrtag, *tag=NULL; Uint32 filesize, BytesOffset, BeginAddress=0; Uint32 MaxImages=0, BytesPerImage=0, BytesPerPixel=0; Uint32 i, img=0, *ImagesOffsets=NULL; int found=MDC_NO; /* initialize some things */ MDC_INFO = MDC_NO; tag = (MDC_ACR_TAG *)&acrtag; fseek(fp,0L, SEEK_END); filesize = ftell(fp); fseek(fp,0L, SEEK_SET); /* MDC_HACK_BYTES = filesize; hack the whole file if you want */ MdcPrntScrn("\nACR Hacking <%s> for %u bytes ... ",fi->ifname ,MDC_HACK_BYTES); /* get an IMG_DATA struct */ if (!MdcGetStructID(fi,1)) return("ACR - Hack - Bad malloc IMG_DATA struct"); /* hack for HostEndian */ MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; BeginAddress=0; while ( (!found) && (BeginAddress < MDC_HACK_BYTES)) { found=MdcFindAcrInfo(fi,filesize,&BeginAddress); if (found) found=MdcGetAcrInfo(fi,filesize,BeginAddress); if (!found) BeginAddress+=1; } if (found == MDC_NO) { /* hack for NoHostEndian */ MDC_FILE_ENDIAN = !MDC_HOST_ENDIAN; BeginAddress=0; while ( (!found) && (BeginAddress < MDC_HACK_BYTES)) { found=MdcFindAcrInfo(fi,filesize,&BeginAddress); if (found) found=MdcGetAcrInfo(fi,filesize,BeginAddress); if (!found) BeginAddress+=1; } } MDC_INFO=MDC_YES; /* print out/rework the information */ if (found == MDC_YES) { MdcPrntScrn("\n"); BytesPerPixel = MdcPixels2Bytes(fi->image[0].bits); BytesPerImage = fi->image[0].width*fi->image[0].height*BytesPerPixel; if (BytesPerImage > 0 ) MaxImages = filesize/BytesPerImage; if (MaxImages > 0) { ImagesOffsets=(Uint32 *)malloc((MaxImages+100)*sizeof(Uint32)); /* +100 as safe buffer */ if (ImagesOffsets == NULL) { return("ACR - Hack - Couldn't malloc ImagesOffsets array"); }else{ ImagesOffsets[0]=0; /* keeps the number of offsets */ } }else{ return("ACR - Hack - Failed to find number of images"); } fseek(fp,(signed)BeginAddress,SEEK_SET); while ( ((BytesOffset=ftell(fp)) + MDC_ACR_TAG_SIZE) <= filesize ) { if (fread((Uint8 *)tag,1,MDC_ACR_TAG_SIZE,fp) != MDC_ACR_TAG_SIZE) continue; MdcSwapTag(tag); if (tag->length == 0xffffffff ) tag->length = 0; if ((tag->data=malloc(tag->length+1)) == NULL) { fseek(fp,(signed)tag->length,SEEK_CUR); continue; } tag->data[tag->length]='\0'; if (fread(tag->data,1,tag->length,fp) != tag->length) { MdcFree(tag->data); continue; } MdcPrntScrn("\n==========>> BYTES OFFSET NEXT TAG: %u\n",BytesOffset); MdcDoTag(NULL,tag,fi,0); /* real Acr/Nema tag for image => real offset to image */ if (tag->group == 0x7fe0 && tag->element == 0x0010) { ImagesOffsets[img++]=BytesOffset + MDC_ACR_TAG_SIZE; }else if ((tag->length / BytesPerImage) == 1) { ImagesOffsets[img++]=BytesOffset + MDC_ACR_TAG_SIZE; } MdcFree(tag->data); } MdcPrntScrn("\n"); MdcPrntScrn("===================\n"); MdcPrntScrn("FINAL ACR-HACK INFO\n"); MdcPrntScrn("===================\n\n"); MdcPrntScrn("Patient/Study Info\n"); MdcPrntScrn("------------------\n"); MdcPrntScrn(" Patient Name : %s\n",fi->patient_name); MdcPrntScrn(" Patient Sex : %s\n",fi->patient_sex); MdcPrntScrn(" Patient ID : %s\n",fi->patient_id); MdcPrntScrn(" Study Descr : %s\n",fi->study_descr); MdcPrntScrn(" Study ID : %s\n",fi->study_id); MdcPrntScrn(" Study Date : %d/%d/%d [dd/mm/yyyy]\n",fi->study_date_day ,fi->study_date_month ,fi->study_date_year); MdcPrntScrn(" Study Time : %d:%d:%d [hh/mm/ss]\n",fi->study_time_hour ,fi->study_time_minute ,fi->study_time_second); MdcPrntScrn("\n"); MdcPrntScrn("Pixel/Slice Info\n"); MdcPrntScrn("------------------\n"); MdcPrntScrn(" Pixel Size : %+e [mm]\n",fi->image[0].pixel_ysize); MdcPrntScrn(" Slice Width : %+e [mm]\n",fi->image[0].slice_width); MdcPrntScrn("\n"); MdcPrntScrn("Images/Pixel Info\n"); MdcPrntScrn("------------------\n"); MdcPrntScrn(" Host Endian Type : %s\n",MdcGetStrEndian(MDC_HOST_ENDIAN)); MdcPrntScrn(" File Endian Type : %s\n",MdcGetStrEndian(MDC_FILE_ENDIAN)); MdcPrntScrn(" Offset First TAG : %u\n",BeginAddress); MdcPrntScrn(" Image Columns [X]: %u\n",fi->image[0].width); MdcPrntScrn(" Image Rows [Y]: %u\n",fi->image[0].height); MdcPrntScrn(" Bits / Pixel : %hd\n",fi->image[0].bits); MdcPrntScrn(" Bytes / Pixel : %u ",BytesPerPixel); switch(BytesPerPixel) { case 1: MdcPrntScrn("(Int8 , Uint8 , 1bit, ?)\n"); break; case 2: MdcPrntScrn("(Int16, Uint16, ?)\n"); break; case 4: MdcPrntScrn("(Int32, Uint32, float, ?)\n"); break; case 8: MdcPrntScrn("(Int64, Uint64, double, ?)\n"); break; default: MdcPrntScrn("(?)\n"); } MdcPrntScrn(" Possible Pix Type: %s\n" ,MdcGetStrPixelType(fi->image[0].type)); MdcPrntScrn(" Bytes / Image : %u\n",BytesPerImage); MdcPrntScrn(" Filesize : %u\n",filesize); if (BytesPerImage > 0) MdcPrntScrn(" Maximum Images : %u\n",MaxImages); else MdcPrntScrn(" Maximum Images : \n"); /* where to find the images? */ MdcPrntScrn("\n"); MdcPrntScrn("Possible Offsets to Images\n"); MdcPrntScrn("--------------------------\n"); MdcPrntScrn("\n a) tags->length ~ Bytes/Image:\n"); if (img == 0) { MdcPrntScrn("\n\t \n"); }else{ for (i=0; iifp; IMG_DATA *id = NULL; MDC_ACR_TAG acrtag, *tag = NULL; MDC_DICOM_STUFF_T *dicom=&mdc_dicom_stuff; Uint32 i, filesize, frames=1, t, number=0; int IMAGE = MDC_YES, r; const char *err=NULL; if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Reading Acr/Nema:"); if (MDC_VERBOSE) MdcPrntMesg("ACR Reading <%s> ...",fi->ifname); fseek(fp,0L, SEEK_END); filesize = ftell(fp); fseek(fp,0L, SEEK_SET); tag = (MDC_ACR_TAG *)&acrtag; /* put some defaults we use */ fi->reconstructed = MDC_YES; fi->acquisition_type = MDC_ACQUISITION_TOMO; /* init dicom struct */ MdcDicomInitStuff(dicom); /* init MOD structs */ MdcGetStructMOD(fi); /* get endian of file */ r = fread((Uint8 *)tag, 1, MDC_ACR_TAG_SIZE, fi->ifp); if (r != MDC_ACR_TAG_SIZE) return("ACR Failure to read tag (endianess)."); if (tag->group == 0x0008) MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; else { MDC_FILE_ENDIAN = !MDC_HOST_ENDIAN; } MdcSwapTag(tag); if (tag->group != 0x0008) return("ACR Bad initial group"); fseek(fp,0,SEEK_SET); while ( (ftell(fp) + MDC_ACR_TAG_SIZE) <= filesize ) { #if MDC_INCLUDE_DICM /* in case of MOSAIC, follow DICOM path */ if (MdcCheckMosaic(fi,dicom) == MDC_YES) { char *filename; MdcMergePath(fi->ipath,fi->idir,fi->ifname); MdcAddCompressionExt(fi->compression,fi->ipath); filename = malloc(strlen(fi->ipath)+1); if (filename != NULL) { strncpy(filename,fi->ipath,strlen(fi->ipath)+1); MdcCleanUpFI(fi); if (MdcOpenFile(fi,filename) == MDC_OK) err = MdcReadDICM(fi); MdcFree(filename); return(err); } return("ACR Handling as mosaic failed"); } #endif if (IMAGE) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_SET,0.0,NULL); if (!MdcGetStructID(fi,fi->number+1)) return("ACR Bad malloc IMG_DATA struct"); id = &fi->image[fi->number-1]; IMAGE = MDC_NO; } if (fread((Uint8 *)tag,1,MDC_ACR_TAG_SIZE,fp) != MDC_ACR_TAG_SIZE) return("ACR Bad read of tag"); MdcSwapTag(tag); if ((tag->group == 0x7fe0) && (tag->element == 0x0010)) { if (MDC_ECHO_ALIAS == MDC_YES) break; /* no interest in images */ frames = 1; for (t=3;tdim[t]; if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_SET,0.5,NULL); IMAGE = MDC_YES; tag->data=NULL; number+=1; if ((id->buf = MdcGetImgBuffer(tag->length)) == NULL) return("ACR Bad malloc image buffer"); if (fread(id->buf,1,tag->length,fp) != tag->length) { err=MdcHandleTruncated(fi,fi->number,MDC_NO); if (err != NULL) return(err); break; } if (id->bits == 12) { if (MdcUnpackBIT12(fi,fi->number-1) != MDC_YES) { return("ACR Unpacking 12 bits failed"); } } if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_SET,1.0,NULL); }else{ if (tag->length == 0xffffffff ) tag->length = 0; if (filesize - ftell(fp) >= tag->length) { /* not yet at end of file */ if ((tag->data=malloc(tag->length+1)) == NULL) return("ACR Bad malloc tag data"); tag->data[tag->length]='\0'; if (fread(tag->data,1,tag->length,fp) != tag->length) { MdcFree(tag->data); return("ACR Bad read tag data"); } }else{ /* position at the end of file */ fseek(fp,0,SEEK_END); } } err=MdcDoTag(NULL,tag,fi,fi->number-1); if (err!=NULL) return(err); MdcFree(tag->data); } if (MDC_ECHO_ALIAS == MDC_YES) { MdcEchoAliasName(fi); return(NULL); } if (fi->image[0].buf == NULL) return("ACR No valid images found"); if (number < fi->number) { /* file with some bogus tags after last image */ /* which incremented fi->number unexpected */ if (!MdcGetStructID(fi, number)) return("Couldn't realloc IMG_DATA structs"); } /* fill in FILEINFO */ fi->endian = MDC_FILE_ENDIAN; fi->bits = fi->image[0].bits; fi->dim[0] = 3; fi->dim[3] = fi->number; fi->pixdim[0] = 3.; fi->pixdim[1] = fi->image[0].pixel_xsize; fi->pixdim[2] = fi->image[0].pixel_ysize; fi->pixdim[3] = fi->image[0].slice_width; /* check Acr/Nema stuff per image */ for (i=0; inumber; i++) { id = &fi->image[i]; if (MDC_TRUE_GAP == MDC_YES) id->slice_spacing += id->slice_width; if (id->image_orient_pat[0] == 0.0 && id->image_orient_pat[1] == 0.0 && id->image_orient_pat[4] == 0.0 && id->image_orient_pat[5] == 0.0 ) { /* no patient coordinate system defines in Acr/Nema, try pat_orient */ fi->pat_slice_orient = MdcTryPatSliceOrient(fi->pat_orient); if (fi->pat_slice_orient != MDC_UNKNOWN) { MdcFillImgPos(fi,i,fi->dim[3]==0 ? 0 : i%fi->dim[3],0.0); MdcFillImgOrient(fi,i); } } } MdcCloseFile(fi->ifp); if(fi->truncated) return("ACR Truncated image file"); return NULL; } /* just an experiment, but don't like to lose it */ /*void MdcHandleNUMARIS2(Uint8 *data) { Uint8 *pdata=data; char *ps; Int16 *i16; Int32 *i32; Int16 patient_info; MdcPrntScrn("\n"); MdcPrintLine('*',MDC_FULL_LENGTH); MdcPrntScrn("\n"); pdata = data; MdcPrntScrn("Entry Table:\n"); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("Number of entries: %hd\n",*i16); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("Entry length - words per entry: %hd\n",*i16); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("Block length in byte: %hd\n",*i16); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("First free block in image file: %hd\n",*i16); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("Number of first block of installation: %hd\n",*i16); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("Length of installation in blocks: %hd\n",*i16); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("Number of first block of measurement: %hd\n",*i16); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("Length of measurement in blocks: %hd\n",*i16); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("Number of first block of image text: %hd\n",*i16); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("Length of image text in blocks: %hd\n",*i16); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("Number of first i/r/a/p info: %hd\n",*i16); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("Length of i/r/a/p info in blocks: %hd\n",*i16); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("Number of first block of correction: %hd\n",*i16); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("Length of correction blocks: %hd\n",*i16); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("Number of first block NUMARIS1 #1: %hd\n",*i16); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("Length of NUMARIS1 #1 in blocks: %hd\n",*i16); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("Number of first block NUMARIS1 #2: %hd\n",*i16); i16=(Int16 *)pdata; pdata+=2; MdcPrntScrn("Length of NUMARIS1 #2 in blocks: %hd\n",*i16); MdcPrntScrn("\netc, etc, etc ...\n"); pdata = data; pdata+=44; i16=(Int16 *)pdata; patient_info=*i16 - 5; MdcPrntScrn("Patient_info block number: %hd\n",patient_info); pdata = data+(patient_info*512); ps = (char *)pdata; MdcPrntScrn("Patient name = %.26s\n",ps); pdata = data+(patient_info*512)+28; ps = (char *)pdata; MdcPrntScrn("Patient ID = %.12s\n",ps); MdcPrntScrn("\n"); MdcPrintLine('*',MDC_FULL_LENGTH); MdcPrntScrn("\n"); } */ void MdcPrintTag( FILEINFO *fi, MDC_ACR_TAG *tag, char *fmt, ...) { va_list args; if (MDC_INFO) { if (MDC_DEBUG) { MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("[next offset: %lu]\n",ftell(fi->ifp)); } MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("Group (2): 0x%.4x\n",tag->group); MdcPrntScrn("Element (2): 0x%.4x\n",tag->element); MdcPrntScrn("Length (4): %d\n",tag->length); } va_start(args, fmt); vsprintf(mdcbufr,fmt,args); if (MDC_INFO) { if ( tag->length == 0 ) MdcPrntScrn("%.30s \n",mdcbufr); else if ( tag->length > MDC_MAX_CHARS ) MdcPrntScrn("%.30s \n",mdcbufr); else MdcPrntScrn("%s",mdcbufr); } va_end(args); if (strstr(mdcbufr,"Unknown ") != NULL) { MDC_HACK_SUCCESS = MDC_NO; }else{ MDC_HACK_SUCCESS = MDC_YES; } } /* get nr (one based) element of a multiple value element with strings */ int MdcGetStrVM(char *dest,char *src, Uint32 nr) { int ret; ret = MdcGetSubStr(dest,src,MDC_2KB_OFFSET,'\\',(signed)nr); return(ret); } void MdcDicomInitStuff(MDC_DICOM_STUFF_T *dicom) { int i; dicom->type = BIT16_S; dicom->modality = M_NM; dicom->INVERT = MDC_NO; dicom->si_slope = 1.; dicom->si_intercept = 0.; dicom->acqnr = 0; dicom->dynnr = 0; dicom->motion = 0; for (i=0; iVectDO[i] = MDC_PASS0; dicom->VectNR[i] = 1; } dicom->timeslottime = 0.; dicom->frametime = 0.; dicom->framestart = 0.; dicom->frameduration = 0.; dicom->nrframes = 0.; dicom->window_low = 0.; dicom->window_high = 0.; dicom->scan_arc = 0.; dicom->intervals_acquired = 0.; dicom->intervals_rejected = 0.; dicom->heart_rate = 0; if (MDC_DICOM_MOSAIC_FORCED == MDC_YES) { dicom->MOSAIC = MDC_YES; dicom->mosaic_interlaced = mdc_mosaic_interlaced; }else{ dicom->MOSAIC = MDC_NO; dicom->mosaic_interlaced = MDC_NO; } dicom->mosaic_width = mdc_mosaic_width; dicom->mosaic_height= mdc_mosaic_height; dicom->mosaic_number= mdc_mosaic_number; } void MdcDicomCheckVect(MDC_DICOM_STUFF_T *dicom, MDC_ACR_TAG *tag, int VECTOR) { Uint16 *pu16, hval=1, vect; Uint32 vm, c; if (dicom->VectDO[VECTOR] == MDC_PASS1) { vm = tag->length / 2; pu16 = (Uint16 *)tag->data; for (c=0; c hval) hval = vect; } if (vm > 0 ) { dicom->VectNR[VECTOR] = hval; dicom->VectDO[VECTOR] = MDC_PASS2; } } } Uint32 MdcDicomNrOfVect(MDC_DICOM_STUFF_T *dicom, Uint16 nr, int VECTOR) { Uint32 rval=(Uint32)nr; if (dicom->VectDO[VECTOR] == MDC_PASS2) rval=(Uint32)dicom->VectNR[VECTOR]; return(rval); } int MdcDicomDoAcqData(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { if ((dicom->acqnr > 0) && (dicom->acqnr <= fi->acqnr) && (fi->acqdata != NULL)) { return(MDC_YES); } return(MDC_NO); } int MdcDicomSOPClass(char *sopclass) { int mod = M_NM; if (strcmp(sopclass,"1.2.840.10008.5.1.4.1.1.2") == 0) mod = M_CT; else if (strcmp(sopclass,"1.2.840.10008.5.1.4.1.1.4") == 0) mod = M_MR; else if (strcmp(sopclass,"1.2.840.10008.5.1.4.1.1.20") == 0) mod = M_NM; else if (strcmp(sopclass,"1.2.840.10008.5.1.4.1.1.128") == 0) mod = M_PT; return (mod); } int MdcGetHHMMSS(char *time, Int16 *hour, Int16 *minute, Int16 *second) { char *pitem=time; while (!MdcIsDigit(pitem[0])) { if (strlen(pitem) > 1) pitem++; else break; } if (strlen(pitem) >= 2) sscanf(pitem,"%02hd",hour); if (strlen(pitem) > 2) pitem+=2; while (!MdcIsDigit(pitem[0])) { if (strlen(pitem) > 1) pitem++; else break; } if (strlen(pitem) >= 2) sscanf(pitem,"%02hd",minute); if (strlen(pitem) > 2) pitem+=2; while (!MdcIsDigit(pitem[0])) { if (strlen(pitem) > 1) pitem++; else break; } if (strlen(pitem) >= 2) sscanf(pitem,"%02hd",second); return(MDC_YES); } /* Note: index for IMG_DATA structs is 0-based */ char *MdcDoTag(MDC_SEQ_TAG *seq, MDC_ACR_TAG *tag, FILEINFO *fi, Uint32 index) { IMG_DATA *id; DYNAMIC_DATA *dd; MDC_DICOM_STUFF_T *dicom=&mdc_dicom_stuff; static Int16 bits_allocated = 0, bits_stored = 0; char databuffer[MDC_MAX_CHARS+1], *pc=NULL, *ps=NULL, *pitem=NULL; Int16 i16=0; Int32 i32=0; Uint16 ui16=0; Uint32 ui32=0; double flt64=0.; Uint16 group, element, *pu16; Uint32 i=index, bytes, c , vm, tmp; Uint8 FILL_STATIC_DATA = MDC_NO; Uint8 FILL_DYNAMIC_DATA = MDC_NO; float flt; memset(databuffer,'\0',MDC_MAX_CHARS+1); /*always a nul-terminated string*/ if (tag->data != NULL) { if (tag->length >= MDC_MAX_CHARS) { bytes=MDC_MAX_CHARS; }else{ bytes=tag->length; } if (bytes > 0) memcpy(databuffer,tag->data,bytes); } ps = databuffer; memcpy((char *)&i16,databuffer,sizeof(Int16)); MdcSWAP(i16); memcpy((char *)&i32,databuffer,sizeof(Int32)); MdcSWAP(i32); memcpy((char *)&ui16,databuffer,sizeof(Uint16)); MdcSWAP(ui16); memcpy((char *)&ui32,databuffer,sizeof(Uint32)); MdcSWAP(ui32); memcpy((char *)&flt64,databuffer,sizeof(flt64)); MdcSWAP(flt64); id = &fi->image[i]; /* need of filling static data struct? */ if (id->sdata != NULL) FILL_STATIC_DATA = MDC_YES; /* need of filling dynamic data struct? */ if (fi->dyndata != NULL) FILL_DYNAMIC_DATA = MDC_YES; /* handle ordinary tags */ switch (tag->group) { /* group 0x0002 */ case 0x0002: switch (tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Meta Element - Group 0002\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %d\n",i32); break; case 0x0002: MdcPrintTag(fi,tag,"Media Storage SOPClassUID : %s\n",ps); dicom->modality = MdcDicomSOPClass(ps); break; case 0x0003: MdcPrintTag(fi,tag,"Media Storage SOPInstanceUID : %s\n",ps); break; case 0x0010: MdcPrintTag(fi,tag,"TransferSyntaxUID : %s\n",ps); break; case 0x0012: MdcPrintTag(fi,tag,"ImplementationClassUID : %s\n",ps); break; case 0x0013: MdcPrintTag(fi,tag,"Implementation Version Name : %s\n",ps); break; } break; /* group 0x0008 */ case 0x0008: switch (tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Identifying Information - Group 0008\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0001: MdcPrintTag(fi,tag,"Total Number of Bytes : %u\n",ui32); break; case 0x0005: MdcPrintTag(fi,tag,"Specific Character Set : %s\n",ps); break; case 0x0008: MdcPrintTag(fi,tag,"Image Type : %s\n",ps); if (MdcGetStrVM(mdcbufr,ps,3) == MDC_YES) { MdcKillSpaces(mdcbufr); if (strcasecmp(mdcbufr,"RECON GATED TOMO") == 0) { fi->acquisition_type = MDC_ACQUISITION_GSPECT; fi->reconstructed = MDC_YES; }else if (strcasecmp(mdcbufr,"RECON TOMO") == 0) { fi->acquisition_type = MDC_ACQUISITION_TOMO; fi->reconstructed = MDC_YES; }else if (strcasecmp(mdcbufr,"GATED TOMO") == 0) { fi->acquisition_type = MDC_ACQUISITION_GSPECT; fi->reconstructed = MDC_NO; }else if (strcasecmp(mdcbufr,"TOMO") == 0) { fi->acquisition_type = MDC_ACQUISITION_TOMO; fi->reconstructed = MDC_NO; }else if (strcasecmp(mdcbufr,"WHOLE BODY") == 0) { fi->acquisition_type = MDC_ACQUISITION_STATIC; fi->reconstructed = MDC_YES; fi->planar = MDC_YES; }else if (strcasecmp(mdcbufr,"GATED") == 0) { fi->acquisition_type = MDC_ACQUISITION_GATED; fi->reconstructed = MDC_YES; fi->planar = MDC_YES; }else if (strcasecmp(mdcbufr,"DYNAMIC") == 0) { fi->acquisition_type = MDC_ACQUISITION_DYNAMIC; fi->reconstructed = MDC_YES; fi->planar = MDC_YES; }else if (strcasecmp(mdcbufr,"STATIC") == 0) { fi->acquisition_type = MDC_ACQUISITION_STATIC; fi->reconstructed = MDC_YES; fi->planar = MDC_YES; }else{ fi->acquisition_type = MDC_ACQUISITION_TOMO; fi->reconstructed = MDC_YES; } } if (fi->acquisition_type == MDC_ACQUISITION_GATED || fi->acquisition_type == MDC_ACQUISITION_GSPECT ) { /* MARK: limited to one yet */ if (!MdcGetStructGD(fi,1)) { return("ACR Couldn't malloc GATED_DATA structs"); } } if (fi->acquisition_type == MDC_ACQUISITION_STATIC) { if (!MdcGetStructSD(fi,fi->number)) { return("ACR Couldn't malloc STATIC_DATA structs"); } } if (fi->reconstructed == MDC_NO) { dicom->acqnr = 1; if (!MdcGetStructAD(fi,dicom->acqnr)) { dicom->acqnr = 0; return("ACR Couldn't malloc ACQ_DATA struct"); } } break; case 0x0010: MdcPrintTag(fi,tag,"Recognition Code : %s\n",ps); break; case 0x0012: MdcPrintTag(fi,tag,"Instance Creation Date : %s\n",ps); break; case 0x0013: MdcPrintTag(fi,tag,"Instance Creation Time : %s\n",ps); break; case 0x0014: MdcPrintTag(fi,tag,"Instance Creator UID : %s\n",ps); break; case 0x0016: MdcPrintTag(fi,tag,"SOP Class UID : %s\n",ps); dicom->modality = MdcDicomSOPClass(ps); break; case 0x0018: MdcPrintTag(fi,tag,"SOP Instance UID : %s\n",ps); break; case 0x0020: MdcPrintTag(fi,tag,"Study Date : %s\n",ps); if (fi->mod != NULL) { MdcStringCopy(fi->mod->gn_info.study_date,ps,MDC_MAXSTR); } pitem = ps; while (!MdcIsDigit(pitem[0])) { if (strlen(pitem) > 1) pitem++; else break; } if (strlen(pitem) >= 4) sscanf(pitem,"%04hd",&fi->study_date_year); if (strlen(pitem) > 4) pitem+=4; while (!MdcIsDigit(pitem[0])) { if (strlen(pitem) > 1) pitem++; else break; } if (strlen(pitem) >= 2) sscanf(pitem,"%02hd",&fi->study_date_month); if (strlen(pitem) > 2) pitem+=2; while (!MdcIsDigit(pitem[0])) { if (strlen(pitem) > 1) pitem++; else break; } if (strlen(pitem) >= 2) sscanf(pitem,"%02hd",&fi->study_date_day); break; case 0x0021: MdcPrintTag(fi,tag,"Series Date : %s\n",ps); if (fi->mod != NULL) { MdcStringCopy(fi->mod->gn_info.series_date,ps,MDC_MAXSTR); } break; case 0x0022: MdcPrintTag(fi,tag,"Acquisition Date : %s\n",ps); if (fi->mod != NULL) { MdcStringCopy(fi->mod->gn_info.acquisition_date,ps,MDC_MAXSTR); } break; case 0x0023: MdcPrintTag(fi,tag,"Image Date : %s\n",ps); if (fi->mod != NULL) { MdcStringCopy(fi->mod->gn_info.image_date,ps,MDC_MAXSTR); } break; case 0x0030: MdcPrintTag(fi,tag,"Study Time : %s\n",ps); if (fi->mod != NULL) { MdcStringCopy(fi->mod->gn_info.study_time,ps,MDC_MAXSTR); } MdcGetHHMMSS(ps,&fi->study_time_hour ,&fi->study_time_minute ,&fi->study_time_second); break; case 0x0031: MdcPrintTag(fi,tag,"Series Time : %s\n",ps); if (fi->mod != NULL) { MdcStringCopy(fi->mod->gn_info.series_time,ps,MDC_MAXSTR); } break; case 0x0032: MdcPrintTag(fi,tag,"Acquisition Time : %s\n",ps); if (fi->mod != NULL) { MdcStringCopy(fi->mod->gn_info.acquisition_time,ps,MDC_MAXSTR); } if (FILL_STATIC_DATA == MDC_YES) { MdcGetHHMMSS(ps,&id->sdata->start_time_hour ,&id->sdata->start_time_minute ,&id->sdata->start_time_second); } break; case 0x0033: MdcPrintTag(fi,tag,"Image Time : %s\n",ps); if (fi->mod != NULL) { MdcStringCopy(fi->mod->gn_info.image_time,ps,MDC_MAXSTR); } break; case 0x0040: MdcPrintTag(fi,tag,"Data Set Type : 0x%.4x",ui16); if (MDC_INFO) switch (ui16) { case 0x0000: MdcPrntScrn(" (= image)\n"); break; case 0x0001: MdcPrntScrn(" (= compressed image)\n"); break; case 0x0002: MdcPrntScrn(" (= graphics)\n"); break; case 0x0003: MdcPrntScrn(" (= text)\n"); break; case 0x0010: MdcPrntScrn(" (= folder/raw)\n"); break; case 0x0100: MdcPrntScrn(" (= other)\n"); break; case 0x0101: MdcPrntScrn(" (= null)\n"); break; case 0x0102: MdcPrntScrn(" (= identifier)\n"); break; case 0x8000: MdcPrntScrn(" (= private image)\n"); break; case 0x8002: MdcPrntScrn(" (= private graphic)\n"); break; case 0x8003: MdcPrntScrn(" (= private text)\n"); break; default : MdcPrntScrn(" (= unknown)\n"); break; } break; case 0x0041: MdcPrintTag(fi,tag,"Data Set Subtype : %s\n",ps); break; case 0x0050: MdcPrintTag(fi,tag,"Accession Number : %s\n",ps); break; case 0x0060: MdcPrintTag(fi,tag,"Image Modality : %s\n",ps); fi->modality = MdcGetIntModality(ps); break; case 0x0070: MdcPrintTag(fi,tag,"Manufacturer : %s\n",ps); MdcStringCopy(fi->manufacturer,ps,tag->length); break; case 0x0080: MdcPrintTag(fi,tag,"Institution ID : %s\n",ps); MdcStringCopy(fi->institution,ps,tag->length); break; case 0x0090: MdcPrintTag(fi,tag,"Referring Physician : %s\n",ps); break; case 0x0100: MdcPrintTag(fi,tag,"Code Value : %s\n",ps); break; case 0x0102: MdcPrintTag(fi,tag,"Coding Scheme Designator : %s\n",ps); break; case 0x0104: MdcPrintTag(fi,tag,"Code Meaning : %s\n",ps); if (seq != NULL) { switch (seq->group) { case 0x0054: switch (seq->element) { case 0x0300: /* radionuclide (isotope) */ MdcStringCopy(fi->isotope_code,ps,strlen(ps)); break; case 0x0304: /* radiopharma */ MdcStringCopy(fi->radiopharma,ps,strlen(ps)); break; case 0x0220: /* static label */ if (FILL_STATIC_DATA == MDC_YES) MdcStringCopy(id->sdata->label,ps,strlen(ps)); break; } break; } } break; case 0x1000: MdcPrintTag(fi,tag,"Network ID : %s\n",ps); break; case 0x1010: MdcPrintTag(fi,tag,"Station ID : %s\n",ps); break; case 0x1030: MdcPrintTag(fi,tag,"Study Description : %s\n",ps); MdcKillSpaces(ps); MdcStringCopy(fi->study_descr,ps,tag->length); break; case 0x103E: MdcPrintTag(fi,tag,"Series Description : %s\n",ps); if (tag->length > 0) { MdcKillSpaces(ps); MdcStringCopy(fi->series_descr,ps,tag->length); } break; case 0x1040: MdcPrintTag(fi,tag,"Institutional Department : %s\n",ps); break; case 0x1050: MdcPrintTag(fi,tag,"Attending Physician : %s\n",ps); break; case 0x1060: MdcPrintTag(fi,tag,"Radiologist : %s\n",ps); break; case 0x1070: MdcPrintTag(fi,tag,"Operator : %s\n",ps); if (tag->length > 0) { MdcKillSpaces(ps); MdcStringCopy(fi->operator_name,ps,tag->length); } break; case 0x1080: MdcPrintTag(fi,tag,"Admitting Diagnosis : %s\n",ps); break; case 0x1090: MdcPrintTag(fi,tag,"Manufacturer Model : %s\n",ps); if (tag->length >= 16) { /* check for mosaic */ if (strncasecmp(ps,"MAGNETOM VISION",15) == 0) dicom->MOSAIC = MDC_YES; } break; case 0x1150: MdcPrintTag(fi,tag,"SOP Class UID : %s\n",ps); break; case 0x1155: MdcPrintTag(fi,tag,"SOP Instance UID : %s\n",ps); break; case 0x2111: MdcPrintTag(fi,tag,"Derivation Description : %s\n",ps); break; case 0x4000: MdcPrintTag(fi,tag,"Comments : %s\n",ps); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x0009 */ case 0x0009: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Shadow Identifying Information - Group 0009\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0010: MdcPrintTag(fi,tag,"Shadow Owner Code : %s\n",ps); break; case 0x0011: MdcPrintTag(fi,tag,"Shadow Owner Code : %s\n",ps); break; case 0x0080: MdcPrintTag(fi,tag,"Owner ID : %s\n",ps); break; /* MARK BEGIN: GE DISCOVERY */ case 0x1001: MdcPrintTag(fi,tag,"Implentation Name : %s\n",ps); break; case 0x1002: MdcPrintTag(fi,tag,"Suite ID : %s\n",ps); break; case 0x1004: MdcPrintTag(fi,tag,"Product ID : %s\n",ps); break; case 0x1005: MdcPrintTag(fi,tag,"Patient DateTime : %s\n",ps); break; case 0x1006: MdcPrintTag(fi,tag,"Type : %s\n",ps); break; case 0x100a: MdcPrintTag(fi,tag,"Scan ID : %s\n",ps); break; case 0x100d: MdcPrintTag(fi,tag,"Scan DateTime : %s\n",ps); break; case 0x100e: MdcPrintTag(fi,tag,"Scan Ready : %s\n",ps); break; case 0x1013: MdcPrintTag(fi,tag,"For Identifier : %s\n",ps); break; case 0x1014: MdcPrintTag(fi,tag,"Landmark Name : %s\n",ps); break; case 0x1015: /* GE */ MdcPrintTag(fi,tag,"Landmark Abbreviation : %s\n",ps); /* SIEMENS */ MdcPrintTag(fi,tag,"Unique SPI Identifier : %s\n",ps); break; case 0x1016: MdcPrintTag(fi,tag,"Patient Position : %s\n",ps); break; case 0x1017: MdcPrintTag(fi,tag,"Scan Perspective : %s\n",ps); break; case 0x1018: MdcPrintTag(fi,tag,"Scan Type : %s\n",ps); break; case 0x1019: MdcPrintTag(fi,tag,"Scan Mode : %s\n",ps); break; case 0x101a: MdcPrintTag(fi,tag,"Start Condition : %s\n",ps); break; case 0x101b: MdcPrintTag(fi,tag,"Start Condition Data : %s\n",ps); break; case 0x101c: MdcPrintTag(fi,tag,"Sel Stop Condition : %s\n",ps); break; case 0x101d: MdcPrintTag(fi,tag,"Sel Stop Condition Data : %s\n",ps); break; case 0x101e: MdcPrintTag(fi,tag,"Collect Deadtime : %s\n",ps); break; case 0x101f: MdcPrintTag(fi,tag,"Collect Singles : %s\n",ps); break; case 0x1020: MdcPrintTag(fi,tag,"Collect Countrate : %s\n",ps); break; case 0x1021: MdcPrintTag(fi,tag,"Countrate Period : %s\n",ps); break; case 0x1022: MdcPrintTag(fi,tag,"Delayed Events : %s\n",ps); break; case 0x1023: MdcPrintTag(fi,tag,"Delayed Bias : %s\n",ps); break; case 0x1024: MdcPrintTag(fi,tag,"Word Size : %s\n",ps); break; case 0x1025: MdcPrintTag(fi,tag,"Axial Acceptance : %s\n",ps); break; case 0x1026: MdcPrintTag(fi,tag,"Axial Angle 3D : %s\n",ps); break; case 0x1027: /* 0x1027 tag was ambiguously defined in the GE Conformance Statement, */ /* once as "Image actual date" and once as "Theta Compression". */ MdcPrintTag(fi,tag,"Theta Compression : %s\n",ps); break; case 0x1028: MdcPrintTag(fi,tag,"Axial Compression : %s\n",ps); break; case 0x1029: MdcPrintTag(fi,tag,"Gantry Tilt Angle : %s\n",ps); break; case 0x102a: MdcPrintTag(fi,tag,"Collimation : %s\n",ps); break; case 0x102b: MdcPrintTag(fi,tag,"Scan FOV : %s\n",ps); break; case 0x102c: MdcPrintTag(fi,tag,"Axial FOV : %s\n",ps); break; case 0x102d: MdcPrintTag(fi,tag,"Event Separation : %s\n",ps); break; case 0x102e: MdcPrintTag(fi,tag,"Mask Width : %s\n",ps); break; case 0x102f: MdcPrintTag(fi,tag,"Binning Mode : %s\n",ps); break; case 0x1034: MdcPrintTag(fi,tag,"Triggers Acquired : %s\n",ps); break; case 0x1035: MdcPrintTag(fi,tag,"Triggers Rejected : %s\n",ps); break; case 0x1036: MdcPrintTag(fi,tag,"Tracer Name : %s\n",ps); break; case 0x1037: MdcPrintTag(fi,tag,"Batch Description : %s\n",ps); break; case 0x1038: MdcPrintTag(fi,tag,"Tracer Activity : %s\n",ps); break; case 0x1039: MdcPrintTag(fi,tag,"Measure DateTime : %s\n",ps); break; case 0x103a: MdcPrintTag(fi,tag,"Pre Injection Volume : %s\n",ps); break; case 0x103b: MdcPrintTag(fi,tag,"Admin DateTime : %s\n",ps); break; case 0x103c: MdcPrintTag(fi,tag,"Post Injection Activity : %s\n",ps); break; case 0x103d: MdcPrintTag(fi,tag,"Post Injection DateTime : %s\n",ps); break; case 0x103e: MdcPrintTag(fi,tag,"Radionuclide Name : %s\n",ps); break; case 0x103f: MdcPrintTag(fi,tag,"Half Life : %s\n",ps); break; case 0x1040: MdcPrintTag(fi,tag,"Positron Fraction : %s\n",ps); break; case 0x104d: MdcPrintTag(fi,tag,"Emission Present : %s\n",ps); break; case 0x104e: MdcPrintTag(fi,tag,"Lower Axial Acc : %s\n",ps); break; case 0x104f: MdcPrintTag(fi,tag,"Upper Axial Acc : %s\n",ps); break; case 0x1050: MdcPrintTag(fi,tag,"Lower Coincidence Limit : %s\n",ps); break; case 0x1051: MdcPrintTag(fi,tag,"Upper Coincidence Limit : %s\n",ps); break; case 0x1052: MdcPrintTag(fi,tag,"Coincidence Delay Offset : %s\n",ps); break; case 0x1053: MdcPrintTag(fi,tag,"Coincidence Output Mode : %s\n",ps); break; case 0x1054: MdcPrintTag(fi,tag,"Upper Energy Limit : %s\n",ps); break; case 0x1055: MdcPrintTag(fi,tag,"Lower Energy Limit : %s\n",ps); break; case 0x1056: MdcPrintTag(fi,tag,"Normal Cal ID : %s\n",ps); break; case 0x1057: MdcPrintTag(fi,tag,"Normal 2D Cal ID : %s\n",ps); break; case 0x1058: MdcPrintTag(fi,tag,"Blank Cal ID : %s\n",ps); break; case 0x1059: MdcPrintTag(fi,tag,"Well Counter Cal ID : %s\n",ps); break; case 0x105a: MdcPrintTag(fi,tag,"Derived : %s\n",ps); break; case 0x105c: MdcPrintTag(fi,tag,"Frame ID : %s\n",ps); break; case 0x105d: MdcPrintTag(fi,tag,"Scan ID : %s\n",ps); break; case 0x105e: MdcPrintTag(fi,tag,"Exam ID : %s\n",ps); break; case 0x105f: MdcPrintTag(fi,tag,"Patient ID : %s\n",ps); break; case 0x1062: MdcPrintTag(fi,tag,"Where is Frame : %s\n",ps); break; case 0x1063: MdcPrintTag(fi,tag,"Frame Size : %s\n",ps); break; case 0x1064: MdcPrintTag(fi,tag,"File Exists : %s\n",ps); break; case 0x1066: MdcPrintTag(fi,tag,"Table Height : %s\n",ps); break; case 0x1067: MdcPrintTag(fi,tag,"Table Z Position : %s\n",ps); break; case 0x1068: MdcPrintTag(fi,tag,"Landmark DateTime : %s\n",ps); break; case 0x1069: MdcPrintTag(fi,tag,"Slice Count : %s\n",ps); break; case 0x106a: MdcPrintTag(fi,tag,"Start Location : %s\n",ps); break; case 0x106b: MdcPrintTag(fi,tag,"Acquisition Delay : %s\n",ps); break; case 0x106c: MdcPrintTag(fi,tag,"Acquisition Start : %s\n",ps); break; case 0x106d: MdcPrintTag(fi,tag,"Acquisition Duration : %s\n",ps); break; case 0x1070: MdcPrintTag(fi,tag,"Actual Stop Condition : %s\n",ps); break; case 0x1071: MdcPrintTag(fi,tag,"Total Prompts : %s\n",ps); break; case 0x1072: MdcPrintTag(fi,tag,"Total Delays : %s\n",ps); break; case 0x1073: MdcPrintTag(fi,tag,"Frame Valid : %s\n",ps); break; case 0x1074: MdcPrintTag(fi,tag,"Validity Info : %s\n",ps); break; case 0x107c: MdcPrintTag(fi,tag,"Is Source : %s\n",ps); break; case 0x107d: MdcPrintTag(fi,tag,"Is Contents : %s\n",ps); break; case 0x107e: MdcPrintTag(fi,tag,"Is Type : %s\n",ps); break; case 0x107f: MdcPrintTag(fi,tag,"Is Reference : %s\n",ps); break; case 0x1080: MdcPrintTag(fi,tag,"Multi Patient : %s\n",ps); break; case 0x1081: MdcPrintTag(fi,tag,"Number of Normals : %s\n",ps); break; case 0x108b: MdcPrintTag(fi,tag,"Recon Method : %s\n",ps); break; case 0x108c: MdcPrintTag(fi,tag,"Attenuation : %s\n",ps); break; case 0x108d: MdcPrintTag(fi,tag,"Attenuation Coefficient : %s\n",ps); break; case 0x108e: MdcPrintTag(fi,tag,"BP Filter : %s\n",ps); break; case 0x108f: MdcPrintTag(fi,tag,"BP Filter Cutoff : %s\n",ps); break; case 0x1090: MdcPrintTag(fi,tag,"BP Filter Order : %s\n",ps); break; case 0x1091: MdcPrintTag(fi,tag,"BP Center L : %s\n",ps); break; case 0x1092: MdcPrintTag(fi,tag,"BP Center P : %s\n",ps); break; case 0x1093: MdcPrintTag(fi,tag,"Attenuation Smooth : %s\n",ps); break; case 0x1094: MdcPrintTag(fi,tag,"Attenuation Smooth Param : %s\n",ps); break; case 0x1095: MdcPrintTag(fi,tag,"Angle Smooth Param : %s\n",ps); break; case 0x1096: MdcPrintTag(fi,tag,"Well Counter Cal ID : %s\n",ps); break; case 0x1097: MdcPrintTag(fi,tag,"Trans Scan ID : %s\n",ps); break; case 0x1098: MdcPrintTag(fi,tag,"Norm Cal ID : %s\n",ps); break; case 0x109a: MdcPrintTag(fi,tag,"Cac Edge Threshold : %s\n",ps); break; case 0x109b: MdcPrintTag(fi,tag,"Cac Skull Offset : %s\n",ps); break; case 0x109d: MdcPrintTag(fi,tag,"Radial Filter 3D : %s\n",ps); break; case 0x109e: MdcPrintTag(fi,tag,"Radial Cutoff 3D : %s\n",ps); break; case 0x109f: MdcPrintTag(fi,tag,"Axial Filter 3D : %s\n",ps); break; case 0x10a0: MdcPrintTag(fi,tag,"Axial Cutoff 3D : %s\n",ps); break; case 0x10a1: MdcPrintTag(fi,tag,"Axial Start : %s\n",ps); break; case 0x10a2: MdcPrintTag(fi,tag,"Axial Spacing : %s\n",ps); break; case 0x10a3: MdcPrintTag(fi,tag,"Axial Angles Used : %s\n",ps); break; case 0x10a6: MdcPrintTag(fi,tag,"Slice Number : %s\n",ps); break; case 0x10a7: MdcPrintTag(fi,tag,"Total Counts : %s\n",ps); break; case 0x10ab: MdcPrintTag(fi,tag,"BP Center X : %s\n",ps); break; case 0x10ac: MdcPrintTag(fi,tag,"BP Center Y : %s\n",ps); break; case 0x10b2: MdcPrintTag(fi,tag,"IR Number Iterations : %s\n",ps); break; case 0x10b3: MdcPrintTag(fi,tag,"IR Number Subsets : %s\n",ps); break; case 0x10b4: MdcPrintTag(fi,tag,"IR Recon FOV : %s\n",ps); break; case 0x10b5: MdcPrintTag(fi,tag,"IR Corr Model : %s\n",ps); break; case 0x10b6: MdcPrintTag(fi,tag,"IR Loop Filter : %s\n",ps); break; case 0x10b7: MdcPrintTag(fi,tag,"IR Pre Filter Param : %s\n",ps); break; case 0x10b8: MdcPrintTag(fi,tag,"IR Loop Filter Param : %s\n",ps); break; case 0x10b9: MdcPrintTag(fi,tag,"Response Filter Param : %s\n",ps); break; case 0x10ba: MdcPrintTag(fi,tag,"Post Filter : %s\n",ps); break; case 0x10bb: MdcPrintTag(fi,tag,"Post Filter Param : %s\n",ps); break; case 0x10bc: MdcPrintTag(fi,tag,"IR Regularize : %s\n",ps); break; case 0x10bd: MdcPrintTag(fi,tag,"Regulative Param : %s\n",ps); break; case 0x10be: MdcPrintTag(fi,tag,"AC BP Filter : %s\n",ps); break; case 0x10bf: MdcPrintTag(fi,tag,"AC BP Filter Cut Off : %s\n",ps); break; case 0x10c0: MdcPrintTag(fi,tag,"AC BP Filter Order : %s\n",ps); break; case 0x10c1: MdcPrintTag(fi,tag,"AC Image Smooth : %s\n",ps); break; case 0x10c2: MdcPrintTag(fi,tag,"AC Image Smooth Param : %s\n",ps); break; case 0x10c3: MdcPrintTag(fi,tag,"Scatter Method : %s\n",ps); break; case 0x10c4: MdcPrintTag(fi,tag,"Scatter Number Iteration : %s\n",ps); break; case 0x10c5: MdcPrintTag(fi,tag,"Scatter Param : %s\n",ps); break; case 0x10c6: MdcPrintTag(fi,tag,"Seq QC Param : %s\n",ps); break; case 0x10c7: MdcPrintTag(fi,tag,"Overlap : %s\n",ps); break; case 0x10cb: MdcPrintTag(fi,tag,"VQC X Axis Trans : %s\n",ps); break; case 0x10cc: MdcPrintTag(fi,tag,"VQC X Axis Tilt : %s\n",ps); break; case 0x10cd: MdcPrintTag(fi,tag,"VQC Y Axis Trans : %s\n",ps); break; case 0x10ce: MdcPrintTag(fi,tag,"VQC Y Axis Swivel : %s\n",ps); break; case 0x10cf: MdcPrintTag(fi,tag,"VQC Z Axis Trans : %s\n",ps); break; case 0x10d0: MdcPrintTag(fi,tag,"VQC Z Axis Roll : %s\n",ps); break; case 0x10d5: MdcPrintTag(fi,tag,"Loop Filter Param : %s\n",ps); break; case 0x10d6: MdcPrintTag(fi,tag,"Image One Location : %s\n",ps); break; case 0x10d7: MdcPrintTag(fi,tag,"Image Index Location : %s\n",ps); break; case 0x10d8: MdcPrintTag(fi,tag,"Frame Number : %s\n",ps); break; case 0x10d9: MdcPrintTag(fi,tag,"List File Exists : %s\n",ps); break; case 0x10da: MdcPrintTag(fi,tag,"Where is List File : %s\n",ps); break; case 0x10db: MdcPrintTag(fi,tag,"IR Z Filter Flag : %s\n",ps); break; case 0x10dc: MdcPrintTag(fi,tag,"IR Z Filter Ratio : %s\n",ps); break; case 0x10df: MdcPrintTag(fi,tag,"Number of Slices : %s\n",ps); break; case 0x10e2: MdcPrintTag(fi,tag,"Rest Stress : %s\n",ps); break; case 0x10e5: MdcPrintTag(fi,tag,"Left Shift : %s\n",ps); break; case 0x10e6: MdcPrintTag(fi,tag,"Posterior Shift : %s\n",ps); break; case 0x10e7: MdcPrintTag(fi,tag,"Superior Shift : %s\n",ps); break; case 0x10e9: MdcPrintTag(fi,tag,"Acquisition Bin Dur Percent : %s\n",ps); break; case 0x1010: MdcPrintTag(fi,tag,"Hospital Name : %s\n",ps); /* MARK END: GE DISCOVERY */ /* MARK CONTINUE: SIEMENS */ MdcPrintTag(fi,tag,"SPI Version : %s\n",ps); break; case 0x1110: MdcPrintTag(fi,tag,"Modality Recognition Code : %s\n",ps); break; case 0x1130: MdcPrintTag(fi,tag,"Header Offset in Bytes : %hu\n",ui16); break; case 0x1131: MdcPrintTag(fi,tag,"Length of Header in Bytes : %hu\n",ui16); break; case 0x1140: MdcPrintTag(fi,tag,"Byte Offset to Pixel Field : %hu\n",ui16); break; case 0x1141: MdcPrintTag(fi,tag,"Length of Pixel Data in Bytes: %u\n",ui32); break; case 0x8000: MdcPrintTag(fi,tag,"Original File Name : %s\n",ps); break; case 0x8010: MdcPrintTag(fi,tag,"Original File Location : %s\n",ps); break; case 0x8018: MdcPrintTag(fi,tag,"Data Set Identifier (DSID) : %s\n",ps); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x0010 */ case 0x0010: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Patient Information - Group 0010\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0010: MdcPrintTag(fi,tag,"Patient Name : %s\n",ps); MdcKillSpaces(ps); MdcStringCopy(fi->patient_name,ps,tag->length); /* remove caret signs */ pc = fi->patient_name; while (pc[0] != '\0') { if (pc[0] == '^') pc[0] = ' '; pc+=1; } MdcKillSpaces(fi->patient_name); break; case 0x0020: MdcPrintTag(fi,tag,"Patient ID : %s\n",ps); MdcKillSpaces(ps); MdcStringCopy(fi->patient_id,ps,tag->length); break; case 0x0030: MdcPrintTag(fi,tag,"Patient Birthday : %s\n",ps); MdcKillSpaces(ps); MdcStringCopy(fi->patient_dob,ps,tag->length); break; case 0x0040: MdcPrintTag(fi,tag,"Patient Sex : %s\n",ps); MdcKillSpaces(ps); MdcStringCopy(fi->patient_sex,ps,tag->length); break; case 0x1000: MdcPrintTag(fi,tag,"Other Patient IDs : %s\n",ps); break; case 0x1001: MdcPrintTag(fi,tag,"Other Patient Names : %s\n",ps); break; case 0x1005: MdcPrintTag(fi,tag,"Patient Maiden Name : %s\n",ps); break; case 0x1010: MdcPrintTag(fi,tag,"Patient Age : %s\n",ps); break; case 0x1020: MdcPrintTag(fi,tag,"Patient Size : %s\n",ps); fi->patient_height = (float)atof(ps); break; case 0x1030: MdcPrintTag(fi,tag,"Patient Weight : %s\n",ps); fi->patient_weight = (float)atof(ps); break; case 0x1040: MdcPrintTag(fi,tag,"Patient Address : %s\n",ps); break; case 0x1050: MdcPrintTag(fi,tag,"Insurance Plan ID : %s\n",ps); break; case 0x1060: MdcPrintTag(fi,tag,"Patient Mother's Maiden Name : %s\n",ps); break; case 0x21b0: MdcPrintTag(fi,tag,"Additional Patient History : %s\n",ps); break; case 0x4000: MdcPrintTag(fi,tag,"Comments : %s\n",ps); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x0011 */ case 0x0011: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Shadow Patient Information - Group 0011\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0010: MdcPrintTag(fi,tag,"Shadow owner code : %s\n",ps); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x0017 */ case 0x0017: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Calibration - Group 0017\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0010: MdcPrintTag(fi,tag,"Private Creator : %s\n",ps); break; case 0x1001: MdcPrintTag(fi,tag,"Correction Cal ID : %s\n",ps); break; case 0x1002: MdcPrintTag(fi,tag,"Compatible Version : %s\n",ps); break; case 0x1003: MdcPrintTag(fi,tag,"Software Version : %s\n",ps); break; case 0x1004: MdcPrintTag(fi,tag,"Cal DateTime : %s\n",ps); break; case 0x1005: MdcPrintTag(fi,tag,"Cal Description : %s\n",ps); break; case 0x1006: MdcPrintTag(fi,tag,"Cal Type : %s\n",ps); break; case 0x1007: MdcPrintTag(fi,tag,"Where is Correction : %s\n",ps); break; case 0x1008: MdcPrintTag(fi,tag,"Correction File Size : %s\n",ps); break; case 0x1009: MdcPrintTag(fi,tag,"Scan ID : %s\n",ps); break; case 0x100A: MdcPrintTag(fi,tag,"Scan DateTime : %s\n",ps); break; case 0x100B: MdcPrintTag(fi,tag,"Norm 2D Cal ID : %s\n",ps); break; case 0x100C: MdcPrintTag(fi,tag,"Hospital Identifier : %s\n",ps); break; case 0x100D: MdcPrintTag(fi,tag,"Archived : %s\n",ps); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x0018 */ case 0x0018: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Acquisition Information - Group 0018\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0010: MdcPrintTag(fi,tag,"Contrast/Bolus Agent : %s\n",ps); break; case 0x0015: MdcPrintTag(fi,tag,"Body Part Examined : %s\n",ps); if (tag->length > 0) { MdcKillSpaces(ps); MdcStringCopy(fi->organ_code,ps,tag->length); } break; case 0x0020: MdcPrintTag(fi,tag,"Scanning Sequence : %s\n",ps); break; case 0x0022: MdcPrintTag(fi,tag,"Scan Mode : %s\n",ps); break; case 0x0030: MdcPrintTag(fi,tag,"Radionuclide : %s\n",ps); MdcStringCopy(fi->radiopharma,ps,tag->length); break; case 0x0031: MdcPrintTag(fi,tag,"Radiopharmaceutical : %s\n",ps); MdcStringCopy(fi->radiopharma,ps,tag->length); break; case 0x0040: MdcPrintTag(fi,tag,"Cine Rate : %s\n",ps); break; case 0x0050: MdcPrintTag(fi,tag,"Slice Thickness : %s [mm]\n",ps); fi->image[i].slice_width=(float)atof(ps); break; case 0x0060: MdcPrintTag(fi,tag,"KVP : %s\n",ps); break; case 0x0070: MdcPrintTag(fi,tag,"Counts Accumulated : %s\n",ps); break; case 0x0071: MdcPrintTag(fi,tag,"Acquisition Termination Condition : %s\n",ps); break; case 0x0073: MdcPrintTag(fi,tag,"Acquisition Start Condition : %s\n",ps); break; case 0x0074: MdcPrintTag(fi,tag,"Acquisition Start Condition Data : %s\n",ps); break; case 0x0075: MdcPrintTag(fi,tag,"Acquisition Termination Condition Data : %s\n" ,ps); break; case 0x0080: MdcPrintTag(fi,tag,"Repetition Time : %s [ms]\n",ps); if (fi->mod != NULL) { fi->mod->mr_info.repetition_time = atof(ps); } break; case 0x0081: MdcPrintTag(fi,tag,"Echo Time : %s [ms]\n",ps); if (fi->mod != NULL) { fi->mod->mr_info.echo_time = atof(ps); } break; case 0x0082: MdcPrintTag(fi,tag,"Inversion Time : %s [ms]\n",ps); if (fi->mod != NULL) { fi->mod->mr_info.inversion_time = atof(ps); } break; case 0x0083: MdcPrintTag(fi,tag,"Number of Averages : %s\n",ps); if (fi->mod != NULL) { fi->mod->mr_info.num_averages = atof(ps); } break; case 0x0084: MdcPrintTag(fi,tag,"Imaging Frequency : %s [MHz]\n",ps); if (fi->mod != NULL) { fi->mod->mr_info.imaging_freq = atof(ps); } break; case 0x0085: MdcPrintTag(fi,tag,"Imaged Nucleus : %s\n",ps); break; case 0x0086: MdcPrintTag(fi,tag,"Echo Number : %s\n",ps); break; case 0x0088: MdcPrintTag(fi,tag,"Slice Spacing : %s [mm]\n",ps); sscanf(ps,"%f",&id->slice_spacing); /* MARK: in DICOM, sign = direction, pfff! */ if (id->slice_spacing < 0.) id->slice_spacing = - id->slice_spacing; break; case 0x0090: MdcPrintTag(fi,tag,"Data Collection Diameter : %s\n",ps); break; case 0x0095: MdcPrintTag(fi,tag,"Pixel Bandwidth : %s\n",ps); if (fi->mod != NULL) { fi->mod->mr_info.pixel_bandwidth = atof(ps); } break; case 0x1000: MdcPrintTag(fi,tag,"Device Serial Number : %s\n",ps); break; case 0x1010: MdcPrintTag(fi,tag,"Film Scanner ID : %s\n",ps); break; case 0x1020: MdcPrintTag(fi,tag,"Software Version : %s\n",ps); break; case 0x1030: MdcPrintTag(fi,tag,"Protocol : %s\n",ps); break; case 0x1040: MdcPrintTag(fi,tag,"Contrast/Bolus Route : %s\n",ps); break; case 0x1041: MdcPrintTag(fi,tag,"Contrast/Bolus Volume : %s\n",ps); break; case 0x1042: MdcPrintTag(fi,tag,"Contrast/Bolus Start Time : %s\n",ps); break; case 0x1043: MdcPrintTag(fi,tag,"Contrast/Bolus Stop Time : %s\n",ps); break; case 0x1044: MdcPrintTag(fi,tag,"Contrast/Bolus Total Dose : %s\n",ps); break; case 0x1050: MdcPrintTag(fi,tag,"Spatial Resolution : %s\n",ps); break; case 0x1060: MdcPrintTag(fi,tag,"Trigger Time : %s\n",ps); break; case 0x1063: MdcPrintTag(fi,tag,"Frame Time : %s\n",ps); dicom->frametime = (float)atof(ps); break; case 0x1070: MdcPrintTag(fi,tag,"Radionuclide Route : %s\n",ps); break; case 0x1071: MdcPrintTag(fi,tag,"Radionuclide Volume : %s\n",ps); break; case 0x1072: MdcPrintTag(fi,tag,"Radionuclide Start Time : %s\n",ps); MdcGetHHMMSS(ps,&fi->dose_time_hour ,&fi->dose_time_minute ,&fi->dose_time_second); break; case 0x1073: MdcPrintTag(fi,tag,"Radionuclide Stop Time : %s\n",ps); break; case 0x1074: MdcPrintTag(fi,tag,"Radionuclide Total Dose : %s\n",ps); fi->injected_dose = (float)atof(ps); break; case 0x1075: MdcPrintTag(fi,tag,"Radionuclide Half Life : %s\n",ps); fi->isotope_halflife = (float)atof(ps); break; case 0x1076: MdcPrintTag(fi,tag,"Radionuclide Positron Fraction : %s\n",ps); break; case 0x1081: MdcPrintTag(fi,tag,"Low R-R Value : %s\n",ps); dicom->window_low = (float)atof(ps); break; case 0x1082: MdcPrintTag(fi,tag,"High R-R Value : %s\n",ps); dicom->window_high = (float)atof(ps); break; case 0x1083: MdcPrintTag(fi,tag,"Intervals Acquired : %s\n",ps); dicom->intervals_acquired += (float)atof(ps); break; case 0x1084: MdcPrintTag(fi,tag,"Intervals Rejected : %s\n",ps); dicom->intervals_rejected += (float)atof(ps); break; case 0x1088: MdcPrintTag(fi,tag,"Heart Rate : %s\n",ps); dicom->heart_rate = (Int16)atoi(ps); break; case 0x1100: MdcPrintTag(fi,tag,"Reconstruction Diameter : %s\n",ps); break; case 0x1110: MdcPrintTag(fi,tag,"Distance Source to Detector : %s\n",ps); break; case 0x1111: MdcPrintTag(fi,tag,"Distance Source to Patient : %s\n",ps); break; case 0x1120: MdcPrintTag(fi,tag,"Gantry Tilt : %s [degrees]\n" ,ps); fi->gantry_tilt = (float)atof(ps); break; case 0x1130: MdcPrintTag(fi,tag,"Table Height : %s\n",ps); break; case 0x1140: MdcPrintTag(fi,tag,"Rotation Direction : %s\n",ps); if (MdcDicomDoAcqData(fi,dicom) == MDC_YES) { tmp = dicom->acqnr - 1; if (strcasecmp(ps,"CW") == 0) { fi->acqdata[tmp].rotation_direction = MDC_ROTATION_CW; }else if (strcasecmp(ps,"CC") == 0) { fi->acqdata[tmp].rotation_direction = MDC_ROTATION_CC; } } break; case 0x1142: MdcPrintTag(fi,tag,"Radial Position : %s\n",ps); if (MdcDicomDoAcqData(fi,dicom) == MDC_YES) { tmp = dicom->acqnr - 1; sscanf(ps,"%g",&fi->acqdata[tmp].radial_position); } break; case 0x1143: MdcPrintTag(fi,tag,"Scan Arc : %s\n",ps); if (MdcDicomDoAcqData(fi,dicom) == MDC_YES) { tmp = dicom->acqnr - 1; sscanf(ps,"%g",&fi->acqdata[tmp].scan_arc); } sscanf(ps,"%g",&dicom->scan_arc); break; case 0x1144: MdcPrintTag(fi,tag,"Angular Step : %s\n",ps); if (MdcDicomDoAcqData(fi,dicom) == MDC_YES) { tmp = dicom->acqnr - 1; sscanf(ps,"%f",&fi->acqdata[tmp].angle_step); } break; case 0x1145: MdcPrintTag(fi,tag,"Center of Rotation Offset : %s\n",ps); if (MdcDicomDoAcqData(fi,dicom) == MDC_YES) { tmp = dicom->acqnr - 1; fi->acqdata[tmp].rotation_offset = atof(ps); } break; case 0x1147: MdcPrintTag(fi,tag,"Field of View Share : %s\n",ps); break; case 0x1149: MdcPrintTag(fi,tag,"Field of View Dimensions : %s\n",ps); break; case 0x1150: MdcPrintTag(fi,tag,"Exposure Time : %s\n",ps); break; case 0x1151: MdcPrintTag(fi,tag,"Exposure Rate : %s\n",ps); break; case 0x1152: MdcPrintTag(fi,tag,"Exposure : %s\n",ps); break; case 0x1160: MdcPrintTag(fi,tag,"Filter Type : %s\n",ps); MdcKillSpaces(ps); MdcStringCopy(fi->filter_type,ps,tag->length); break; case 0x1170: MdcPrintTag(fi,tag,"Generator Power : %s\n",ps); break; case 0x1180: MdcPrintTag(fi,tag,"Collimator/Grid : %s\n",ps); break; case 0x1181: MdcPrintTag(fi,tag,"Collimator Type : %s\n",ps); break; case 0x1190: MdcPrintTag(fi,tag,"Focal Spot : %s\n",ps); break; case 0x1200: MdcPrintTag(fi,tag,"Date of Last Calibration : %s\n",ps); break; case 0x1201: MdcPrintTag(fi,tag,"Time of Last Calibration : %s\n",ps); break; case 0x1210: MdcPrintTag(fi,tag,"Convolution Kernel : %s\n",ps); break; case 0x1240: MdcPrintTag(fi,tag,"Upper/Lower Pixel Values : %s\n",ps); break; case 0x1242: MdcPrintTag(fi,tag,"Actual Frame Duration : %s\n",ps); flt = (float)atof(ps); if (FILL_STATIC_DATA == MDC_YES) { id->sdata->image_duration = flt; } if (FILL_DYNAMIC_DATA == MDC_YES) { dd = &fi->dyndata[dicom->dynnr]; if (dd->time_frame_duration > 0.) { /* safely increment phase counter */ if (dicom->dynnr < (fi->dynnr - 1)) dicom->dynnr += 1; } dd = &fi->dyndata[dicom->dynnr]; dd->time_frame_duration = flt; } dicom->frameduration = flt; break; case 0x1243: MdcPrintTag(fi,tag,"Count Rate : %s\n",ps); break; case 0x1250: MdcPrintTag(fi,tag,"Receiving Coil : %s\n",ps); break; case 0x1251: MdcPrintTag(fi,tag,"Transmitting Coil : %s\n",ps); break; case 0x1260: MdcPrintTag(fi,tag,"Screen Type : %s\n",ps); break; case 0x1261: MdcPrintTag(fi,tag,"Phosphor Type : %s\n",ps); break; case 0x1314: MdcPrintTag(fi,tag,"Flip Angle : %s\n",ps); if (fi->mod != NULL) { fi->mod->mr_info.flip_angle = atof(ps); } break; case 0x1318: MdcPrintTag(fi,tag,"dBdt : %s\n",ps); if (fi->mod != NULL) { fi->mod->mr_info.dbdt = atof(ps); } break; case 0x4000: MdcPrintTag(fi,tag,"Comments : %s\n",ps); break; case 0x5000: MdcPrintTag(fi,tag,"Output Power : %s\n",ps); break; case 0x5010: MdcPrintTag(fi,tag,"Transducer Data : %s\n",ps); break; case 0x5020: MdcPrintTag(fi,tag,"Preprocessing Function : %s\n",ps); break; case 0x5021: MdcPrintTag(fi,tag,"Postprocessing Function : %s\n",ps); break; case 0x5030: MdcPrintTag(fi,tag,"Dynamic Range : %s\n",ps); break; case 0x5040: MdcPrintTag(fi,tag,"Total Gain : %s\n",ps); break; case 0x5050: MdcPrintTag(fi,tag,"Depth of Scan Field : %s\n",ps); break; case 0x5100: MdcPrintTag(fi,tag,"Patient Position : %s\n",ps); MdcStringCopy(fi->pat_pos,ps,tag->length); MdcUpStr(fi->pat_pos); break; case 0x6030: MdcPrintTag(fi,tag,"Transducer Frequency : %u\n",ui32); if (fi->mod != NULL) { fi->mod->mr_info.transducer_freq = ui32; } break; case 0x6031: MdcPrintTag(fi,tag,"Transducer Type : %s\n",ps); if (fi->mod != NULL) { MdcStringCopy(fi->mod->mr_info.transducer_type,ps,MDC_MAXSTR); } break; case 0x6032: MdcPrintTag(fi,tag,"Pulse Repetition Frequency : %u\n",ui32); if (fi->mod != NULL) { fi->mod->mr_info.pulse_repetition_freq = ui32; } break; case 0x9005: MdcPrintTag(fi,tag,"Pulse Sequence Name : %s\n",ps); if (fi->mod != NULL) { MdcStringCopy(fi->mod->mr_info.pulse_seq_name,ps,MDC_MAXSTR); } break; case 0x9017: MdcPrintTag(fi,tag,"Steady State Pulse Sequence : %s\n",ps); if (fi->mod != NULL) { MdcStringCopy(fi->mod->mr_info.steady_state_pulse_seq,ps,MDC_MAXSTR); } break; case 0x9104: MdcPrintTag(fi,tag,"Slab Thickness : %f\n",flt64); if (fi->mod != NULL) { fi->mod->mr_info.slab_thickness = flt64; } case 0x9305: MdcPrintTag(fi,tag,"Revolution Time : %s\n",ps); break; case 0x9306: MdcPrintTag(fi,tag,"Single Collimation Width : %s\n",ps); break; case 0x9307: MdcPrintTag(fi,tag,"Total Collimation Width : %s\n",ps); break; case 0x9309: MdcPrintTag(fi,tag,"Table Speed : %s\n",ps); break; case 0x9310: MdcPrintTag(fi,tag,"Table Feed per Rotation : %s\n",ps); break; case 0x9311: MdcPrintTag(fi,tag,"CT Pitch Factor : %s\n",ps); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x0019 */ case 0x0019: switch (tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Shadow Relationship Information - Group 0019\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0010: MdcPrintTag(fi,tag,"Private Creator ID : %s\n",ps); break; case 0x1002: MdcPrintTag(fi,tag,"NumberOfCellsIInDetector : %s\n",ps); break; case 0x1003: MdcPrintTag(fi,tag,"CellNumberAtTheta : %s\n",ps); break; case 0x1004: MdcPrintTag(fi,tag,"Cell spacing : %s\n",ps); break; case 0x100F: MdcPrintTag(fi,tag,"HorizFrameOfRef : %s\n",ps); break; case 0x1011: MdcPrintTag(fi,tag,"SeriesContrast : %s\n",ps); break; case 0x1018: MdcPrintTag(fi,tag,"FirstScanRas : %s\n",ps); break; case 0x101A: MdcPrintTag(fi,tag,"LastScanRas : %s\n",ps); break; case 0x1023: MdcPrintTag(fi,tag,"TableSpeed : %s\n",ps); break; case 0x1024: MdcPrintTag(fi,tag,"MidScanTime : %s\n",ps); break; case 0x1025: MdcPrintTag(fi,tag,"MidScanFlag : %s\n",ps); break; case 0x1026: MdcPrintTag(fi,tag,"DegreesOfAzimuth : %s\n",ps); break; case 0x1027: MdcPrintTag(fi,tag,"GantryPeriod : %s\n",ps); break; case 0x102C: MdcPrintTag(fi,tag,"NumberOfTriggers : %s\n",ps); break; case 0x102E: MdcPrintTag(fi,tag,"AngleOfFirstView : %s\n",ps); break; case 0x102F: MdcPrintTag(fi,tag,"TriggerFrequency : %s\n",ps); break; case 0x1039: MdcPrintTag(fi,tag,"ScanFOVType : %s\n",ps); break; case 0x1042: MdcPrintTag(fi,tag,"SegmentNumber : %s\n",ps); break; case 0x1043: MdcPrintTag(fi,tag,"TotalSegmentsRequested : %s\n",ps); break; case 0x1047: MdcPrintTag(fi,tag,"ViewCompressionFactor : %s\n",ps); break; case 0x1052: MdcPrintTag(fi,tag,"ReconPostProcFlag : %s\n",ps); break; case 0x106A: MdcPrintTag(fi,tag,"DependentOnNumViewsProcessed : %s\n",ps); break; case 0x1220: MdcPrintTag(fi,tag,"Mosaic Image Width : %s\n",ps); sscanf(ps,"%u",&dicom->mosaic_width); break; case 0x1221: MdcPrintTag(fi,tag,"Mosaic Image Height : %s\n",ps); sscanf(ps,"%u",&dicom->mosaic_height); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x0020 */ case 0x0020: switch (tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Relationship Information - Group 0020\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x000d: MdcPrintTag(fi,tag,"Study Instance UID : %s\n",ps); break; case 0x000e: MdcPrintTag(fi,tag,"Series Instance UID : %s\n",ps); break; case 0x0010: MdcPrintTag(fi,tag,"Study ID : %s\n",ps); MdcStringCopy(fi->study_id,ps,tag->length); break; case 0x0011: MdcPrintTag(fi,tag,"Series Number : %s\n",ps); fi->nr_series = atoi(ps); break; case 0x0012: MdcPrintTag(fi,tag,"Acquisition Number : %s\n",ps); fi->nr_acquisition = atoi(ps); break; case 0x0013: MdcPrintTag(fi,tag,"Image Number : %s\n",ps); fi->nr_instance = atoi(ps); break; case 0x0020: MdcPrintTag(fi,tag,"Patient Orientation : %s\n",ps); MdcStringCopy(fi->pat_orient,ps,tag->length); break; case 0x0030: MdcPrintTag(fi,tag,"Image Position : %s [mm]\n",ps); sscanf(ps,"%f\\%f\\%f",&id->image_pos_dev[0], &id->image_pos_dev[1], &id->image_pos_dev[2]); break; case 0x0032: MdcPrintTag(fi,tag,"Image Position Patient : %s [mm]\n",ps); sscanf(ps,"%f\\%f\\%f",&id->image_pos_pat[0], &id->image_pos_pat[1], &id->image_pos_pat[2]); break; case 0x0035: MdcPrintTag(fi,tag,"Image Orientation : %s [mm]\n",ps); sscanf(ps,"%f\\%f\\%f\\%f\\%f\\%f",&id->image_orient_dev[0], &id->image_orient_dev[1], &id->image_orient_dev[2], &id->image_orient_dev[3], &id->image_orient_dev[4], &id->image_orient_dev[5]); break; case 0x0037: MdcPrintTag(fi,tag,"Image Orientation Patient : %s [mm]\n",ps); sscanf(ps,"%f\\%f\\%f\\%f\\%f\\%f",&id->image_orient_pat[0], &id->image_orient_pat[1], &id->image_orient_pat[2], &id->image_orient_pat[3], &id->image_orient_pat[4], &id->image_orient_pat[5]); fi->pat_slice_orient = MdcGetPatSliceOrient(fi,i); break; case 0x0050: MdcPrintTag(fi,tag,"Location : %s\n",ps); break; case 0x0052: MdcPrintTag(fi,tag,"Frame of Reference UID : %s\n",ps); break; case 0x0060: MdcPrintTag(fi,tag,"Laterality : %s\n",ps); break; case 0x0070: MdcPrintTag(fi,tag,"Image Geometrie Type : %s\n",ps); break; case 0x0080: MdcPrintTag(fi,tag,"Masking Image : %s\n",ps); break; case 0x1000: MdcPrintTag(fi,tag,"Series in Study : %s\n",ps); break; case 0x1001: MdcPrintTag(fi,tag,"Acquisitions in Series : %s\n",ps); break; case 0x1002: MdcPrintTag(fi,tag,"Images in Acquisition : %s\n",ps); break; case 0x1020: MdcPrintTag(fi,tag,"Reference : %s\n",ps); break; case 0x1040: MdcPrintTag(fi,tag,"Position Reference Indicator : %s\n",ps); break; case 0x1041: MdcPrintTag(fi,tag,"Slice Location : %s\n",ps); break; case 0x1070: MdcPrintTag(fi,tag,"Other Study Numbers : %s\n",ps); break; case 0x3401: MdcPrintTag(fi,tag,"Modifying Device ID : %s\n",ps); break; case 0x3402: MdcPrintTag(fi,tag,"Modified Image ID : %s\n",ps); break; case 0x3403: MdcPrintTag(fi,tag,"Modified Image Data : %s\n",ps); break; case 0x3404: MdcPrintTag(fi,tag,"Modifying Device Manufacturer: %s\n",ps); break; case 0x3405: MdcPrintTag(fi,tag,"Modified Image Time : %s\n",ps); break; case 0x3406: MdcPrintTag(fi,tag,"Modified Image Description : %s\n",ps); break; case 0x4000: MdcPrintTag(fi,tag,"Comments : %s\n",ps); break; case 0x5000: MdcPrintTag(fi,tag,"Original Image Identification: 0x%.4x\n",ui16); break; case 0x5002: MdcPrintTag(fi,tag,"Original Image Nomenclature : %s\n",ps); break; default: if ( (tag->element >= 0x3100) && (tag->element <= 0x31ff) ) { MdcPrintTag(fi,tag,"Source Image ID : %s\n",ps); }else{ MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } } break; /* group 0x0021 */ case 0x0021: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Shadow Relationship Information - Group 0021\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0010: MdcPrintTag(fi,tag,"Shadow Owner Code : %s\n",ps); break; case 0x0080: MdcPrintTag(fi,tag,"Owner ID : %s\n",ps); break; case 0x1003: MdcPrintTag(fi,tag,"SeriesFromWhichPrescribed : %s\n",ps); break; case 0x1010: MdcPrintTag(fi,tag,"Zoom Factor : %s\n",ps); break; case 0x1011: MdcPrintTag(fi,tag,"Target Coordinate : %s\n",ps); break; case 0x1020: MdcPrintTag(fi,tag,"Used ROI (mask) : %hu\n",ui16); break; case 0x1035: MdcPrintTag(fi,tag,"SeriesPrescribedFrom : %s\n",ps); break; case 0x1036: MdcPrintTag(fi,tag,"ImagePrescribedFrom : %s\n",ps); break; case 0x1091: MdcPrintTag(fi,tag,"BiopsyPosition : %s\n",ps); break; case 0x1092: MdcPrintTag(fi,tag,"BiopsyTLocation : %s\n",ps); break; case 0x1093: MdcPrintTag(fi,tag,"BiopsyRefLocation : %s\n",ps); break; case 0x1340: MdcPrintTag(fi,tag,"Number of Mosaic Images : %s\n",ps); sscanf(ps,"%u",&dicom->mosaic_number); break; case 0x134f: MdcPrintTag(fi,tag,"Mosaic Interlace Mode : %s\n",ps); if (strncmp(ps,"INTERL",6) == 0) dicom->mosaic_interlaced = MDC_YES; break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x0023 */ case 0x0023: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn(" - Group 0023\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0010: MdcPrintTag(fi,tag,"Private Creator : %s\n",ps); break; case 0x1023: MdcPrintTag(fi,tag,"Private Creator : %s\n",ps); break; case 0x1070: MdcPrintTag(fi,tag,"StartTimeSecsInFirstAxial : %s\n",ps); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x0027 */ case 0x0027: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn(" CT Image - Group 0027\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0010: MdcPrintTag(fi,tag,"Private Creator : %s\n",ps); break; case 0x1010: MdcPrintTag(fi,tag,"ScoutType : %s\n",ps); break; case 0x101C: MdcPrintTag(fi,tag,"VmaMamp : %s\n",ps); break; case 0x101E: MdcPrintTag(fi,tag,"VmaMod : %s\n",ps); break; case 0x101F: MdcPrintTag(fi,tag,"VmaClip : %s\n",ps); break; case 0x1020: MdcPrintTag(fi,tag,"SmartScanOnOffFlag : %s\n",ps); break; case 0x1035: MdcPrintTag(fi,tag,"PlaneType : %s\n",ps); break; case 0x1042: MdcPrintTag(fi,tag,"CenterRCoordOfPlaneImage : %s\n",ps); break; case 0x1043: MdcPrintTag(fi,tag,"CenterACoordOfPlaneImage : %s\n",ps); break; case 0x1044: MdcPrintTag(fi,tag,"CenterSCoordOfPlaneImage : %s\n",ps); break; case 0x1045: MdcPrintTag(fi,tag,"NormalRCoord : %s\n",ps); break; case 0x1046: MdcPrintTag(fi,tag,"NormalACoord : %s\n",ps); break; case 0x1047: MdcPrintTag(fi,tag,"NormalSCoord : %s\n",ps); break; case 0x1050: MdcPrintTag(fi,tag,"TableStartLocation : %s\n",ps); break; case 0x1051: MdcPrintTag(fi,tag,"TableEndLocation : %s\n",ps); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x0028 */ case 0x0028: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Image Presentation - Group 0028\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0002: MdcPrintTag(fi,tag,"Samples Per Pixel : %hu\n",ui16); break; case 0x0004: MdcPrintTag(fi,tag,"Photometric Interpretation : %s\n",ps); MdcKillSpaces(ps); if (strcasecmp(ps,"MONOCHROME1") == 0 ) dicom->INVERT = MDC_YES; break; case 0x0005: MdcPrintTag(fi,tag,"Image Dimensions : %hu\n",ui16); break; case 0x0008: MdcPrintTag(fi,tag,"Number of Frames : %s\n",ps); fi->dim[3] = (Uint32)atol(ps); break; case 0x0009: MdcPrintTag(fi,tag,"Frame Increment Pointer : "); vm = tag->length / 2; pu16 = (Uint16 *)tag->data; for (c=0; cVectDO[MDC_VECT_ENERGYWINDOW]= MDC_PASS1; break; case 0x0020: dicom->VectDO[MDC_VECT_DETECTOR] = MDC_PASS1; break; case 0x0030: dicom->VectDO[MDC_VECT_PHASE] = MDC_PASS1; break; case 0x0050: dicom->VectDO[MDC_VECT_ROTATION] = MDC_PASS1; break; case 0x0060: dicom->VectDO[MDC_VECT_RRINTERVAL] = MDC_PASS1; break; case 0x0070: dicom->VectDO[MDC_VECT_TIMESLOT] = MDC_PASS1; break; case 0x0080: dicom->VectDO[MDC_VECT_SLICE] = MDC_PASS1; break; case 0x0090: dicom->VectDO[MDC_VECT_ANGULARVIEW] = MDC_PASS1; break; case 0x0100: dicom->VectDO[MDC_VECT_TIMESLICE] = MDC_PASS1; break; } } if (MDC_INFO) MdcPrntScrn("(%.4x:%.4x) ",group,element); } if (MDC_INFO) MdcPrntScrn("\n"); break; case 0x0010: MdcPrintTag(fi,tag,"Rows : %hu\n",ui16); fi->image[i].height = (Uint32)ui16; if ((Uint32)ui16 > fi->mheight) fi->mheight = ui16; if ((Uint32)ui16 != fi->mheight) fi->diff_size = MDC_YES; break; case 0x0011: MdcPrintTag(fi,tag,"Columns : %hu\n",ui16); fi->image[i].width = (Uint32)ui16; if ((Uint32)ui16 > fi->mwidth) fi->mwidth = ui16; if ((Uint32)ui16 != fi->mwidth) fi->diff_size = MDC_YES; break; case 0x0030: MdcPrintTag(fi,tag,"Pixel Size : %s [mm]\n",ps); { pc=strchr(ps,'\\'); if (pc != NULL) { pc+=1; fi->pixdim[1] = (float)atof(pc); pc-=1; pc[0]='\0'; }else{ /* no second value available */ fi->pixdim[1] = (float)atof(ps); } fi->pixdim[2] = (float)atof(ps); fi->image[i].pixel_xsize = fi->pixdim[1]; fi->image[i].pixel_ysize = fi->pixdim[2]; } break; case 0x0031: MdcPrintTag(fi,tag,"Zoom Factor : %s\n",ps); fi->image[i].ct_zoom_fctr = (float)atof(ps); break; case 0x0040: MdcPrintTag(fi,tag,"Image Format : %s\n",ps); break; case 0x0050: MdcPrintTag(fi,tag,"Manipulated Image : %s\n",ps); break; case 0x0051: MdcPrintTag(fi,tag,"Corrected Image : %s\n",ps); if (strstr(ps,"DECY") != NULL) fi->decay_corrected = MDC_YES; if (strstr(ps,"UNIF") != NULL) fi->flood_corrected = MDC_YES; break; case 0x0060: MdcPrintTag(fi,tag,"Compression Code : %s\n",ps); break; case 0x0100: MdcPrintTag(fi,tag,"Bits Allocated : %hu\n",ui16); switch (ui16 % 8) { case 0 : /* bytes */ case 1 : /* 1bit */ case 4 : /* 12bit */ bits_allocated = fi->image[i].bits = (Int16)ui16; break; default : return("ACR Unsupported pixel type"); } break; case 0x0101: MdcPrintTag(fi,tag,"Bits per Pixel : %hu\n",ui16); bits_stored = (Int16)ui16; break; case 0x0102: MdcPrintTag(fi,tag,"High Bit : %hu\n",ui16); if ((Int16)ui16 != (bits_stored - 1)) return ("ACR Unsupported bits packing"); break; case 0x0103: MdcPrintTag(fi,tag,"Pixel Representation : %hu",ui16); dicom->sign=(Int16)ui16; if (MDC_INFO) switch(ui16) { case 0: MdcPrntScrn(" (= unsigned)\n"); break; case 1: MdcPrntScrn(" (= signed)\n"); break; } switch (bits_allocated) { case 8: if (ui16) fi->image[i].type = BIT8_S; else fi->image[i].type = BIT8_U; break; case 16: if (ui16) fi->image[i].type = BIT16_S; else fi->image[i].type = BIT16_U; break; case 32: if (ui16) fi->image[i].type = BIT32_S; else fi->image[i].type = BIT32_U; break; #ifdef HAVE_8BYTE_INT case 64: if (ui16) fi->image[i].type = BIT64_S; else fi->image[i].type = BIT64_U; break; #endif } break; case 0x0104: MdcPrintTag(fi,tag,"Pixel Minimum : %hu\n",ui16); break; case 0x0105: MdcPrintTag(fi,tag,"Pixel Maximum : %hu\n",ui16); break; case 0x0106: MdcPrintTag(fi,tag,"Smallest Image Pixel Value : %s\n",ps); break; case 0x0107: MdcPrintTag(fi,tag,"Largest Image Pixel Value : %s\n",ps); break; case 0x0120: MdcPrintTag(fi,tag,"Pixel Padding Value : %s\n",ps); break; case 0x0200: MdcPrintTag(fi,tag,"Image Location : 0x%.4x\n",ui16); break; case 0x1050: MdcPrintTag(fi,tag,"Window Center : %s\n",ps); fi->window_centre = (float)atof(ps); break; case 0x1051: MdcPrintTag(fi,tag,"Window Width : %s\n",ps); fi->window_width = (float)atof(ps); break; case 0x1052: MdcPrintTag(fi,tag,"Rescale Intercept : %s\n",ps); dicom->si_intercept = (float)atof(ps); break; case 0x1053: MdcPrintTag(fi,tag,"Rescale Slope : %s\n",ps); dicom->si_slope = (float)atof(ps); break; case 0x1054: MdcPrintTag(fi,tag,"Rescale Type : %s\n",ps); break; case 0x1080: MdcPrintTag(fi,tag,"Gray Scale : %s\n",ps); break; case 0x1100: MdcPrintTag(fi,tag,"Lookup Table Descriptor-Gray : 0x%.4x\n",ui16); break; case 0x1101: MdcPrintTag(fi,tag,"Lookup Table Descriptor-Red : 0x%.4x\n",ui16); break; case 0x1102: MdcPrintTag(fi,tag,"Lookup Table Descriptor-Green: 0x%.4x\n",ui16); break; case 0x1103: MdcPrintTag(fi,tag,"Loopup Table Descriptor-Blue : 0x%.4x\n",ui16); break; case 0x1200: MdcPrintTag(fi,tag,"Lookup Data - Gray : 0x%.4x\n",ui16); break; case 0x1201: MdcPrintTag(fi,tag,"Lookup Data - Red : 0x%.4x\n",ui16); break; case 0x1202: MdcPrintTag(fi,tag,"Lookup Data - Green : 0x%.4x\n",ui16); break; case 0x1203: MdcPrintTag(fi,tag,"Lookup Data - Blue : 0x%.4x\n",ui16); break; case 0x2110: MdcPrintTag(fi,tag,"Lossy Image Compression : %s\n",ps); break; case 0x4000: MdcPrintTag(fi,tag,"Comments : %s\n",ps); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x0032 */ case 0x0032: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Request Procedure - Group 0032\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x1032: MdcPrintTag(fi,tag,"Requesting Physician : %s\n",ps); break; case 0x1033: MdcPrintTag(fi,tag,"Requesting Service : %s\n",ps); break; case 0x1060: MdcPrintTag(fi,tag,"Requested Procedure Description : %s\n",ps); break; case 0x1064: MdcPrintTag(fi,tag,"Requested Procedure Code Sequence : %s\n",ps); break; case 0x1070: MdcPrintTag(fi,tag,"Requested Contrast Agent : %s\n",ps); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x003A */ case 0x003A: switch(tag->element) { case 0x001A: MdcPrintTag(fi,tag,"Sampling Frequency : %s\n",ps); if (fi->mod != NULL) { fi->mod->mr_info.sampling_freq = atof(ps); } break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x0040 */ case 0x0040: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Text - Group 0040\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0002: MdcPrintTag(fi,tag,"Scheduled Procedure Step Start Date : %s\n",ps); break; case 0x0003: MdcPrintTag(fi,tag,"Scheduled Procedure Step Start Time : %s\n",ps); break; case 0x0006: MdcPrintTag(fi,tag,"Performing Physician : %s\n",ps); break; case 0x0007: MdcPrintTag(fi,tag,"Scheduled Procedure Step Description : %s\n",ps); break; case 0x0009: MdcPrintTag(fi,tag,"Scheduled Procedure Step ID : %s\n",ps); break; case 0x0010: MdcPrintTag(fi,tag,"Arbitrary : %s\n",ps); break; case 0x0244: MdcPrintTag(fi,tag,"Performed Procedure Step Start Date : %s\n",ps); break; case 0x0245: MdcPrintTag(fi,tag,"Performed Procedure Step Start Time : %s\n",ps); break; case 0x0253: MdcPrintTag(fi,tag,"Performed Procedure Step ID : %s\n",ps); break; case 0x0254: MdcPrintTag(fi,tag,"Performed Procedure Step Description : %s\n",ps); break; case 0x1001: MdcPrintTag(fi,tag,"Requested Procedure ID : %s\n",ps); break; case 0x4000: MdcPrintTag(fi,tag,"Comments : %s\n",ps); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x0041 */ case 0x0041: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Folder Information - Group 0041\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0007: MdcPrintTag(fi,tag,"Scheduled Procedure Step Description : %s\n",ps); break; case 0x0009: MdcPrintTag(fi,tag,"Scheduled Procedure ID : %s\n",ps); break; case 0x0080: MdcPrintTag(fi,tag,"Owner ID : %s\n",ps); break; case 0x8000: MdcPrintTag(fi,tag,"Comments : %s\n",ps); break; case 0x8010: MdcPrintTag(fi,tag,"Folder Type : 0x%.4x\n",ui16); if (MDC_INFO) switch (ui16) { case 0x0001: MdcPrntScrn(" (= data exchange)\n"); break; case 0x0002: MdcPrntScrn(" (= teaching case)\n"); break; case 0x0003: MdcPrntScrn(" (= hard copy)\n"); break; case 0x0004: MdcPrntScrn(" (= history)\n"); break; case 0x0005: MdcPrntScrn(" (= case)\n"); break; case 0x0006: MdcPrntScrn(" (= patient)\n"); break; case 0x0007: MdcPrntScrn(" (= research)\n"); break; default: MdcPrntScrn(" (= unknown)\n"); } break; case 0x8011: MdcPrintTag(fi,tag,"Parent Folder Data Set ID : %s\n",ps); break; case 0x8020: MdcPrintTag(fi,tag,"Folder Name : %s\n",ps); break; case 0x8030: MdcPrintTag(fi,tag,"Creation Date : %s\n",ps); break; case 0x8032: MdcPrintTag(fi,tag,"Creation Time : %s\n",ps); break; case 0x8034: MdcPrintTag(fi,tag,"Modified Date : %s\n",ps); break; case 0x8036: MdcPrintTag(fi,tag,"Modified Time : %s\n",ps); break; case 0x8040: MdcPrintTag(fi,tag,"Owner Name : %s\n",ps); break; case 0x8050: MdcPrintTag(fi,tag,"Folder Status : %s\n",ps); break; case 0x8060: MdcPrintTag(fi,tag,"Number of Images : %u\n",ui32); break; case 0x8062: MdcPrintTag(fi,tag,"Number of Other : %u\n",ui32); break; case 0x80a0: if (MDC_INFO) MdcPrntScrn("\nFolder Elements - External References\n"); MdcPrintTag(fi,tag,"Folder Element DSID : %s\n",ps); break; case 0x80a1: MdcPrintTag(fi,tag,"Folder Element Data Set Type : 0x%.4x\n",ui16); break; case 0x80a2: MdcPrintTag(fi,tag,"Folder Element File Location : %s\n",ps); break; case 0x80a3: MdcPrintTag(fi,tag,"Folder Element Length : %u\n",ui32); break; case 0x80b0: if (MDC_INFO) MdcPrntScrn("\nFolder Elements - Internal References\n"); MdcPrintTag(fi,tag,"Folder Element DSID : %s\n",ps); break; case 0x80b1: MdcPrintTag(fi,tag,"Folder Element Data Set Type : 0x%.4x\n",ui16); break; case 0x80b2: MdcPrintTag(fi,tag,"Offset to Data Set : %u\n",ui32); break; case 0x80b3: MdcPrintTag(fi,tag,"Offset to Image : %u\n",ui32); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x0043 */ case 0x0043: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn(" CT Params - Group 0043\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0010: MdcPrintTag(fi,tag,"Private Creator ID : %s\n",ps); break; case 0x1064: MdcPrintTag(fi,tag,"ReconFilter : %s\n",ps); break; case 0x1010: MdcPrintTag(fi,tag,"WindowValue : %s\n",ps); break; case 0x1012: MdcPrintTag(fi,tag,"X-RayChain : %s\n",ps); break; case 0x1016: MdcPrintTag(fi,tag,"NumberOfOverranges : %s\n",ps); break; case 0x101E: MdcPrintTag(fi,tag,"DeltaStartTime : %s\n",ps); break; case 0x101F: MdcPrintTag(fi,tag,"MaxOverrangesInAView : %s\n",ps); break; case 0x1021: MdcPrintTag(fi,tag,"CorrectedAfterGlowTerms : %s\n",ps); break; case 0x1025: MdcPrintTag(fi,tag,"ReferenceChannels : %s\n",ps); break; case 0x1026: MdcPrintTag(fi,tag,"NoViewsRefChansBlocked : %s\n",ps); break; case 0x1027: MdcPrintTag(fi,tag,"ScanPitchRatio : %s\n",ps); break; case 0x1028: MdcPrintTag(fi,tag,"UniqueImageIden : %s\n",ps); break; case 0x102B: MdcPrintTag(fi,tag,"PrivateScanOptions : %s\n",ps); break; case 0x1031: MdcPrintTag(fi,tag,"RACordOfTargetReconCenter : %s\n",ps); break; case 0x1040: MdcPrintTag(fi,tag,"TriggerOnPosition : %s\n",ps); break; case 0x1041: MdcPrintTag(fi,tag,"DegreeOfRotation : %s\n",ps); break; case 0x1042: MdcPrintTag(fi,tag,"DASTriggerSource : %s\n",ps); break; case 0x1043: MdcPrintTag(fi,tag,"DASFpaGain : %s\n",ps); break; case 0x1044: MdcPrintTag(fi,tag,"DASOutputSource : %s\n",ps); break; case 0x1045: MdcPrintTag(fi,tag,"DASAdInput : %s\n",ps); break; case 0x1046: MdcPrintTag(fi,tag,"DASCalMode : %s\n",ps); break; case 0x104D: MdcPrintTag(fi,tag,"StartScanToX-RayOnDelay : %s\n",ps); break; case 0x104E: MdcPrintTag(fi,tag,"DurationOfX-RayOn : %s\n",ps); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x0045 */ case 0x0045: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn(" HELIOS Cardiac - Group 0045\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0010: MdcPrintTag(fi,tag,"Private Creator : %s\n",ps); break; case 0x1001: MdcPrintTag(fi,tag,"NumberOfMacroRowsInDetector : %s\n",ps); break; case 0x1002: MdcPrintTag(fi,tag,"MacroWidthAtISOCenter : %s\n",ps); break; case 0x1003: MdcPrintTag(fi,tag,"DASType : %s\n",ps); break; case 0x1004: MdcPrintTag(fi,tag,"DASGain : %s\n",ps); break; case 0x1005: MdcPrintTag(fi,tag,"DASTemprature : %s\n",ps); break; case 0x1006: MdcPrintTag(fi,tag,"TableDirection : %s\n",ps); break; case 0x1007: MdcPrintTag(fi,tag,"ZSmoothingFactor : %s\n",ps); break; case 0x1008: MdcPrintTag(fi,tag,"ViewWeightingMode : %s\n",ps); break; case 0x1009: MdcPrintTag(fi,tag,"SigmaRowNumber : %s\n",ps); break; case 0x100A: MdcPrintTag(fi,tag,"MinimumDASValue : %s\n",ps); break; case 0x100B: MdcPrintTag(fi,tag,"MaximumOffsetValue : %s\n",ps); break; case 0x100C: MdcPrintTag(fi,tag,"NumberOfViewsShifted : %s\n",ps); break; case 0x100D: MdcPrintTag(fi,tag,"ZTrackingFlag : %s\n",ps); break; case 0x100E: MdcPrintTag(fi,tag,"MeanZError : %s\n",ps); break; case 0x100F: MdcPrintTag(fi,tag,"ZTrackingError : %s\n",ps); break; case 0x1010: MdcPrintTag(fi,tag,"StartView2A : %s\n",ps); break; case 0x1011: MdcPrintTag(fi,tag,"NumberOfViews2A : %s\n",ps); break; case 0x1012: MdcPrintTag(fi,tag,"StartView1A : %s\n",ps); break; case 0x1013: MdcPrintTag(fi,tag,"SigmaMode : %s\n",ps); break; case 0x1014: MdcPrintTag(fi,tag,"NumberOfViews1A : %s\n",ps); break; case 0x1015: MdcPrintTag(fi,tag,"StartView2B : %s\n",ps); break; case 0x1016: MdcPrintTag(fi,tag,"NumberViews2B : %s\n",ps); break; case 0x1017: MdcPrintTag(fi,tag,"StartView1B : %s\n",ps); break; case 0x1018: MdcPrintTag(fi,tag,"NumberOfViews1B : %s\n",ps); break; case 0x1021: MdcPrintTag(fi,tag,"IterboneFlag : %s\n",ps); break; case 0x1022: MdcPrintTag(fi,tag,"PerisstalticFlag : %s\n",ps); break; case 0x1030: MdcPrintTag(fi,tag,"Cardiacreconalgorithm : %s\n",ps); break; case 0x1031: MdcPrintTag(fi,tag,"Avgheartrateforimage : %s\n",ps); break; case 0x1032: MdcPrintTag(fi,tag,"Temporalresolution : %s\n",ps); break; case 0x1033: MdcPrintTag(fi,tag,"Pctrpeakdelay : %s\n",ps); break; case 0x1036: MdcPrintTag(fi,tag,"Ekgfullmastartphase : %s\n",ps); break; case 0x1037: MdcPrintTag(fi,tag,"Ekgfullmaendphase : %s\n",ps); break; case 0x1038: MdcPrintTag(fi,tag,"Kgmodulationmaxma : %s\n",ps); break; case 0x1039: MdcPrintTag(fi,tag,"Ekgmodulationminma : %s\n",ps); break; case 0x103B: MdcPrintTag(fi,tag,"Noisereductionimagefilterdesc: %s\n",ps); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x0049 */ case 0x0049: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn(" CT Cardiac - Group 0049\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x1001: MdcPrintTag(fi,tag,"CTCardiacSequence : %s\n",ps); break; case 0x1002: MdcPrintTag(fi,tag,"Heartrateatconfirm : %s\n",ps); break; case 0x1003: MdcPrintTag(fi,tag,"Avgheartratepriortoconfirm : %s\n",ps); break; case 0x1004: MdcPrintTag(fi,tag,"Minheartratepriortoconfirm : %s\n",ps); break; case 0x1005: MdcPrintTag(fi,tag,"Maxheartratepriortoconfirm : %s\n",ps); break; case 0x1006: MdcPrintTag(fi,tag,"Stddevheartratepriortoconfirm : %s\n",ps); break; case 0x1007: MdcPrintTag(fi,tag,"Numheartratesamplespriortoconfirm : %s\n",ps); break; case 0x1008: MdcPrintTag(fi,tag,"Autoheartratedetectpredict : %s\n",ps); break; case 0x1009: MdcPrintTag(fi,tag,"Systemoptimizedheartrate : %s\n",ps); break; case 0x100A: MdcPrintTag(fi,tag,"Ekgmonitortype : %s\n",ps); break; case 0x100B: MdcPrintTag(fi,tag,"Numreconsectors : %s\n",ps); break; case 0x100C: MdcPrintTag(fi,tag,"Rpeaktimestamps : %s\n",ps); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* DICOM specific tags to interpret */ /* group 0x0054 */ case 0x0054: switch (tag->element) { case 0x0010: /* energy window vector */ MdcDicomCheckVect(dicom,tag,MDC_VECT_ENERGYWINDOW); break; case 0x0011: /* number of energy windows */ MdcPrintTag(fi,tag,"Number of Energy Windows : %hu\n",ui16); fi->dim[7] = MdcDicomNrOfVect(dicom,ui16,MDC_VECT_ENERGYWINDOW); break; case 0x0020: /* detector vector */ MdcDicomCheckVect(dicom,tag,MDC_VECT_DETECTOR); break; case 0x0021: /* number of detectors */ MdcPrintTag(fi,tag,"Number of Detectors : %hu\n",ui16); fi->dim[6] = MdcDicomNrOfVect(dicom,ui16,MDC_VECT_DETECTOR); break; case 0x0030: /* phase vectory */ MdcDicomCheckVect(dicom,tag,MDC_VECT_PHASE); break; case 0x0031: /* phases (dyn) */ MdcPrintTag(fi,tag,"Number of Phases : %hu\n",ui16); MdcGetStructDD(fi,MdcDicomNrOfVect(dicom,ui16,MDC_VECT_PHASE)); if (fi->planar != MDC_YES) { fi->dim[4] = MdcDicomNrOfVect(dicom,ui16,MDC_VECT_PHASE); } break; case 0x0033: /* number of frames in phase */ MdcPrintTag(fi,tag,"Number of Frames in Phase : %hu\n",ui16); if (FILL_DYNAMIC_DATA == MDC_YES) { fi->dyndata[dicom->dynnr].nr_of_slices = (Uint32)ui16; }else{ fi->dim[3] = (Uint32)ui16; } break; case 0x0036: MdcPrintTag(fi,tag,"Phase Delay : %s\n",ps); if (FILL_DYNAMIC_DATA == MDC_YES) { fi->dyndata[dicom->dynnr].time_frame_delay = (float)atof(ps); } break; case 0x0038: MdcPrintTag(fi,tag,"Pause Between Frames : %s\n",ps); if (FILL_DYNAMIC_DATA == MDC_YES) { fi->dyndata[dicom->dynnr].delay_slices = (float)atof(ps); } break; case 0x0050: /* rotation vector */ MdcDicomCheckVect(dicom,tag,MDC_VECT_ROTATION); break; case 0x0051: /* number of rotations */ if (fi->reconstructed == MDC_NO) { if (!MdcGetStructAD(fi,(Uint32)ui16)) fi->acqnr = 0; } break; case 0x0052: /* rotation information sequence */ dicom->acqnr += 1; break; case 0x0053: MdcPrintTag(fi,tag,"Number Frames in Rotation : %hu\n",ui16); dicom->nrframes = (float)ui16; break; case 0x0060: /* R-R interval vector */ MdcDicomCheckVect(dicom,tag,MDC_VECT_RRINTERVAL); break; case 0x0061: /* R-R intervals */ MdcPrintTag(fi,tag,"Number of R-R intervals : %hu\n",ui16); fi->dim[5] = MdcDicomNrOfVect(dicom,ui16,MDC_VECT_RRINTERVAL); break; case 0x0070: /* time slot vector */ MdcDicomCheckVect(dicom,tag,MDC_VECT_TIMESLOT); break; case 0x0071: /* number of time slots (gated only stuff) */ MdcPrintTag(fi,tag,"Number of Time Slots : %hu\n",ui16); if (fi->acquisition_type == MDC_ACQUISITION_GATED) { /* MARK: for gated, time slot is the last dimension !! */ fi->dim[3] = MdcDicomNrOfVect(dicom,ui16,MDC_VECT_TIMESLOT); }else{ fi->dim[4] = MdcDicomNrOfVect(dicom,ui16,MDC_VECT_TIMESLOT); } break; case 0x0073: /* timeslottime */ MdcPrintTag(fi,tag,"Time Slot Time : %s\n",ps); dicom->timeslottime = (float)atof(ps); break; case 0x0080: /* slice vector */ MdcDicomCheckVect(dicom,tag,MDC_VECT_SLICE); break; case 0x0081: /* number of slices */ MdcPrintTag(fi,tag,"Number of Slices : %hu\n",ui16); fi->dim[3] = MdcDicomNrOfVect(dicom,ui16,MDC_VECT_SLICE); break; case 0x0090: /* angular view vector */ MdcDicomCheckVect(dicom,tag,MDC_VECT_ANGULARVIEW); fi->dim[3] = dicom->VectNR[MDC_VECT_ANGULARVIEW]; /* no number of angular views ? 0x0091*/ break; case 0x0100: /* time slice vector */ MdcDicomCheckVect(dicom,tag,MDC_VECT_TIMESLICE); break; case 0x0101: MdcPrintTag(fi,tag,"Number of Time Slices : %hu\n",ui16); if (dicom->modality == M_PT) { fi->dim[4] = MdcDicomNrOfVect(dicom,ui16,MDC_VECT_TIMESLICE); }else{ fi->dim[3] = MdcDicomNrOfVect(dicom,ui16,MDC_VECT_TIMESLICE); } break; case 0x0200: MdcPrintTag(fi,tag,"Start Angle : %s\n",ps); if (MdcDicomDoAcqData(fi,dicom) == MDC_YES) { float angle; tmp = dicom->acqnr - 1; sscanf(ps,"%f",&angle); fi->acqdata[tmp].angle_start = MdcRotateAngle(angle, 180.); } break; case 0x0202: MdcPrintTag(fi,tag,"Type of Detector Motion : %s\n",ps); if (MdcDicomDoAcqData(fi,dicom) == MDC_YES) { if (strcasecmp(ps,"STEP AND SHOOT") == 0) { dicom->motion = MDC_MOTION_STEP; }else if (strcasecmp(ps,"CONTINUOUS") == 0) { dicom->motion = MDC_MOTION_CONT; }else if (strcasecmp(ps,"ACQ DURING STEP") == 0) { dicom->motion = MDC_MOTION_DRNG; } for (tmp=0; tmp < fi->acqnr; tmp ++) { fi->acqdata[tmp].detector_motion = dicom->motion; } } break; case 0x1000: MdcPrintTag(fi,tag,"Series Type : %s\n",ps); if (MdcGetStrVM(mdcbufr,ps,1) == MDC_YES) { MdcKillSpaces(mdcbufr); if (strcasecmp(mdcbufr,"STATIC") == 0) { fi->acquisition_type = MDC_ACQUISITION_TOMO; }else if (strcasecmp(mdcbufr,"WHOLE_BODY") == 0) { fi->acquisition_type = MDC_ACQUISITION_TOMO; fi->reconstructed = MDC_NO; }else if (strcasecmp(mdcbufr,"DYNAMIC") == 0) { fi->acquisition_type = MDC_ACQUISITION_DYNAMIC; fi->reconstructed = MDC_NO; }else if (strcasecmp(mdcbufr,"GATED") == 0) { fi->acquisition_type = MDC_ACQUISITION_GSPECT; }else{ fi->acquisition_type = MDC_ACQUISITION_TOMO; } } if (MdcGetStrVM(mdcbufr,ps,2) == MDC_YES) { MdcKillSpaces(mdcbufr); if (strcasecmp(mdcbufr,"IMAGE") == 0) { fi->reconstructed = MDC_YES; }else{ fi->reconstructed = MDC_NO; } } break; case 0x1300: MdcPrintTag(fi,tag,"Frame Reference Time : %s\n",ps); flt = (float)atof(ps); dicom->framestart = flt; break; } break; /* group 0x7001 */ case 0x7001: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Shadow dummy - Group 7001\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0010: MdcPrintTag(fi,tag,"Shadow Owner Code : %s\n",ps); break; case 0x1010: MdcPrintTag(fi,tag,"Dummy Data Zero : %s\n",ps); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x7003 */ case 0x7003: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Shadow Header - Group 7003\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0010: MdcPrintTag(fi,tag,"Shadow Owner Code : %s\n",ps); break; case 0x1010: MdcPrintTag(fi,tag,"Original NUMARIS2 Header : %s\n",ps); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); break; } break; /* group 0x7005 */ case 0x7005: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Shadow Dummy - Group 7005\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0010: MdcPrintTag(fi,tag,"Shadow Owner Code : %s\n",ps); break; case 0x1010: MdcPrintTag(fi,tag,"Dummy Data Zero : %s\n",ps); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; /* group 0x7fe0 */ case 0x7fe0: switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Pixel Information - Group 7FE0\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0010: MdcPrintTag(fi,tag,"Image Data : %u\n",ui32); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } break; default: if ( (tag->group >= 0x6000) && (tag->group <= 0x60e1) ) { switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Overlay - Group %.4x\n",tag->group); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Group Length : %u\n",ui32); break; case 0x0010: MdcPrintTag(fi,tag,"Rows : %hu\n",ui16); break; case 0x0011: MdcPrintTag(fi,tag,"Columns : %hu\n",ui16); break; case 0x0040: MdcPrintTag(fi,tag,"ROI : %s\n",ps); break; case 0x0050: MdcPrintTag(fi,tag,"Origin : %s\n",ps); break; case 0x0060: MdcPrintTag(fi,tag,"Compression Code : %s\n",ps); break; case 0x0100: MdcPrintTag(fi,tag,"Bits Allocated : %hu\n",ui16); break; case 0x0102: MdcPrintTag(fi,tag,"Bits Position : %hu\n",ui16); break; case 0x0110: MdcPrintTag(fi,tag,"Overlay Format : %s\n",ps); break; case 0x0200: MdcPrintTag(fi,tag,"Overlay Location : 0x%.4x\n",ui16); break; case 0x1100: MdcPrintTag(fi,tag,"Overlay Descriptor Gray : 0x%.4x\n",ui16); break; case 0x1101: MdcPrintTag(fi,tag,"Overlay Descriptor Red : 0x%.4x\n",ui16); break; case 0x1102: MdcPrintTag(fi,tag,"Overlay Descriptor Green : 0x%.4x\n",ui16); break; case 0x1103: MdcPrintTag(fi,tag,"Overlay Descriptor Blue : 0x%.4x\n",ui16); break; case 0x1200: MdcPrintTag(fi,tag,"Overlays Gray : 0x%.4x\n",ui16); break; case 0x1201: MdcPrintTag(fi,tag,"Overlays Red : 0x%.4x\n",ui16); break; case 0x1202: MdcPrintTag(fi,tag,"Overlays Green : 0x%.4x\n",ui16); break; case 0x1203: MdcPrintTag(fi,tag,"Overlays Blue : 0x%.4x\n",ui16); break; case 0x1301: MdcPrintTag(fi,tag,"ROI Area : %s\n",ps); break; case 0x1302: MdcPrintTag(fi,tag,"ROI Mean : %s\n",ps); break; case 0x1303: MdcPrintTag(fi,tag,"ROI Standard Deviation : %s\n",ps); break; case 0x3000: MdcPrintTag(fi,tag,"Overlay Data : 0x%.4x\n",ui16); break; default: MdcPrintTag(fi,tag,"Unknown Element : %s\n",ps); } }else{ switch(tag->element) { case 0x0000: if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Unknown Group - %.4x\n",tag->group); MdcPrintLine('-',MDC_FULL_LENGTH); } MdcPrintTag(fi,tag,"Unknown Group Length : %d\n",i32); break; default: MdcPrintTag(fi,tag,"Unknown Element : \n"); } } } return NULL; } /* 1 on success and 0 on error */ int MdcPutTag(FILE *fp,Uint16 group,Uint16 elem,Uint32 length,Uint8 *data) { MDC_ACR_TAG tag; Int8 MAKE_EVEN=0; if (length%2) MAKE_EVEN = 1; tag.group = group; tag.element = elem; tag.length = length + MAKE_EVEN; tag.data = data; MdcSwapTag(&tag); fwrite((Uint8 *)&tag,1,MDC_ACR_TAG_SIZE,fp); if (length > 0) fwrite(tag.data,1,length,fp); if (MAKE_EVEN) fputc('\0',fp); if (ferror(fp)) return(MDC_NO); return MDC_YES; } void MdcPutGroupLength(FILE *fp,Uint16 group, Uint32 gbegin) { Uint32 gend, glength; /* position */ gend = ftell(fp); fseek(fp,(signed)gbegin,SEEK_SET); /* get length and write */ glength = gend - gbegin - MDC_SIZE_E0000; MdcSWAP(glength); MdcPutTag(fp,group,0x0000,4,(Uint8 *)&glength); /* get back to end of file */ fseek(fp,0,SEEK_END); } /* 1 on success and 0 on error */ int MdcPutGroup(FILEINFO * fi, Uint16 group, Uint32 img) { IMG_DATA *id = &fi->image[img]; FILE *fp = fi->ofp; Uint16 i16, bits_allocated, bits_stored; Uint32 i32, gbegin=0; Int16 type; Uint8 *new_buf=NULL; char *pchar; if (MDC_QUANTIFY || MDC_CALIBRATE) { type = BIT16_S; /* printed as float, still an integer, */ /* for BIT32_S this could be like 2.147e+09 */ /* and that's a bit too confusing */ }else{ if ((id->type == FLT32) || (id->type == FLT64)) { /* no floats in ACR/NEMA */ type = BIT16_S; /* same reason as above */ }else{ type = id->type; } } /* Ola! there was a special integer request */ if (MDC_FORCE_INT != MDC_NO) { switch (MDC_FORCE_INT) { case BIT8_U : type = BIT8_U; break; case BIT16_S: type = BIT16_S; break; default : type = BIT16_S; } } switch(group) { case 0x0008: gbegin = ftell(fp); i32 = 0; /* write later */ MdcPutTag(fp,0x0008,0x0000,4,(Uint8 *)&i32); FP_G0008_E0001 = ftell(fp); i32 = 0; /* write later */ MdcPutTag(fp,0x0008,0x0001,4,(Uint8 *)&i32); strcpy(mdcbufr,"ACR-NEMA 2.0"); MdcPutTag(fp,0x0008,0x0010,strlen(mdcbufr),(Uint8 *)mdcbufr); sprintf(mdcbufr,"%04d.%02d.%02d",fi->study_date_year ,fi->study_date_month ,fi->study_date_day); MdcPutTag(fp,0x0008,0x0020,strlen(mdcbufr),(Uint8 *)mdcbufr); sprintf(mdcbufr,"%02d.%02d.%02d.0000",fi->study_time_hour ,fi->study_time_minute ,fi->study_time_second); MdcPutTag(fp,0x0008,0x0030,strlen(mdcbufr),(Uint8 *)mdcbufr); i16 = 0; MdcSWAP(i16); MdcPutTag(fp,0x0008,0x0040,2,(Uint8 *)&i16); pchar = MdcGetStrModality(fi->modality); /* already in mdcbufr */ MdcPutTag(fp,0x0008,0x0060,2,(Uint8 *)pchar); strcpy(mdcbufr,fi->manufacturer); MdcPutTag(fp,0x0008,0x0070,strlen(mdcbufr),(Uint8 *)mdcbufr); strcpy(mdcbufr,fi->institution); MdcPutTag(fp,0x0008,0x0080,strlen(mdcbufr),(Uint8 *)mdcbufr); MdcStringCopy(mdcbufr,fi->study_descr,strlen(fi->study_descr)); MdcPutTag(fp,0x0008,0x1030,strlen(mdcbufr),(Uint8 *)mdcbufr); MdcStringCopy(mdcbufr,fi->series_descr,strlen(fi->series_descr)); MdcPutTag(fp,0x0008,0x103E,strlen(mdcbufr),(Uint8 *)mdcbufr); MdcStringCopy(mdcbufr,fi->operator_name,strlen(fi->operator_name)); MdcPutTag(fp,0x0008,0x1070,strlen(mdcbufr),(Uint8 *)mdcbufr); strcpy(mdcbufr,MDC_LIBVERS); MdcPutTag(fp,0x0008,0x2111,strlen(mdcbufr),(Uint8 *)mdcbufr); break; case 0x0010: gbegin = ftell(fp); i32 = 0; /* write later */ MdcPutTag(fp,0x0010,0x0000,4,(Uint8 *)&i32); MdcStringCopy(mdcbufr,fi->patient_name,strlen(fi->patient_name)); MdcPutTag(fp,0x0010,0x0010,strlen(mdcbufr),(Uint8 *)mdcbufr); MdcStringCopy(mdcbufr,fi->patient_id,strlen(fi->patient_id)); MdcPutTag(fp,0x0010,0x0020,strlen(mdcbufr),(Uint8 *)mdcbufr); MdcStringCopy(mdcbufr,fi->patient_sex,strlen(fi->patient_sex)); MdcPutTag(fp,0x0010,0x0040,strlen(mdcbufr),(Uint8 *)mdcbufr); sprintf(mdcbufr,"%.2f",fi->patient_height); MdcPutTag(fp,0x0010,0x1020,strlen(mdcbufr),(Uint8 *)mdcbufr); sprintf(mdcbufr,"%.2f",fi->patient_weight); MdcPutTag(fp,0x0010,0x1030,strlen(mdcbufr),(Uint8 *)mdcbufr); break; case 0x0018: gbegin = ftell(fp); i32 = 0; /* write later */ MdcPutTag(fp,0x0018,0x0000,4,(Uint8 *)&i32); MdcStringCopy(mdcbufr,fi->radiopharma,strlen(fi->radiopharma)); MdcPutTag(fp,0x0018,0x0030,strlen(mdcbufr),(Uint8 *)mdcbufr); MdcStringCopy(mdcbufr,fi->radiopharma,strlen(fi->radiopharma)); MdcPutTag(fp,0x0018,0x0031,strlen(mdcbufr),(Uint8 *)mdcbufr); sprintf(mdcbufr,"%+e",id->slice_width); MdcPutTag(fp,0x0018,0x0050,strlen(mdcbufr),(Uint8 *)mdcbufr); sprintf(mdcbufr,"%+e",id->slice_spacing); MdcPutTag(fp,0x0018,0x0088,strlen(mdcbufr),(Uint8 *)mdcbufr); sprintf(mdcbufr,"%g",fi->injected_dose); MdcPutTag(fp,0x0018,0x1074,strlen(mdcbufr),(Uint8 *)mdcbufr); sprintf(mdcbufr,"%+e",fi->gantry_tilt); MdcPutTag(fp,0x0018,0x1120,strlen(mdcbufr),(Uint8 *)mdcbufr); MdcStringCopy(mdcbufr,fi->filter_type,strlen(fi->filter_type)); MdcPutTag(fp,0x0018,0x1160,strlen(mdcbufr),(Uint8 *)mdcbufr); MdcStringCopy(mdcbufr,fi->pat_pos,strlen(fi->pat_pos)); MdcPutTag(fp,0x0018,0x5100,strlen(mdcbufr),(Uint8 *)mdcbufr); break; case 0x0020: gbegin = ftell(fp); i32 = 0; /* write later */ MdcPutTag(fp,0x0020,0x0000,4,(Uint8 *)&i32); MdcStringCopy(mdcbufr,fi->study_id,strlen(fi->study_id)); MdcPutTag(fp,0x0020,0x0010,strlen(mdcbufr),(Uint8 *)mdcbufr); if (fi->nr_series >= 0) sprintf(mdcbufr,"%d",fi->nr_series); else strcpy(mdcbufr,"0"); MdcPutTag(fp,0x0020,0x0011,strlen(mdcbufr),(Uint8 *)mdcbufr); if (fi->nr_acquisition >= 0) sprintf(mdcbufr,"%d",fi->nr_acquisition); else strcpy(mdcbufr,"0"); MdcPutTag(fp,0x0020,0x0012,strlen(mdcbufr),(Uint8 *)mdcbufr); if (fi->nr_instance >= 0) sprintf(mdcbufr,"%d",fi->nr_instance); else sprintf(mdcbufr,"%u",img+1); MdcPutTag(fp,0x0020,0x0013,6,(Uint8 *)mdcbufr); MdcStringCopy(mdcbufr,fi->pat_orient,strlen(fi->pat_orient)); MdcPutTag(fp,0x0020,0x0020,strlen(mdcbufr),(Uint8 *)mdcbufr); sprintf(mdcbufr,"%+e\\%+e\\%+e",id->image_pos_dev[0], id->image_pos_dev[1], id->image_pos_dev[2]); MdcPutTag(fp,0x0020,0x0030,strlen(mdcbufr),(Uint8 *)mdcbufr); sprintf(mdcbufr,"%+e\\%+e\\%+e",id->image_pos_pat[0], id->image_pos_pat[1], id->image_pos_pat[2]); MdcPutTag(fp,0x0020,0x0032,strlen(mdcbufr),(Uint8 *)mdcbufr); sprintf(mdcbufr,"%+e\\%+e\\%+e\\%+e\\%+e\\%+e", id->image_orient_dev[0], id->image_orient_dev[1], id->image_orient_dev[2], id->image_orient_dev[3], id->image_orient_dev[4], id->image_orient_dev[5]); MdcPutTag(fp,0x0020,0x0035,strlen(mdcbufr),(Uint8 *)mdcbufr); sprintf(mdcbufr,"%+e\\%+e\\%+e\\%+e\\%+e\\%+e", id->image_orient_pat[0], id->image_orient_pat[1], id->image_orient_pat[2], id->image_orient_pat[3], id->image_orient_pat[4], id->image_orient_pat[5]); MdcPutTag(fp,0x0020,0x0037,strlen(mdcbufr),(Uint8 *)mdcbufr); break; case 0x0028: gbegin = ftell(fp); i32 = 0; /* write later */ MdcPutTag(fp,0x0028,0x0000,4,(Uint8 *)&i32); i16 = 1; MdcSWAP(i16); MdcPutTag(fp,0x0028,0x0002,2,(Uint8 *)&i16); i16 = 2; MdcSWAP(i16); MdcPutTag(fp,0x0028,0x0005,2,(Uint8 *)&i16); i16 = (Int16)id->height; MdcSWAP(i16); MdcPutTag(fp,0x0028,0x0010,2,(Uint8 *)&i16); i16 = (Int16)id->width; MdcSWAP(i16); MdcPutTag(fp,0x0028,0x0011,2,(Uint8 *)&i16); sprintf(mdcbufr,"%+e\\%+e",id->pixel_xsize,id->pixel_ysize); MdcPutTag(fp,0x0028,0x0030,strlen(mdcbufr),(Uint8 *)mdcbufr); strcpy(mdcbufr,"NONE"); MdcPutTag(fp,0x0028,0x0060,strlen(mdcbufr),(Uint8 *)mdcbufr); bits_allocated = (Uint16)MdcType2Bits(type); if (MDC_FORCE_INT == BIT16_S) { bits_stored = MDC_INT16_BITS_USED; }else{ bits_stored = MdcType2Bits(type); } i16 = bits_allocated; MdcSWAP(i16); MdcPutTag(fp,0x0028,0x0100,2,(Uint8 *)&i16); i16 = bits_stored; MdcSWAP(i16); MdcPutTag(fp,0x0028,0x0101,2,(Uint8 *)&i16); i16 = bits_stored - 1; MdcSWAP(i16); MdcPutTag(fp,0x0028,0x0102,2,(Uint8 *)&i16); switch (type) { case BIT8_U: case BIT16_U: case BIT32_U: case BIT64_U: i16 = 0; break; case BIT8_S: case BIT16_S: case BIT32_S: case BIT64_S: i16 = 1; break; default: i16 = 0; } if (type == BIT16_S && MDC_INT16_BITS_USED < 16) i16 = 0; /* unsigned */ MdcSWAP(i16); MdcPutTag(fp,0x0028,0x0103,2,(Uint8 *)&i16); i16 = 0x7fe0; MdcSWAP(i16); MdcPutTag(fp,0x0028,0x0200,2,(Uint8 *)&i16); break; case 0x7fe0: gbegin=ftell(fp); i32 = 0; /* write later */ MdcPutTag(fp,0x7fe0,0x0000,4,(Uint8 *)&i32); /* imagesize */ i32 = id->width * id->height * MdcType2Bytes(type); if (MDC_QUANTIFY || MDC_CALIBRATE || MDC_FORCE_INT) { switch (type) { case BIT8_U: new_buf = MdcGetImgBIT8_U(fi,img); break; case BIT16_S: new_buf = MdcGetImgBIT16_S(fi,img); break; default : new_buf = MdcGetImgBIT16_S(fi,img); } if (new_buf == NULL) { MdcPrntWarn("ACR Couldn't get normalized image"); return(MDC_NO); } if (MDC_FILE_ENDIAN != MDC_HOST_ENDIAN) MdcMakeImgSwapped(new_buf,fi,img,id->width,id->height,type); MdcPutTag(fp,0x7fe0,0x0010,i32,new_buf); MdcFree(new_buf); }else{ if ( (id->type == FLT32) || (id->type == FLT64) ) { /* ACR/NEMA doesn't accept float/double */ new_buf = MdcGetImgBIT16_S(fi,img); if (new_buf == NULL) { MdcPrntWarn("ACR Downscaling `float' failed"); return MDC_NO; } if (MDC_FILE_ENDIAN != MDC_HOST_ENDIAN) MdcMakeImgSwapped(new_buf,fi,img,id->width,id->height,type); MdcPutTag(fp,0x7fe0,0x0010,i32,new_buf); MdcFree(new_buf); }else{ /* ACR/NEMA accepts any integer */ if (MDC_FILE_ENDIAN != MDC_HOST_ENDIAN) { new_buf = MdcGetImgSwapped(fi,img); if (new_buf == NULL) { MdcPrntWarn("ACR Couldn't malloc swapped image"); return MDC_NO; } MdcPutTag(fp,0x7fe0,0x0010,i32,new_buf); MdcFree(new_buf); }else{ MdcPutTag(fp,0x7fe0,0x0010,i32,id->buf); } } } } MdcPutGroupLength(fp,group,gbegin); if (ferror(fp)) return MDC_NO; return MDC_YES; } const char *MdcWriteACR(FILEINFO *fi) { Uint32 i, FileBegin, FileEnd, FSIZE; MDC_FILE_ENDIAN = MDC_WRITE_ENDIAN; if (XMDC_GUI == MDC_NO) { MdcDefaultName(fi,MDC_FRMT_ACR,fi->ofname,fi->ifname); } if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Writing Acr/Nema:"); if (MDC_VERBOSE) MdcPrntMesg("ACR Writing <%s> ...",fi->ofname); /* check for colored files */ if (fi->map == MDC_MAP_PRESENT) return("ACR Colored files unsupported"); if (MDC_FILE_STDOUT == MDC_YES) { fi->ofp = stdout; }else{ if (MdcKeepFile(fi->ofname)) return("ACR File exists!!"); if ( (fi->ofp=fopen(fi->ofname,"wb")) == NULL) return("ACR Couldn't open file"); } /* check supported things */ if (MDC_QUANTIFY || MDC_CALIBRATE) { MdcPrntWarn("ACR Normalization loses quantified values!"); } for (i=0; inumber; i++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); FileBegin = ftell(fi->ofp); if (!MdcPutGroup(fi,0x0008,i)) return("ACR Bad write Identifying Info"); if (!MdcPutGroup(fi,0x0010,i)) return("ACR Bad write Patient Info"); if (!MdcPutGroup(fi,0x0018,i)) return("ACR Bad write Acquisition Info"); if (!MdcPutGroup(fi,0x0020,i)) return("ACR Bad write Relationship Info"); if (!MdcPutGroup(fi,0x0028,i)) return("ACR Bad write Image Presentation"); if (!MdcPutGroup(fi,0x7fe0,i)) return("ACR Bad write Image Array"); /* rewrite (0x0008,0x0001) tag */ FileEnd = ftell(fi->ofp); FSIZE = FileEnd-(FileBegin+MDC_SIZE_E0000+MDC_SIZE_E0001); MdcSWAP(FSIZE); fseek(fi->ofp,FP_G0008_E0001,SEEK_SET); MdcPutTag(fi->ofp,0x0008,0x0001,4,(Uint8 *)&FSIZE); fseek(fi->ofp,0,SEEK_END); } MdcCloseFile(fi->ofp); return NULL; } xmedcon-0.14.1/source/m-qmedian.c0000644000175000017510000006601412636253502013503 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-qmedian.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : do color reduction from RGB to 8 bit (median cut/dither) * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcReduceColor() - RGB to indexed for all FI images * * MdcRgb2Indexed() - RBG to indexed for one image buffer * * * * Notes : routines addapted from 'tiffmedian.c' found in libtiff * * * * see also http://www.libtiff.org/ * * * * Original Copyright Notice: * * * * Copyright (c) 1988-1997 Sam Leffler * * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * * * Permission to use, copy, modify, distribute, and sell this software and * * its documentation for any purpose is hereby granted without fee, * * provided that (i) the above copyright notices and this permission notice* * appear in all copies of the software and related documentation, and * * (ii) the names of Sam Leffler and Silicon Graphics may not be used in * * any advertising or publicity relating to the software without the * * specific, prior written permission of Sam Leffler and Silicon Graphics. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-qmedian.c,v 1.25 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "medcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ /* * Notes: * * [1] Floyd-Steinberg dither: * I should point out that the actual fractions we used were, assuming * you are at X, moving left to right: * * X 7/16 * 3/16 5/16 1/16 * * Note that the error goes to four neighbors, not three. I think this * will probably do better (at least for black and white) than the * 3/8-3/8-1/4 distribution, at the cost of greater processing. I have * seen the 3/8-3/8-1/4 distribution described as "our" algorithm before, * but I have no idea who the credit really belongs to. * Also, I should add that if you do zig-zag scanning (see my immediately * previous message), it is sufficient (but not quite as good) to send * half the error one pixel ahead (e.g. to the right on lines you scan * left to right), and half one pixel straight down. Again, this is for * black and white; I've not tried it with color. * -- * Lou Steinberg * * [2] Color Image Quantization for Frame Buffer Display, Paul Heckbert, * SIGGRAPH '82 proceedings, pp. 297-307 */ #define MAX_CMAP_SIZE 256 #define COLOR_DEPTH 8 #define MAX_COLOR 256 #define B_DEPTH 5 /* # bits/pixel to use */ #define B_LEN (1L<diff_type == MDC_YES) return("Reduce color unsupported for different types"); if (fi->diff_size == MDC_YES) return("Reduce color unsupported for different sizes"); if (fi->type != COLRGB) return(NULL); /* * STEP 0: initialize some values */ num_colors = MAX_CMAP_SIZE; imagewidth = fi->mwidth; imagelength = fi->mheight; for (i=0; inext; if (freeboxes) freeboxes->prev = NULL; ptr->next = usedboxes; usedboxes = ptr; if (ptr->next) ptr->next->prev = ptr; if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Reducing colors: "); for (n=0; nnumber; n++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,.5/(float)fi->number,NULL); get_histogram(fi->image[n].buf, ptr, n); } /* * STEP 3: continually subdivide boxes until no more free * boxes remain or until all colors assigned. */ while (freeboxes != NULL) { ptr = largest_box(); if (ptr != NULL) splitbox(ptr); else freeboxes = NULL; } /* * STEP 4: assign colors to all boxes */ for (i = 0, ptr = usedboxes; ptr != NULL; ++i, ptr = ptr->next) { rm[i] = ((ptr->rmin + ptr->rmax) << COLOR_SHIFT) / 2; gm[i] = ((ptr->gmin + ptr->gmax) << COLOR_SHIFT) / 2; bm[i] = ((ptr->bmin + ptr->bmax) << COLOR_SHIFT) / 2; } /* We're done with the boxes now */ MdcFree(box_list); freeboxes = usedboxes = NULL; /* * STEP 5: scan histogram and map all values to closest color */ /* 5a: create cell list as described in Heckbert[2] */ ColorCells = (C_cell **)malloc(C_LEN*C_LEN*C_LEN*sizeof(C_cell*)); if (ColorCells == NULL) return("Unable to malloc ColorCells"); memset(ColorCells, 0, C_LEN*C_LEN*C_LEN*sizeof(C_cell*)); /* 5b: create mapping from truncated pixel space to color table entries */ msg = map_colortable(); if (msg != NULL) { MdcFree(ColorCells); return(msg); } /* * STEP 6: scan image, match input values to table entries */ for (n=0; nnumber; n++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,.5/(float)fi->number,NULL); id = &fi->image[n]; dest8 = (Uint8 *)malloc(id->width * id->height); if (dest8 == NULL) return("Unable to malloc indexed buffer"); if (MDC_DITHER_COLOR == MDC_YES) msg = quant_fsdither(id->buf, dest8); else msg = quant(id->buf,dest8); if (msg != NULL) return(msg); MdcFree(id->buf); id->buf = dest8; id->type = BIT8_U; id->bits = 8; } fi->map = MDC_MAP_PRESENT; fi->type = BIT8_U; fi->bits = 8; /* * copy reduced colormap */ for (i = 0; i < MAX_CMAP_SIZE; ++i) { fi->palette[i*3 + 0] = rm[i]; fi->palette[i*3 + 1] = gm[i]; fi->palette[i*3 + 2] = bm[i]; } return (NULL); } char *MdcRgb2Indexed(Uint8 *srcRGB, Uint8 *dest8, Uint32 width, Uint32 height, Uint8 *palette, int dither) { int i; Colorbox *box_list, *ptr; char *msg; /* * STEP 0: initialize some values */ num_colors = MAX_CMAP_SIZE; imagewidth = width; imagelength = height; for (i=0; inext; if (freeboxes) freeboxes->prev = NULL; ptr->next = usedboxes; usedboxes = ptr; if (ptr->next) ptr->next->prev = ptr; get_histogram(srcRGB, ptr, 0); /* * STEP 3: continually subdivide boxes until no more free * boxes remain or until all colors assigned. */ while (freeboxes != NULL) { ptr = largest_box(); if (ptr != NULL) splitbox(ptr); else freeboxes = NULL; } /* * STEP 4: assign colors to all boxes */ for (i = 0, ptr = usedboxes; ptr != NULL; ++i, ptr = ptr->next) { rm[i] = ((ptr->rmin + ptr->rmax) << COLOR_SHIFT) / 2; gm[i] = ((ptr->gmin + ptr->gmax) << COLOR_SHIFT) / 2; bm[i] = ((ptr->bmin + ptr->bmax) << COLOR_SHIFT) / 2; } /* We're done with the boxes now */ MdcFree(box_list); freeboxes = usedboxes = NULL; /* * STEP 5: scan histogram and map all values to closest color */ /* 5a: create cell list as described in Heckbert[2] */ ColorCells = (C_cell **)malloc(C_LEN*C_LEN*C_LEN*sizeof(C_cell*)); if (ColorCells == NULL) return("Unable to malloc ColorCells"); memset(ColorCells, 0, C_LEN*C_LEN*C_LEN*sizeof(C_cell*)); /* 5b: create mapping from truncated pixel space to color table entries */ msg = map_colortable(); if (msg != NULL) { MdcFree(ColorCells); return(msg); } /* * STEP 6: scan image, match input values to table entries */ if (dither) msg = quant_fsdither(srcRGB,dest8); else msg = quant(srcRGB,dest8); /* * copy reduced colormap */ for (i = 0; i < MAX_CMAP_SIZE; ++i) { palette[i*3 + 0] = rm[i]; palette[i*3 + 1] = gm[i]; palette[i*3 + 2] = bm[i]; } return (msg); } static void get_histogram(Uint8 *pRGB, Colorbox* box, Uint32 n) { register Uint8 *inptr; register int red, green, blue; register Uint32 j, i; Uint8 *inputline; /* init at first image only */ if (n == 0) { register int *ptr = &histogram[0][0][0]; for (i = B_LEN*B_LEN*B_LEN; i-- > 0;) *ptr++ = 0; box->rmin = box->gmin = box->bmin = 999; box->rmax = box->gmax = box->bmax = -1; box->total = imagewidth * imagelength; } for (i = 0; i < imagelength; i++) { inputline = &pRGB[i*imagewidth*3]; inptr = inputline; for (j = imagewidth; j-- > 0;) { red = *inptr++ >> COLOR_SHIFT; green = *inptr++ >> COLOR_SHIFT; blue = *inptr++ >> COLOR_SHIFT; if (red < box->rmin) box->rmin = red; if (red > box->rmax) box->rmax = red; if (green < box->gmin) box->gmin = green; if (green > box->gmax) box->gmax = green; if (blue < box->bmin) box->bmin = blue; if (blue > box->bmax) box->bmax = blue; histogram[red][green][blue]++; } } } static Colorbox *largest_box(void) { register Colorbox *p, *b; register int size; b = NULL; size = -1; for (p = usedboxes; p != NULL; p = p->next) if ((p->rmax > p->rmin || p->gmax > p->gmin || p->bmax > p->bmin) && p->total > size) size = (b = p)->total; return (b); } static void splitbox(Colorbox* ptr) { int hist2[B_LEN]; int first=0, last=0; register Colorbox *new; register int *iptr, *histp; register int i, j; register int ir,ig,ib; register int sum, sum1, sum2; enum { RED, GREEN, BLUE } axis; /* * See which axis is the largest, do a histogram along that * axis. Split at median point. Contract both new boxes to * fit points and return */ i = ptr->rmax - ptr->rmin; if (i >= ptr->gmax - ptr->gmin && i >= ptr->bmax - ptr->bmin) axis = RED; else if (ptr->gmax - ptr->gmin >= ptr->bmax - ptr->bmin) axis = GREEN; else axis = BLUE; /* get histogram along longest axis */ switch (axis) { case RED: histp = &hist2[ptr->rmin]; for (ir = ptr->rmin; ir <= ptr->rmax; ++ir) { *histp = 0; for (ig = ptr->gmin; ig <= ptr->gmax; ++ig) { iptr = &histogram[ir][ig][ptr->bmin]; for (ib = ptr->bmin; ib <= ptr->bmax; ++ib) *histp += *iptr++; } histp++; } first = ptr->rmin; last = ptr->rmax; break; case GREEN: histp = &hist2[ptr->gmin]; for (ig = ptr->gmin; ig <= ptr->gmax; ++ig) { *histp = 0; for (ir = ptr->rmin; ir <= ptr->rmax; ++ir) { iptr = &histogram[ir][ig][ptr->bmin]; for (ib = ptr->bmin; ib <= ptr->bmax; ++ib) *histp += *iptr++; } histp++; } first = ptr->gmin; last = ptr->gmax; break; case BLUE: histp = &hist2[ptr->bmin]; for (ib = ptr->bmin; ib <= ptr->bmax; ++ib) { *histp = 0; for (ir = ptr->rmin; ir <= ptr->rmax; ++ir) { iptr = &histogram[ir][ptr->gmin][ib]; for (ig = ptr->gmin; ig <= ptr->gmax; ++ig) { *histp += *iptr; iptr += B_LEN; } } histp++; } first = ptr->bmin; last = ptr->bmax; break; } /* find median point */ sum2 = ptr->total / 2; histp = &hist2[first]; sum = 0; for (i = first; i <= last && (sum += *histp++) < sum2; ++i) ; if (i == first) i++; /* Create new box, re-allocate points */ new = freeboxes; freeboxes = new->next; if (freeboxes) freeboxes->prev = NULL; if (usedboxes) usedboxes->prev = new; new->next = usedboxes; usedboxes = new; histp = &hist2[first]; for (sum1 = 0, j = first; j < i; j++) sum1 += *histp++; for (sum2 = 0, j = i; j <= last; j++) sum2 += *histp++; new->total = sum1; ptr->total = sum2; new->rmin = ptr->rmin; new->rmax = ptr->rmax; new->gmin = ptr->gmin; new->gmax = ptr->gmax; new->bmin = ptr->bmin; new->bmax = ptr->bmax; switch (axis) { case RED: new->rmax = i-1; ptr->rmin = i; break; case GREEN: new->gmax = i-1; ptr->gmin = i; break; case BLUE: new->bmax = i-1; ptr->bmin = i; break; } shrinkbox(new); shrinkbox(ptr); } static void shrinkbox(Colorbox* box) { register int *histp, ir, ig, ib; if (box->rmax > box->rmin) { for (ir = box->rmin; ir <= box->rmax; ++ir) for (ig = box->gmin; ig <= box->gmax; ++ig) { histp = &histogram[ir][ig][box->bmin]; for (ib = box->bmin; ib <= box->bmax; ++ib) if (*histp++ != 0) { box->rmin = ir; goto have_rmin; } } have_rmin: if (box->rmax > box->rmin) for (ir = box->rmax; ir >= box->rmin; --ir) for (ig = box->gmin; ig <= box->gmax; ++ig) { histp = &histogram[ir][ig][box->bmin]; ib = box->bmin; for (; ib <= box->bmax; ++ib) if (*histp++ != 0) { box->rmax = ir; goto have_rmax; } } } have_rmax: if (box->gmax > box->gmin) { for (ig = box->gmin; ig <= box->gmax; ++ig) for (ir = box->rmin; ir <= box->rmax; ++ir) { histp = &histogram[ir][ig][box->bmin]; for (ib = box->bmin; ib <= box->bmax; ++ib) if (*histp++ != 0) { box->gmin = ig; goto have_gmin; } } have_gmin: if (box->gmax > box->gmin) for (ig = box->gmax; ig >= box->gmin; --ig) for (ir = box->rmin; ir <= box->rmax; ++ir) { histp = &histogram[ir][ig][box->bmin]; ib = box->bmin; for (; ib <= box->bmax; ++ib) if (*histp++ != 0) { box->gmax = ig; goto have_gmax; } } } have_gmax: if (box->bmax > box->bmin) { for (ib = box->bmin; ib <= box->bmax; ++ib) for (ir = box->rmin; ir <= box->rmax; ++ir) { histp = &histogram[ir][box->gmin][ib]; for (ig = box->gmin; ig <= box->gmax; ++ig) { if (*histp != 0) { box->bmin = ib; goto have_bmin; } histp += B_LEN; } } have_bmin: if (box->bmax > box->bmin) for (ib = box->bmax; ib >= box->bmin; --ib) for (ir = box->rmin; ir <= box->rmax; ++ir) { histp = &histogram[ir][box->gmin][ib]; ig = box->gmin; for (; ig <= box->gmax; ++ig) { if (*histp != 0) { box->bmax = ib; goto have_bmax; } histp += B_LEN; } } } have_bmax: ; } static C_cell *create_colorcell(int red, int green, int blue) { register int ir, ig, ib, i; register C_cell *ptr; int mindist, next_n; register int tmp, dist, n; ir = red >> (COLOR_DEPTH-C_DEPTH); ig = green >> (COLOR_DEPTH-C_DEPTH); ib = blue >> (COLOR_DEPTH-C_DEPTH); ptr = (C_cell *)malloc(sizeof (C_cell)); if (ptr == NULL) return(NULL); *(ColorCells + ir*C_LEN*C_LEN + ig*C_LEN + ib) = ptr; ptr->num_ents = 0; /* * Step 1: find all colors inside this cell, while we're at * it, find distance of centermost point to furthest corner */ mindist = 99999999; for (i = 0; i < num_colors; ++i) { if (rm[i]>>(COLOR_DEPTH-C_DEPTH) != ir || gm[i]>>(COLOR_DEPTH-C_DEPTH) != ig || bm[i]>>(COLOR_DEPTH-C_DEPTH) != ib) continue; ptr->entries[ptr->num_ents][0] = i; ptr->entries[ptr->num_ents][1] = 0; ++ptr->num_ents; tmp = rm[i] - red; if (tmp < (MAX_COLOR/C_LEN/2)) tmp = MAX_COLOR/C_LEN-1 - tmp; dist = tmp*tmp; tmp = gm[i] - green; if (tmp < (MAX_COLOR/C_LEN/2)) tmp = MAX_COLOR/C_LEN-1 - tmp; dist += tmp*tmp; tmp = bm[i] - blue; if (tmp < (MAX_COLOR/C_LEN/2)) tmp = MAX_COLOR/C_LEN-1 - tmp; dist += tmp*tmp; if (dist < mindist) mindist = dist; } /* * Step 3: find all points within that distance to cell. */ for (i = 0; i < num_colors; ++i) { if (rm[i] >> (COLOR_DEPTH-C_DEPTH) == ir && gm[i] >> (COLOR_DEPTH-C_DEPTH) == ig && bm[i] >> (COLOR_DEPTH-C_DEPTH) == ib) continue; dist = 0; if ((tmp = red - rm[i]) > 0 || (tmp = rm[i] - (red + MAX_COLOR/C_LEN-1)) > 0 ) dist += tmp*tmp; if ((tmp = green - gm[i]) > 0 || (tmp = gm[i] - (green + MAX_COLOR/C_LEN-1)) > 0 ) dist += tmp*tmp; if ((tmp = blue - bm[i]) > 0 || (tmp = bm[i] - (blue + MAX_COLOR/C_LEN-1)) > 0 ) dist += tmp*tmp; if (dist < mindist) { ptr->entries[ptr->num_ents][0] = i; ptr->entries[ptr->num_ents][1] = dist; ++ptr->num_ents; } } /* * Sort color cells by distance, use cheap exchange sort */ for (n = ptr->num_ents - 1; n > 0; n = next_n) { next_n = 0; for (i = 0; i < n; ++i) if (ptr->entries[i][1] > ptr->entries[i+1][1]) { tmp = ptr->entries[i][0]; ptr->entries[i][0] = ptr->entries[i+1][0]; ptr->entries[i+1][0] = tmp; tmp = ptr->entries[i][1]; ptr->entries[i][1] = ptr->entries[i+1][1]; ptr->entries[i+1][1] = tmp; next_n = i; } } return (ptr); } static char *map_colortable(void) { register int *histp = &histogram[0][0][0]; register C_cell *cell; register int j, tmp, d2, dist; int ir, ig, ib, i; for (ir = 0; ir < B_LEN; ++ir) for (ig = 0; ig < B_LEN; ++ig) for (ib = 0; ib < B_LEN; ++ib, histp++) { if (*histp == 0) { *histp = -1; continue; } cell = *(ColorCells + (((ir>>(B_DEPTH-C_DEPTH)) << C_DEPTH*2) + ((ig>>(B_DEPTH-C_DEPTH)) << C_DEPTH) + (ib>>(B_DEPTH-C_DEPTH)))); if (cell == NULL ) cell = create_colorcell( ir << COLOR_SHIFT, ig << COLOR_SHIFT, ib << COLOR_SHIFT); if (cell == NULL) return("Unable to malloc colorcell"); dist = 9999999; for (i = 0; i < cell->num_ents && dist > cell->entries[i][1]; ++i) { j = cell->entries[i][0]; d2 = rm[j] - (ir << COLOR_SHIFT); d2 *= d2; tmp = gm[j] - (ig << COLOR_SHIFT); d2 += tmp*tmp; tmp = bm[j] - (ib << COLOR_SHIFT); d2 += tmp*tmp; if (d2 < dist) { dist = d2; *histp = j; } } } return(NULL); } /* * straight quantization. Each pixel is mapped to the colors * closest to it. Color values are rounded to the nearest color * table entry. */ static char *quant(Uint8 *srcRGB, Uint8 *dest8) { Uint8 *inputline; register Uint8 *outptr, *inptr; register Uint32 i, j; register int red, green, blue; for (i = 0; i < imagelength; i++) { inputline = &srcRGB[i*3*imagewidth]; inptr = inputline; outptr = dest8+(i*imagewidth); for (j = 0; j < imagewidth; j++) { red = *inptr++ >> COLOR_SHIFT; green = *inptr++ >> COLOR_SHIFT; blue = *inptr++ >> COLOR_SHIFT; *outptr++ = (Uint8)histogram[red][green][blue]; } } return(NULL); } #define SWAP(type,a,b) { type p; p = a; a = b; b = p; } #define GetComponent(raw, cshift, c) \ cshift = raw; \ if (cshift < 0) \ cshift = 0; \ else if (cshift >= MAX_COLOR) \ cshift = MAX_COLOR-1; \ c = cshift; \ cshift >>= COLOR_SHIFT; static char *quant_fsdither(Uint8 *srcRGB, Uint8 *dest8) { Uint8 *inputline, *inptr; short *thisline, *nextline; register Uint8 *outptr; register short *thisptr, *nextptr; register Uint32 i, j; Uint32 imax, jmax; int lastline, lastpixel; imax = imagelength - 1; jmax = imagewidth - 1; thisline = (short *)malloc(imagewidth * 3 * sizeof (short)); if (thisline == NULL) return("Unable to malloc thisline"); nextline = (short *)malloc(imagewidth * 3 * sizeof (short)); if (nextline == NULL) { MdcFree(thisline); return("Unable to malloc nextline"); } inputline = srcRGB; inptr = inputline; nextptr = nextline; for (j = 0; j < imagewidth; ++j) { *nextptr++ = *inptr++; *nextptr++ = *inptr++; *nextptr++ = *inptr++; } for (i = 1; i < imagelength; ++i) { SWAP(short *, thisline, nextline); lastline = (i == imax); inputline = &srcRGB[i*imagewidth*3]; inptr = inputline; nextptr = nextline; for (j = 0; j < imagewidth; ++j) { *nextptr++ = *inptr++; *nextptr++ = *inptr++; *nextptr++ = *inptr++; } thisptr = thisline; nextptr = nextline; outptr = dest8 + i*imagewidth; for (j = 0; j < imagewidth; ++j) { int red, green, blue; register int oval, r2, g2, b2; lastpixel = (j == jmax); GetComponent(*thisptr++, r2, red); GetComponent(*thisptr++, g2, green); GetComponent(*thisptr++, b2, blue); oval = histogram[r2][g2][b2]; if (oval == -1) { int ci; register int cj, tmp, d2, dist; register C_cell *cell; cell = *(ColorCells + (((r2>>(B_DEPTH-C_DEPTH)) << C_DEPTH*2) + ((g2>>(B_DEPTH-C_DEPTH)) << C_DEPTH ) + (b2>>(B_DEPTH-C_DEPTH)))); if (cell == NULL) cell = create_colorcell(red, green, blue); if (cell == NULL) { MdcFree(thisline); MdcFree(nextline); return("Unable to malloc colorcell"); } dist = 9999999; for (ci = 0; ci < cell->num_ents && dist > cell->entries[ci][1]; ++ci) { cj = cell->entries[ci][0]; d2 = (rm[cj] >> COLOR_SHIFT) - r2; d2 *= d2; tmp = (gm[cj] >> COLOR_SHIFT) - g2; d2 += tmp*tmp; tmp = (bm[cj] >> COLOR_SHIFT) - b2; d2 += tmp*tmp; if (d2 < dist) { dist = d2; oval = cj; } } histogram[r2][g2][b2] = oval; } *outptr++ = (Uint8)oval; red -= rm[oval]; green -= gm[oval]; blue -= bm[oval]; if (!lastpixel) { thisptr[0] += blue * 7 / 16; thisptr[1] += green * 7 / 16; thisptr[2] += red * 7 / 16; } if (!lastline) { if (j != 0) { nextptr[-3] += blue * 3 / 16; nextptr[-2] += green * 3 / 16; nextptr[-1] += red * 3 / 16; } nextptr[0] += blue * 5 / 16; nextptr[1] += green * 5 / 16; nextptr[2] += red * 5 / 16; if (!lastpixel) { nextptr[3] += blue / 16; nextptr[4] += green / 16; nextptr[5] += red / 16; } nextptr += 3; } } } MdcFree(thisline); MdcFree(nextline); return(NULL); } xmedcon-0.14.1/source/xfilesel.h0000644000175000017510000000541312636253502013447 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xfilesel.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xfilesel.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xfilesel.h,v 1.22 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XFILESEL_H__ #define __XFILESEL_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcFileSelOpenCallbackOk(GtkWidget *w, GtkWidget *fs); void XMdcFileSelOpen(GtkWidget *widget, guint otype); void XMdcFileSelSaveCreateFormatMenu(GtkWidget *fs, guint format); void XMdcFileSelSaveCreateDefaultName(GtkWidget *fs); void XMdcFileSelSaveCallbackFormatMenu(GtkWidget *fs, guint *selected_format); void XMdcFileSelSaveCallbackAlias(GtkObject *fs, char *filename); void XMdcFileSelSaveCallbackDefault(GtkObject *fs, char *filename); void XMdcFileSelSaveCallbackOk(GtkWidget *w, GtkWidget *fs); void XMdcFileSelSaveCallbackCancel(GtkWidget *w, GtkWidget *fs); void XMdcFileSelSave(GtkWidget *widget, guint format); void XMdcLutSelOpenCallbackOk(GtkWidget *w, GtkWidget *fs); void XMdcLutSelOpen(GtkWidget *w, gpointer data); void XMdcRawPredefSelSaveCallbackOk(GtkWidget *widget, GtkWidget *fs); void XMdcRawPredefSelSave(GtkWidget *widget, gpointer data); void XMdcRawPredefSelOpenCallbackOk(GtkWidget *w, GtkWidget *fs); void XMdcRawPredefSelOpen(GtkWidget *widget, gpointer data); #endif xmedcon-0.14.1/source/m-acr.h0000644000175000017510000001140512636253501012630 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-acr.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-acr.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-acr.h,v 1.37 2015/12/22 13:59:29 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_ACR_H__ #define __M_ACR_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_ACR_TAG_SIZE 8 /* length of the group, element, length fields */ #define MDC_MAX_CHARS 100 /* our PrintTag limit */ #define MDC_SIZE_E0000 12 /* size of element 0x0000 in all groups */ #define MDC_SIZE_E0001 12 /* size of element 0x0001 in group 0x0008 */ /* basic structure of each ACR-NEMA format */ typedef struct MdcAcrTag_t{ Uint16 group; Uint16 element; Uint32 length; Uint8 *data; } MDC_ACR_TAG; typedef struct MdcSeqTag_T{ Uint16 group; Uint16 element; } MDC_SEQ_TAG; /* things for the DICOM reader */ #define MDC_VECT_ENERGYWINDOW 0 /* 0x0054:0x0010 */ #define MDC_VECT_DETECTOR 1 /* 0x0054:0x0020 */ #define MDC_VECT_PHASE 2 /* 0x0054:0x0030 */ #define MDC_VECT_ROTATION 3 /* 0x0054:0x0050 */ #define MDC_VECT_RRINTERVAL 4 /* 0x0054:0x0060 */ #define MDC_VECT_TIMESLOT 5 /* 0x0054:0x0070 */ #define MDC_VECT_SLICE 6 /* 0x0054:0x0080 */ #define MDC_VECT_ANGULARVIEW 7 /* 0x0054:0x0090 */ #define MDC_VECT_TIMESLICE 8 /* 0x0054:0x0100 */ #define MDC_VECT_TOTAL 9 /* last + 1 */ typedef struct MdcDicomStuff_t { MDC_MODALITY modality; Int8 INVERT; Int16 sign, type; /* window / rescale */ float si_slope; float si_intercept; /* vectors */ Int8 VectDO[MDC_VECT_TOTAL]; Uint16 VectNR[MDC_VECT_TOTAL]; Uint32 acqnr, dynnr; /* detector */ Int16 motion; /* gated stuff */ float timeslottime, frametime, framestart, frameduration, nrframes; float window_low, window_high, scan_arc; float intervals_acquired, intervals_rejected; Int16 heart_rate; /* mosaic images */ Int8 MOSAIC; Int8 mosaic_interlaced; Uint32 mosaic_width; Uint32 mosaic_height; Uint32 mosaic_number; }MDC_DICOM_STUFF_T; /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcCheckACR(FILEINFO *fi); void MdcSwapTag(MDC_ACR_TAG *tag); int MdcFindAcrInfo(FILEINFO *fi,Uint32 filesize, Uint32 *BeginAddress); int MdcGetAcrInfo(FILEINFO *fi, Uint32 filesize, Uint32 offset); char *MdcHackACR(FILEINFO *fi); const char *MdcReadACR(FILEINFO *fi); void MdcPrintTag(FILEINFO *fi, MDC_ACR_TAG *tag, char *fmt, ...); int MdcGetStrVM(char *dest,char *src, Uint32 nr); void MdcDicomInitStuff(MDC_DICOM_STUFF_T *dicom); void MdcDicomCheckVect(MDC_DICOM_STUFF_T *dicom, MDC_ACR_TAG *tag, int VECTOR); Uint32 MdcDicomNrOfVect(MDC_DICOM_STUFF_T *dicom, Uint16 nr, int VECTOR); int MdcDicomDoAcqData(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom); int MdcDicomSOPClass(char *sopclass); int MdcGetHHMMSS(char *time, Int16 *hour, Int16 *minute, Int16 *second); char *MdcDoTag(MDC_SEQ_TAG *seq, MDC_ACR_TAG *tag, FILEINFO *fi, Uint32 index); void MdcPutGroupLength(FILE *fp,Uint16 group, Uint32 gbegin); int MdcPutTag(FILE *fp,Uint16 group,Uint16 elem,Uint32 length,Uint8 *data); int MdcPutGroup(FILEINFO *fi, Uint16 group, Uint32 img); const char *MdcWriteACR(FILEINFO *fi); #endif xmedcon-0.14.1/source/xvifi.h0000644000175000017510000000357612636253503012772 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xvifi.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xvifi.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xvifi.h,v 1.14 2015/12/22 13:59:31 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XVIFI_H__ #define __XVIFI_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcEditFileInfoCallbackApply(GtkWidget *widget, gpointer data); void XMdcEditFileInfo(void); #endif xmedcon-0.14.1/source/m-qmedian.h0000644000175000017510000000420112636253502013476 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-qmedian.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-qmedian.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-qmedian.h,v 1.15 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_QMEDIAN_H__ #define __M_QMEDIAN_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ /**************************************************************************** F U N C T I O N S ****************************************************************************/ char *MdcReduceColor(FILEINFO *fi); char *MdcRgb2Indexed(Uint8 *srcRGB, Uint8 *dest8, Uint32 width, Uint32 height, Uint8 *palette, int dither); #endif xmedcon-0.14.1/source/xextract.c0000644000175000017510000005152312636253502013474 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xextract.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : extract images routines * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcExtractNotBussy() - Check for bussy * * XMdcExtractImages() - Extract the images * * XMdcHandleEcatList() - Handle Ecat list * * XMdcHandleNormList() - Handle Norm list * * XMdcGetImagesCallbackApply() - Get Apply callback * * XMdcGetImages() - Get the images * * XMdcExtractStyleSelCallbackApply() - Apply callback * * XMdcExtractStyleSel() - Extract Style Sel * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xextract.c,v 1.33 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "xmedcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ static int BUSSY = MDC_NO; static GtkWidget *wextract=NULL; /**************************************************************************** F U N C T I O N S ****************************************************************************/ gboolean XMdcExtractNotBussy(GtkWidget *widget, gpointer data) { BUSSY = MDC_NO; return(FALSE); } void XMdcExtractImages(void) { char *msg; XMdcProgressBar(MDC_PROGRESS_BEGIN,0.,"Extracting images:"); XMdcViewerHide(); XMdcViewerEnableAutoShrink(); XMdcViewerReset(); msg = MdcExtractImages(my.fi); if (msg != NULL) XMdcDisplayErr("Extract - %s",msg); XMdcDisplayImages(); XMdcProgressBar(MDC_PROGRESS_END,0.,NULL); XMDC_FILE_TYPE = XMDC_EXTRACT; } int XMdcHandleEcatList(char *s, Uint32 **list, Uint32 max) { char *msg; msg = MdcHandleEcatList(s, list, max); if (msg != NULL) { XMdcDisplayErr(msg); return(MDC_NO); } return(MDC_YES); } int XMdcHandleNormList(char *s, Uint32 **inrs,Uint32 *it,Uint32 *bt,Uint32 max) { char *msg; msg = MdcHandleNormList(s, inrs, it, bt, max); if (msg != NULL) { XMdcDisplayErr(msg); return(MDC_NO); } return(MDC_YES); } void XMdcGetImagesCallbackApply(GtkWidget *widget, gpointer data) { MdcExtractInputStruct *input = sExtractSelection.input; Uint32 images=1; Uint32 p, f, g, b; Uint32 it, bt; Uint32 *planes, *frames, *gates, *beds; char *entry; if (XMdcNoFileOpened()) return; if (input->style == MDC_INPUT_NORM_STYLE) { if ((input->inrs=(Uint32 *)malloc(MDC_BUF_ITMS*sizeof(Uint32)))==NULL) { XMdcDisplayErr("Couldn't alloc number buffer"); return; } entry = g_strdup(gtk_entry_get_text(GTK_ENTRY(sExtractSelection.InputPlanes))); it = 1; bt = 2; if (XMdcHandleNormList(entry,&input->inrs,&it,&bt,my.fi->number) != MDC_YES) { MdcFree(input->inrs); return; g_free(entry); } g_free(entry); }else{ if ( (planes=(Uint32 *)malloc((my.fi->dim[3]+1)*sizeof(Uint32)))==NULL ) { XMdcDisplayErr("Couldn't malloc planes buffer"); return; } memset(planes,0,(my.fi->dim[3]+1)*sizeof(Uint32)); if ( (frames=(Uint32 *)malloc((my.fi->dim[4]+1)*sizeof(Uint32)))==NULL ) { XMdcDisplayErr("Couldn't malloc frames buffer"); MdcFree(planes); return; } memset(frames,0,(my.fi->dim[4]+1)*sizeof(Uint32)); if ( (gates=(Uint32 *)malloc((my.fi->dim[5]+1)*sizeof(Uint32)))==NULL ) { XMdcDisplayErr("Couldn't malloc gates buffer"); MdcFree(planes); MdcFree(frames); return; } memset(gates,0,(my.fi->dim[5]+1)*sizeof(Uint32)); if ( (beds=(Uint32 *)malloc((my.fi->dim[6]+1)*sizeof(Uint32)))==NULL ) { XMdcDisplayErr("Couldn't malloc beds buffer"); MdcFree(planes); MdcFree(frames); MdcFree(gates); return; } memset(beds,0,(my.fi->dim[6]+1)*sizeof(Uint32)); entry = g_strdup(gtk_entry_get_text(GTK_ENTRY(sExtractSelection.InputPlanes))); if (XMdcHandleEcatList(entry,&planes,(unsigned)my.fi->dim[3]) != MDC_YES) { MdcFree(planes); MdcFree(frames); MdcFree(gates); MdcFree(beds); g_free(entry); return; } g_free(entry); entry = g_strdup(gtk_entry_get_text(GTK_ENTRY(sExtractSelection.InputFrames))); if (XMdcHandleEcatList(entry,&frames,(unsigned)my.fi->dim[4]) != MDC_YES) { MdcFree(planes); MdcFree(frames); MdcFree(gates); MdcFree(beds); g_free(entry); return; } g_free(entry); entry = g_strdup(gtk_entry_get_text(GTK_ENTRY(sExtractSelection.InputGates))); if (XMdcHandleEcatList(entry,&gates,(unsigned)my.fi->dim[5]) != MDC_YES) { MdcFree(planes); MdcFree(frames); MdcFree(gates); MdcFree(beds); g_free(entry); return; } g_free(entry); entry = g_strdup(gtk_entry_get_text(GTK_ENTRY(sExtractSelection.InputBeds))); if (XMdcHandleEcatList(entry,&beds,(unsigned)my.fi->dim[6]) != MDC_YES) { MdcFree(planes); MdcFree(frames); MdcFree(gates); MdcFree(beds); g_free(entry); return; } g_free(entry); MdcDebugPrint("p=%u f=%u g=%u b=%u",planes[0],frames[0],gates[0],beds[0]); images*=planes[0]*frames[0]*gates[0]*beds[0]; input->num_p = planes[0]; input->num_f = frames[0]; input->num_g = gates[0]; input->num_b = beds[0]; if ((input->inrs=(Uint32 *)malloc((images+1)*sizeof(Uint32)))==NULL) { XMdcDisplayErr("Couldn't malloc number buffer"); MdcFree(planes); MdcFree(frames); MdcFree(gates); MdcFree(beds); return; } /* get sequential image numbers (like normal selection) */ it = 1; for (b=1; b<=my.fi->dim[6];b++) if (beds[b]) for (g=1; g<=my.fi->dim[5];g++) if (gates[g]) for (f=1; f<=my.fi->dim[4];f++) if (frames[f]) for (p=1; p<=my.fi->dim[3];p++) if (planes[p]) { images = p + /* the image number */ my.fi->dim[3]*( (f-1) + my.fi->dim[4]*( (g-1) + my.fi->dim[5]*( (b-1) ) ) ); input->inrs[it++]=images; } MdcFree(planes); MdcFree(frames); MdcFree(gates); MdcFree(beds); } input->inrs[0] = it - 1; if (input->inrs[0] == 0) { XMdcDisplayWarn("No images specified"); MdcFree(input->inrs); return; } XMdcExtractImages(); } void XMdcGetImages(void) { GtkWidget *window=NULL; GtkWidget *box1; GtkWidget *box2; GtkWidget *box3; GtkWidget *table; GtkWidget *frame; GtkWidget *label; GtkWidget *button; GtkWidget *separator; GtkWidget *planes, *frames, *gates, *beds; MdcExtractInputStruct *input = sExtractSelection.input; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); BUSSY = MDC_YES; gtk_signal_connect(GTK_OBJECT(window),"destroy", GTK_SIGNAL_FUNC(XMdcExtractNotBussy),NULL); gtk_signal_connect(GTK_OBJECT(window),"destroy", GTK_SIGNAL_FUNC(gtk_widget_destroy),NULL); if (input->style == MDC_INPUT_NORM_STYLE) { gtk_window_set_title(GTK_WINDOW(window),"Extract Input Normal"); }else{ gtk_window_set_title(GTK_WINDOW(window),"Extract Input Ecat"); } gtk_container_set_border_width(GTK_CONTAINER(window),0); box1 = gtk_vbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(window),box1); gtk_container_set_border_width(GTK_CONTAINER(box1),5); gtk_widget_show(box1); frame = gtk_frame_new("Notes"); gtk_box_pack_start(GTK_BOX(box1),frame,TRUE,TRUE,0); gtk_widget_show(frame); box2 = gtk_vbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(frame),box2); gtk_container_set_border_width(GTK_CONTAINER(box2),5); gtk_widget_show(box2); if (input->style == MDC_INPUT_NORM_STYLE) { /* create input notes */ strcpy(mdcbufr,"a) Any number must be one-based (0 = All reversed)\n" \ "b) Syntax of a range : X...Y or X-Y\n" \ "c) Syntax of interval: X:S:Y (S = step)\n" \ "d) Items must be separated by spaces\n" \ "e) This list is sequence sensitive!\n\n" \ " Example: 1 3 4:2:11 12...6\n"); label = gtk_label_new(mdcbufr); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT); gtk_widget_set_name (label, "FixedLabel"); gtk_box_pack_start(GTK_BOX(box2),label,TRUE,TRUE,5); gtk_widget_show(label); frame = gtk_frame_new("Entry"); gtk_box_pack_start(GTK_BOX(box1),frame,TRUE,TRUE,0); gtk_widget_show(frame); box2 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),box2); gtk_container_set_border_width(GTK_CONTAINER(box2),0); gtk_widget_show(box2); box3 = gtk_hbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(box2),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),0); gtk_widget_show(box3); sprintf(mdcbufr,"Images [1...%u]",my.fi->number); label = gtk_label_new(mdcbufr); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_box_pack_start(GTK_BOX(box3),label,TRUE,TRUE,0); gtk_widget_show(label); planes=gtk_entry_new_with_max_length(50); MdcDebugPrint("rc-style name = %s",gtk_widget_get_name(planes)); gtk_entry_set_text(GTK_ENTRY(planes),"0"); gtk_editable_select_region(GTK_EDITABLE(planes),0,-1); gtk_box_pack_start(GTK_BOX(box3),planes,TRUE,TRUE,0); #ifdef GTKONE gtk_widget_draw_default(planes); #endif gtk_widget_show(planes); sExtractSelection.InputPlanes=planes; }else{ /* create input notes */ strcpy(mdcbufr,"a) Any number must be one-based (0 = All)\n" \ "b) Syntax of range : X...Y or X-Y\n" \ "c) Syntax of interval: X:S:Y (S = step)\n" \ "d) Items must be separated by spaces\n\n" \ " Example: 1 3 5...10 12:2:20\n"); label = gtk_label_new(mdcbufr); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT); gtk_widget_set_name (label, "FixedLabel"); gtk_box_pack_start(GTK_BOX(box2),label,TRUE,TRUE,5); gtk_widget_show(label); frame = gtk_frame_new("Entry"); gtk_box_pack_start(GTK_BOX(box1),frame,TRUE,TRUE,0); gtk_widget_show(frame); table = gtk_table_new (4, 3, FALSE); gtk_container_add(GTK_CONTAINER(frame),table); gtk_widget_show(table); label = gtk_label_new("Planes"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT); gtk_widget_set_name (label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,0,1); gtk_widget_show(label); sprintf(mdcbufr,"[1...%u]",my.fi->dim[3]); label = gtk_label_new(mdcbufr); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT); gtk_widget_set_name (label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,1,2,0,1); gtk_widget_show(label); planes = gtk_entry_new_with_max_length(50); gtk_entry_set_text(GTK_ENTRY(planes),"0"); gtk_editable_select_region(GTK_EDITABLE(planes),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),planes,2,3,0,1); gtk_widget_show(planes); sExtractSelection.InputPlanes=planes; label = gtk_label_new("Frames"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT); gtk_widget_set_name (label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,1,2); gtk_widget_show(label); sprintf(mdcbufr,"[1...%u]",my.fi->dim[4]); label = gtk_label_new(mdcbufr); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT); gtk_widget_set_name (label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,1,2,1,2); gtk_widget_show(label); frames = gtk_entry_new_with_max_length(50); gtk_entry_set_text(GTK_ENTRY(frames),"0"); gtk_editable_select_region(GTK_EDITABLE(frames),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),frames,2,3,1,2); gtk_widget_show(frames); sExtractSelection.InputFrames=frames; label = gtk_label_new("Gates"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT); gtk_widget_set_name (label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,2,3); gtk_widget_show(label); sprintf(mdcbufr,"[1...%u]",my.fi->dim[5]); label = gtk_label_new(mdcbufr); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT); gtk_widget_set_name (label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,1,2,2,3); gtk_widget_show(label); gates = gtk_entry_new_with_max_length(50); gtk_entry_set_text(GTK_ENTRY(gates),"0"); gtk_editable_select_region(GTK_EDITABLE(gates),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),gates,2,3,2,3); gtk_widget_show(gates); sExtractSelection.InputGates=gates; label = gtk_label_new("Beds"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT); gtk_widget_set_name (label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,3,4); gtk_widget_show(label); sprintf(mdcbufr,"[1...%u]",my.fi->dim[6]); label = gtk_label_new(mdcbufr); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT); gtk_widget_set_name (label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,1,2,3,4); gtk_widget_show(label); beds= gtk_entry_new_with_max_length(50); gtk_entry_set_text(GTK_ENTRY(beds),"0"); gtk_editable_select_region(GTK_EDITABLE(beds),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),beds,2,3,3,4); gtk_widget_show(beds); sExtractSelection.InputBeds=beds; } /* create horizontal separator */ separator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(box1),separator,FALSE,FALSE,0); gtk_widget_show(separator); /* create bottom buttons */ box2 = gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(box1),box2,TRUE,TRUE,2); gtk_widget_show(box2); button = gtk_button_new_with_label("Apply"); gtk_box_pack_start(GTK_BOX(box2),button,TRUE,TRUE,2); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(window)); gtk_signal_connect(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(XMdcGetImagesCallbackApply), NULL); gtk_signal_connect_object(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(window)); gtk_widget_show(button); button = gtk_button_new_with_label("Cancel"); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 2); gtk_signal_connect_object(GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(window)); gtk_widget_show(button); XMdcShowWidget(window); } void XMdcExtractStyleSelCallbackApply(GtkWidget *widget, gpointer data) { MdcExtractInputStruct *input = sExtractSelection.input; if (XMdcNoFileOpened()) return; MdcDebugPrint("extract stype: "); if (GTK_TOGGLE_BUTTON(sExtractSelection.NormStyle)->active) { MdcDebugPrint("\tnormal"); input->style = MDC_INPUT_NORM_STYLE; }else if (GTK_TOGGLE_BUTTON(sExtractSelection.EcatStyle)->active) { MdcDebugPrint("\tecat"); input->style = MDC_INPUT_ECAT_STYLE; } XMdcGetImages(); } void XMdcExtractStyleSel(GtkWidget *widget, gpointer data) { GtkWidget *box1; GtkWidget *box2; GtkWidget *box3; GtkWidget *box4; GtkWidget *frame; GtkWidget *button; GtkWidget *separator; GSList *group; MdcExtractInputStruct *input = sExtractSelection.input; if (XMdcNoFileOpened() || BUSSY) return; if (wextract == NULL) { wextract = gtk_window_new(GTK_WINDOW_TOPLEVEL); BUSSY = MDC_YES; gtk_signal_connect(GTK_OBJECT(wextract),"destroy", GTK_SIGNAL_FUNC(XMdcMedconQuit),NULL); gtk_signal_connect(GTK_OBJECT(wextract),"delete_event", GTK_SIGNAL_FUNC(XMdcExtractNotBussy),NULL); gtk_signal_connect(GTK_OBJECT(wextract),"delete_event", GTK_SIGNAL_FUNC(XMdcHandlerToHide),NULL); gtk_window_set_title(GTK_WINDOW(wextract),"Extract Selection"); gtk_container_set_border_width (GTK_CONTAINER(wextract), 0); box1 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(wextract),box1); gtk_widget_show(box1); /* create upper box - Extract Style */ box2 = gtk_vbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(box1),box2,TRUE,TRUE,0); gtk_container_set_border_width(GTK_CONTAINER(box2),5); gtk_widget_show(box2); box3 = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(box2),box3,TRUE,TRUE,0); gtk_widget_show(box3); frame = gtk_frame_new("Extraction Style"); gtk_box_pack_start(GTK_BOX(box3),frame,TRUE,TRUE,0); gtk_widget_show(frame); box4 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),box4); gtk_container_set_border_width(GTK_CONTAINER(box4), 5); gtk_widget_show(box4); button = gtk_radio_button_new_with_label(NULL,"Normal"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); if (input->style == MDC_INPUT_NORM_STYLE) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sExtractSelection.NormStyle=button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button= gtk_radio_button_new_with_label(group,"Ecat"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); if (input->style == MDC_INPUT_ECAT_STYLE) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sExtractSelection.EcatStyle=button; /* create horizontal separator */ separator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(box1),separator,FALSE,FALSE,0); gtk_widget_show(separator); /* create bottom button box */ box2 = gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(box1),box2,TRUE,TRUE,2); gtk_widget_show(box2); button = gtk_button_new_with_label("Apply"); gtk_box_pack_start(GTK_BOX(box2),button,TRUE,TRUE,2); gtk_signal_connect_object(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(wextract)); gtk_signal_connect(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(XMdcExtractStyleSelCallbackApply), NULL); gtk_widget_show(button); button = gtk_button_new_with_label("Cancel"); gtk_box_pack_start(GTK_BOX(box2),button,TRUE,TRUE,2); gtk_signal_connect(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(XMdcExtractNotBussy), NULL); gtk_signal_connect_object(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(gtk_widget_hide),GTK_OBJECT(wextract)); gtk_widget_show(button); }else{ GtkWidget *b1, *b2; gtk_widget_hide(wextract); b1 = sExtractSelection.NormStyle; b2 = sExtractSelection.EcatStyle; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),FALSE); switch (sExtractSelection.input->style) { case MDC_INPUT_NORM_STYLE: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),TRUE); break; case MDC_INPUT_ECAT_STYLE: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),TRUE); break; } } XMdcShowWidget(wextract); } xmedcon-0.14.1/source/xfancy.c0000644000175000017510000001372312636253502013122 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xfancy.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : fancy routines * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcFillGdkColor() - Fill the GdkColor widget * * XMdcMakeMyColors() - Make my prefered colors * * XMdcMakeMyFonts() - Make my prefered fonts * * XMdcMakeMyCursors() - Make my prefered cursors * * XMdcFreeMyStuff() - Free my prefered stuff * * XMdcAbout() - Hello * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xfancy.c,v 1.29 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "xmedcon.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcFillGdkColor(GdkColor *color, gint red, gint green, gint blue) { /* red, green, and blue are passed values, indicating the RGB triple * of the color we want to draw. Note that the values of the RGB components * within the GdkColor are taken from 0 to 65535, not 0 to 255. */ color->red = red * (65535/255); color->green = green * (65535/255); color->blue = blue * (65535/255); /* the pixel value indicates the index in the colormap of the color. * it is simply a combination of the RGB values we set earlier */ color->pixel = (gulong)(red*65536 + green*256 + blue); /* However, the pixel valule is only truly valid on 24-bit (TrueColor) * displays. Therefore, this call is required so that GDK and X can * give us the closest color available in the colormap */ } void XMdcMakeMyColors(void) { XMdcFillGdkColor(&Red,255,0,0); XMdcFillGdkColor(&Green,0,255,0); XMdcFillGdkColor(&Blue,0,0,255); XMdcFillGdkColor(&Yellow,255,255,0); } void XMdcMakeMyFonts(void) { #ifdef _WIN32 sfixed=gdk_font_load("-*-courier new-medium-r-normal--*-100-*-*-*-*-iso8859-1"); #else sfixed=gdk_font_load("-*-fixed-medium-r-semicondensed-*-*-120-*-*-*-*-*"); if (sfixed == NULL) sfixed=gdk_font_load("-adobe-courier-medium-r-normal-*-*-100-*-*-*-*-*-*"); if (sfixed == NULL) sfixed=gdk_font_load("-misc-fixed-medium-r-normal--*-100-*-*-*-*-*-*"); #endif if (sfixed == NULL) { XMdcDisplayErr("Couldn't get fixed font"); #ifdef GTKONE sfixed = my.mainwindow->style->font; #else /* the below is deprecated... should really be using pango fonts */ sfixed = gtk_style_get_font(my.mainwindow->style); #endif } } void XMdcMakeMyCursors(void) { handcursor = gdk_cursor_new(GDK_HAND2); fleurcursor = gdk_cursor_new(GDK_FLEUR); if (handcursor == NULL || fleurcursor == NULL) XMdcDisplayErr("Couldn't get cursor types"); } void XMdcFreeMyStuff(void) { /* the cursors */ if (handcursor != NULL) gdk_cursor_destroy(handcursor); if (fleurcursor != NULL) gdk_cursor_destroy(fleurcursor); /* the fonts */ if (sfixed != NULL) gdk_font_unref(sfixed); } void XMdcAbout(GtkWidget *widget, gpointer data) { GtkWidget *window=NULL; GtkWidget *box1; GtkWidget *label; GtkWidget *button; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_signal_connect(GTK_OBJECT(window),"destroy", GTK_SIGNAL_FUNC(gtk_widget_destroy),NULL); gtk_window_set_title(GTK_WINDOW(window),"Hello There"); gtk_container_set_border_width(GTK_CONTAINER(window), 0); box1 = gtk_vbox_new (FALSE, 0); gtk_container_add(GTK_CONTAINER(window),box1); gtk_widget_show(box1); sprintf(mdcbufr," %s \n\n",MdcGetLibLongVersion()); strcat(mdcbufr," http://xmedcon.sourceforge.net \n\n" \ " With special regards to You \n\n" \ " Licensed by Murphy's Law \n" \ " Enjoy it ..."); label = gtk_label_new(mdcbufr); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_CENTER); gtk_box_pack_start(GTK_BOX(box1),label,TRUE,TRUE,5); gtk_widget_show(label); button = gtk_button_new_with_label("Bye"); gtk_signal_connect_object(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(window)); gtk_box_pack_start(GTK_BOX(box1),button,TRUE,TRUE,5); gtk_widget_show(button); XMdcShowWidget(window); } xmedcon-0.14.1/source/m-inw.c0000644000175000017510000004152412636253502012661 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-inw.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : read and write INW 1.0 files * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcCheckINW() - Check INW format * * MdcReadINW() - Read INW file * * MdcWriteHeadStart() - Write Head_start * * MdcWriteHeadGen() - Write Head_gen * * MdcSkipHeadSpecs() - Skip Head_specs in file * * MdcWriteHeadSpecs() - Write Head_specs * * MdcWriteINW() - Write INW file * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-inw.c,v 1.45 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "medcon.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcCheckINW(FILEINFO *fi) { MDC_INW_HEAD_START hs; MDC_FILE_ENDIAN = MDC_LITTLE_ENDIAN; /* always */ if (fread((char *)&hs,1,MDC_INW_HEAD_START_SIZE,fi->ifp) != MDC_INW_HEAD_START_SIZE) return(MDC_BAD_READ); MdcSWAP(hs.mark); if (hs.mark != MDC_INW_SIG) return(MDC_FRMT_NONE); return(MDC_FRMT_INW); } char *MdcReadINW(FILEINFO *fi) { FILE *fp = fi->ifp; MDC_INW_HEAD_START hs; MDC_INW_HEAD_GEN hg; MDC_INW_HEAD_SPEC *hsp; IMG_DATA *id; Uint32 i, bytes, number; char *err=NULL; if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Reading INW:"); if (MDC_VERBOSE) MdcPrntMesg("INW Reading <%s> ...",fi->ifname); if (MDC_ECHO_ALIAS == MDC_YES) { MdcEchoAliasName(fi); return(NULL); /* useless here */ } memset(&hs,0,MDC_INW_HEAD_START_SIZE); memset(&hg,0,MDC_INW_HEAD_GEN_SIZE); if (fread((char *)&hs,1,MDC_INW_HEAD_START_SIZE,fp) != MDC_INW_HEAD_START_SIZE) return("INW Bad read HeadStart struct"); /* put some defaults we use */ fi->reconstructed = MDC_YES; fi->acquisition_type = MDC_ACQUISITION_TOMO; fi->endian=MDC_FILE_ENDIAN=MDC_LITTLE_ENDIAN; MdcSWAP(hs.mark); MdcSWAP(hs.version); MdcSWAP(hs.size_header); MdcSWAP(hs.size_start); MdcSWAP(hs.size_gen); MdcSWAP(hs.size_spec); if (fread((char *)&hg,1,MDC_INW_HEAD_GEN_SIZE,fp) != MDC_INW_HEAD_GEN_SIZE) return("INW Bad read HeadGen struct"); MdcSWAP(hg.no); MdcSWAP(hg.sizeX); MdcSWAP(hg.sizeY); MdcSWAP(hg.pixel_type); MdcSWAP(hg.init_trans); MdcSWAP(hg.dummy1); MdcSWAP(hg.time); MdcSWAP(hg.scanner); MdcMakeIEEEfl(hg.max); MdcMakeIEEEfl(hg.min); MdcMakeIEEEfl(hg.decay_cst); MdcMakeIEEEfl(hg.pixel_size); if (MDC_INFO) { MdcPrntScrn("\nHEAD START (%d bytes)\n",MDC_INW_HEAD_START_SIZE); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("mark : 0x%x\n",hs.mark); MdcPrntScrn("version : %hd.%hd\n",hs.version/256 ,hs.version%256); MdcPrntScrn("size_header : %hd\n",hs.size_header); MdcPrntScrn("size_start : %hd\n",hs.size_start); MdcPrntScrn("size_gen : %hd\n",hs.size_gen); MdcPrntScrn("size_spec : %hd\n",hs.size_spec); MdcPrntScrn("reserved : %.10s",hs.reserved); MdcPrntScrn("\n"); MdcPrntScrn("\nHEAD GEN (%d bytes)\n",MDC_INW_HEAD_GEN_SIZE); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("number planes : %hd\n",hg.no); MdcPrntScrn("number columns: %hd\n",hg.sizeX); MdcPrntScrn("number rows : %hd\n",hg.sizeY); MdcPrntScrn("pixel type : %hd\n",hg.pixel_type); MdcPrntScrn("init transl : %hd [mm]\n",hg.init_trans); MdcPrntScrn("dummy1 : %hd\n",hg.dummy1); MdcPrntScrn("day : %.12s\n",hg.day); MdcPrntScrn("time : %d [sec]\n",hg.time); MdcPrntScrn("decay constant: %+e\n",hg.decay_cst); MdcPrntScrn("pixel size : %+e [mm]\n",hg.pixel_size); MdcPrntScrn("scaled max : %+e\n",hg.max); MdcPrntScrn("scaled min : %+e\n",hg.min); MdcPrntScrn("scanner type : %hd ",hg.scanner); switch (hg.scanner) { case EcatII: MdcPrntScrn("(EcatII)"); break; case EcatIV: MdcPrntScrn("(EcatIV)"); break; default : MdcPrntScrn("(Unknown)"); } MdcPrntScrn("\n"); MdcPrntScrn("recon type : %c ",hg.reconstruction); switch (hg.reconstruction) { case reconFBP : MdcPrntScrn("(Filtered Backprojection)"); break; case reconMaxLikFV: MdcPrntScrn("(Maximum likelihood F. Vermeulen)"); break; case reconMaxLik : MdcPrntScrn("(Maximum likelihood T. De Backer)"); break; case reconMaxPos : MdcPrntScrn("(Maximum a Posteriori)"); break; default : MdcPrntScrn("(Unknown)"); } MdcPrntScrn("\n"); MdcPrntScrn("recon version : %d\n",(int)hg.recon_version); MdcPrntScrn("reserved : %.24s\n",hg.reserved); } /* check some supported things */ if (hg.pixel_type != 2) return("INW Unsupported pixel type"); if (hs.version != (Int16)(MDC_INW_VERS_HIGH*256 + MDC_INW_VERS_LOW)) return("INW Unsupported version"); /* fill in the FILEINFO struct */ number = hg.no; if (number == 0 ) return("INW No valid images specified"); fi->mwidth = hg.sizeX; fi->mheight = hg.sizeY; fi->bits = hg.pixel_type * 8; switch (hg.pixel_type) { case 1: fi->type = BIT8_U; break; case 2: fi->type = BIT16_S; break; /* only this is supported */ case 4: fi->type = BIT32_S; break; #ifdef HAVE_8BYTE_INT case 8: fi->type = BIT64_S; break; #endif } fi->dim[0] = 3; fi->dim[1] = hg.sizeX; fi->dim[2] = hg.sizeY; fi->dim[3] = hg.no; fi->pixdim[0] = 3.; fi->pixdim[1] = hg.pixel_size; fi->pixdim[2] = hg.pixel_size; switch (hg.reconstruction) { case reconFBP : strcpy(fi->recon_method ,"Filtered Backprojection"); break; case reconMaxLikFV: strcpy(fi->recon_method ,"Maximum likelihood F. Vermeulen"); break; case reconMaxLik : strcpy(fi->recon_method ,"Maximum likelihood T. De Backer"); break; case reconMaxPos : strcpy(fi->recon_method ,"Maximum a Posteriori"); break; } /* now we read the spec/image headers */ if ((hsp = (MDC_INW_HEAD_SPEC *)malloc(MDC_INW_HEAD_SPEC_SIZE*number)) == NULL) return("INW Bad malloc HeadSpec structs"); memset(hsp,0,MDC_INW_HEAD_SPEC_SIZE*number); if (fread((char *)hsp,MDC_INW_HEAD_SPEC_SIZE,number,fi->ifp) != number) { MdcFree(hsp); return("INW Bad read HeadSpec structs"); } if (!MdcGetStructID(fi,number)) return("INW Bad malloc IMG_DATA structs"); for (i=0; inumber; i++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); id = &fi->image[i]; MdcSWAP(hsp[i].time); MdcSWAP(hsp[i].trans); MdcSWAP(hsp[i].max); MdcSWAP(hsp[i].min); MdcMakeIEEEfl(hsp[i].cal_cst); if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrntScrn("\nHEAD SPEC #%.3d (%d bytes)\n",i+1 ,MDC_INW_HEAD_SPEC_SIZE); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("relative time : %d\n",hsp[i].time); MdcPrntScrn("calibr const : %+e\n",hsp[i].cal_cst); MdcPrntScrn("pixel max : %d\n",hsp[i].max); MdcPrntScrn("pixel min : %d\n",hsp[i].min); MdcPrntScrn("relat transl : %hd [mm]\n",hsp[i].trans); MdcPrntScrn("reserved : %.6s\n",hsp[i].reserved); } if (hsp[i].trans < 0.0 ) hsp[i].trans = - hsp[i].trans; /* positive */ /* fill in the IMG_DATA struct */ id->width = fi->mwidth; id->height = fi->mheight; id->bits = fi->bits; id->type = fi->type; id->calibr_fctr = hsp[i].cal_cst; id->pixel_xsize = fi->pixdim[1]; id->pixel_ysize = fi->pixdim[2]; bytes = id->width * id->height * MdcType2Bytes(id->type); if ( (id->buf=MdcGetImgBuffer(bytes)) == NULL ) { MdcFree(hsp); return("INW Bad malloc image buffer"); } /* read the image */ if (fread(id->buf,1,bytes,fi->ifp) != bytes) { err=MdcHandleTruncated(fi,i+1,MDC_YES); if (err != NULL) return(err); break; } } /* get the slice_width */ if (fi->number == 1) { /* unknown slice_width */ }else{ /* slice_width = relative translation from next slice */ fi->pixdim[3] = 0.0; for (i=0; inumber-1; i++) { if (hsp[i].trans > hsp[i+1].trans) { fi->image[i].slice_width = hsp[i].trans - hsp[i+1].trans; }else{ fi->image[i].slice_width = hsp[i+1].trans - hsp[i].trans; } fi->pixdim[3] += fi->image[i].slice_width; } /* last slice_width = previous slice_width */ fi->image[i].slice_width = fi->image[i-1].slice_width; fi->pixdim[3] += fi->image[i].slice_width; fi->pixdim[3] /= (float)fi->number; /* average */ } /* fill in orientation information */ fi->pat_slice_orient = MDC_SUPINE_HEADFIRST_TRANSAXIAL; /* default! */ strcpy(fi->pat_pos,MdcGetStrPatPos(fi->pat_slice_orient)); strcpy(fi->pat_orient,MdcGetStrPatOrient(fi->pat_slice_orient)); /* fill in the Acr/Nema variables */ for (i=0; inumber; i++) { id = &fi->image[i]; id->slice_spacing = id->slice_width; MdcFillImgPos(fi,i,i,0.0); MdcFillImgOrient(fi,i); } MdcFree(hsp); MdcCloseFile(fi->ifp); if (fi->truncated) return("INW Truncated image file"); return NULL; } int MdcWriteHeadStart(FILEINFO *fi) { MDC_INW_HEAD_START hs; memset(&hs,0,MDC_INW_HEAD_START_SIZE); hs.mark = MDC_INW_SIG; hs.version = MDC_INW_VERS_HIGH*256 + MDC_INW_VERS_LOW; hs.size_header = (Int16)( (MDC_INW_HEAD_SPEC_SIZE * fi->number) + MDC_INW_HEAD_START_SIZE + MDC_INW_HEAD_GEN_SIZE); hs.size_start = MDC_INW_HEAD_START_SIZE; hs.size_gen = MDC_INW_HEAD_GEN_SIZE; hs.size_spec = MDC_INW_HEAD_SPEC_SIZE; memcpy(hs.reserved,"MEDCON",6); MdcSWAP(hs.mark); MdcSWAP(hs.version); MdcSWAP(hs.size_header); MdcSWAP(hs.size_start); MdcSWAP(hs.size_gen); MdcSWAP(hs.size_spec); if (fwrite((char *)&hs,1,MDC_INW_HEAD_START_SIZE,fi->ofp) != MDC_INW_HEAD_START_SIZE) return(MDC_NO); return(MDC_YES); } int MdcWriteHeadGen(FILEINFO *fi) { MDC_INW_HEAD_GEN hg; memset(&hg,0,MDC_INW_HEAD_GEN_SIZE); hg.no = (Int16)fi->number; hg.sizeX = (Int16)fi->mwidth; hg.sizeY = (Int16)fi->mheight; hg.pixel_type = 2; /* only this supported */ hg.init_trans = 0; hg.dummy1 = 0; hg.time = 0; hg.decay_cst = 0.; hg.pixel_size = (fi->pixdim[1] + fi->pixdim[2]) / 2.; hg.max = (float) fi->qglmax; hg.min = (float) fi->qglmin; hg.scanner = 0; hg.reconstruction = '?'; hg.recon_version = 0; strncpy(hg.day,MDC_DATE,12); strncpy(hg.reserved,MDC_PRGR,24); MdcMakeVAXfl(hg.decay_cst); MdcMakeVAXfl(hg.pixel_size); MdcMakeVAXfl(hg.max); MdcMakeVAXfl(hg.min); MdcSWAP(hg.no); MdcSWAP(hg.sizeX); MdcSWAP(hg.sizeY); MdcSWAP(hg.pixel_type); MdcSWAP(hg.init_trans); MdcSWAP(hg.dummy1); MdcSWAP(hg.time); MdcSWAP(hg.scanner); if (fwrite((char *)&hg,1,MDC_INW_HEAD_GEN_SIZE,fi->ofp) != MDC_INW_HEAD_GEN_SIZE) return(MDC_NO); return(MDC_YES); } int MdcSkipHeadSpecs(FILEINFO *fi) { Uint32 i; MDC_INW_HEAD_SPEC hsp; memset(&hsp,0,MDC_INW_HEAD_SPEC_SIZE); for (i=0; i < fi->number; i++) if (fwrite((char *)&hsp,1,MDC_INW_HEAD_SPEC_SIZE,fi->ofp) != MDC_INW_HEAD_SPEC_SIZE) return MDC_NO; return MDC_YES; } int MdcWriteHeadSpecs(FILEINFO *fi) { IMG_DATA *id; MDC_INW_HEAD_SPEC hsp; Uint32 img; fseek(fi->ofp,MDC_INW_HEAD_START_SIZE + MDC_INW_HEAD_GEN_SIZE,SEEK_SET); for (img=0; img < fi->number; img++) { memset(&hsp,0,MDC_INW_HEAD_SPEC_SIZE); id = &fi->image[img]; hsp.time = 0; if (id->rescaled) { hsp.max = (Int16)id->rescaled_max; hsp.min = (Int16)id->rescaled_min; hsp.cal_cst = id->rescaled_fctr; }else{ hsp.max = (Int16)id->max; hsp.min = (Int16)id->min; hsp.cal_cst = id->rescale_slope; } hsp.trans = img * (Int16)id->slice_width; #ifdef MDC_USE_SLICE_SPACING if (fi->number > 1) hsp.trans = img * (Int16)id->slice_spacing; #endif memcpy(hsp.reserved,MDC_INSTITUTION,6); MdcMakeVAXfl(hsp.cal_cst); MdcSWAP(hsp.time); MdcSWAP(hsp.trans); MdcSWAP(hsp.max); MdcSWAP(hsp.min); if (fwrite((char *)&hsp,1,MDC_INW_HEAD_SPEC_SIZE,fi->ofp) != MDC_INW_HEAD_SPEC_SIZE) return(MDC_NO); } return(MDC_YES); } char *MdcWriteINW(FILEINFO *fi) { IMG_DATA *id; double value; Uint32 i, p, size; Uint8 *buf, *maxbuf; int FREE=MDC_NO, type = BIT16_S; /* only supported type in version 1.0 */ MDC_FILE_ENDIAN = MDC_LITTLE_ENDIAN; /* always */ if (MDC_FORCE_INT != MDC_NO) { if (MDC_FORCE_INT != BIT16_S) { MdcPrntWarn("INW Only Int16 pixels supported"); } } if (XMDC_GUI == MDC_NO) { MdcDefaultName(fi,MDC_FRMT_INW,fi->ofname,fi->ifname); } if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Writing INW:"); if (MDC_VERBOSE) MdcPrntMesg("INW Writing <%s> ...",fi->ofname); /* check for colored files */ if (fi->map == MDC_MAP_PRESENT) return("INW Colored files unsupported"); if (MDC_FILE_STDOUT == MDC_YES) { fi->ofp = stdout; }else{ if (MdcKeepFile(fi->ofname)) return("INW File exists!!"); if ( (fi->ofp=fopen(fi->ofname,"wb")) == NULL) return("INW Couldn't open file"); } if ( !MdcWriteHeadStart(fi) )return("INW Bad write HeadStart struct"); if ( !MdcWriteHeadGen(fi) ) return("INW Bad write HeadGen struct"); if ( !MdcSkipHeadSpecs(fi) ) return("INW Bad skipping HeadSpecs structs"); /* write the images */ for (i=0; inumber; i++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); id = &fi->image[i]; if ((id->type != BIT16_S) || MDC_QUANTIFY || MDC_CALIBRATE) { buf = MdcGetImgBIT16_S(fi, i); FREE=MDC_YES; type=BIT16_S; }else{ buf = id->buf; FREE=MDC_NO; type=id->type; } if (buf == NULL) return("INW Bad malloc image buffer"); /* write images with uniform sizes */ if (fi->diff_size) { size = fi->mwidth * fi->mheight * MdcType2Bytes(type); maxbuf = MdcGetResizedImage(fi, buf, type, i); if (maxbuf == NULL) return("INW Bad malloc maxbuf"); if (FREE) MdcFree(buf); FREE = MDC_YES; }else{ size = id->width * id->height * MdcType2Bytes(type); maxbuf = buf; } for (p=0; p < size; p += MdcType2Bytes(type)) { value=MdcGetDoublePixel((Uint8 *)&maxbuf[p],type); MdcWriteDoublePixel(value,type,fi->ofp); } if (FREE) MdcFree(maxbuf); if (ferror(fi->ofp)) return("INW Bad images MdcFlush"); } if ( !MdcWriteHeadSpecs(fi) ) return("INW Bad write HeadSpecs structs"); MdcCheckQuantitation(fi); MdcCloseFile(fi->ofp); return NULL; } xmedcon-0.14.1/source/xfiles.h0000644000175000017510000000372112636253502013126 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xfiles.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xfiles.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xfiles.h,v 1.18 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XFILES_H__ #define __XFILES_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcDisplayFile(const char *fname); void XMdcRereadFile(GtkWidget *widget, gpointer data); void XMdcCloseFile(GtkWidget *widget, gpointer data); int XMdcNoFileOpened(void); #endif xmedcon-0.14.1/source/xfancy.h0000644000175000017510000000401512636253502013121 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xfancy.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xfancy.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xfancy.h,v 1.16 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XFANCY_H__ #define __XFANCY_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcFillGdkColor(GdkColor *color, gint red, gint green, gint blue); void XMdcMakeMyColors(void); void XMdcMakeMyFonts(void); void XMdcMakeMyCursors(void); void XMdcFreeMyStuff(void); void XMdcAbout(GtkWidget *widget, gpointer data); #endif xmedcon-0.14.1/source/xresize.c0000644000175000017510000002630212636253502013320 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xresize.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : resize routines * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcResize() - Resize the dimension * * XMdcResizeSelCallbackApply() - Resize Sel Apply callback * * XMdcResizeSel() - Select the intial resize * * XMdcResizeNeeded() - Resize when image>screen? * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xresize.c,v 1.29 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include #include "xmedcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ static GtkWidget *wresize=NULL; /**************************************************************************** F U N C T I O N S ****************************************************************************/ Uint32 XMdcResize(Uint32 dim) { Uint32 newdim = dim; if (my.RESIZE == MDC_NO) return(newdim); /* note #1: when divide, integer round up => no pixel loss */ /* note #2: defined division constants are negative */ switch (sResizeSelection.CurType) { case XMDC_RESIZE_ORIGINAL: break; case XMDC_RESIZE_FOURTH : newdim -= (XMDC_RESIZE_FOURTH + 1); newdim /= -XMDC_RESIZE_FOURTH; break; case XMDC_RESIZE_THIRD : newdim -= (XMDC_RESIZE_THIRD + 1); newdim /= -XMDC_RESIZE_THIRD; break; case XMDC_RESIZE_HALF : newdim -= (XMDC_RESIZE_HALF + 1); newdim /= -XMDC_RESIZE_HALF; break; case XMDC_RESIZE_DOUBLE : newdim *= XMDC_RESIZE_DOUBLE; break; case XMDC_RESIZE_TRIPLE : newdim *= XMDC_RESIZE_TRIPLE; } return(newdim); } void XMdcResizeSelCallbackApply(GtkWidget *widget, gpointer data) { Int8 type=XMDC_RESIZE_ORIGINAL; MdcDebugPrint("initial resize: "); if (GTK_TOGGLE_BUTTON(sResizeSelection.Fourth)->active) { MdcDebugPrint("\t1:4"); type = XMDC_RESIZE_FOURTH; }else if (GTK_TOGGLE_BUTTON(sResizeSelection.Third)->active) { MdcDebugPrint("\t1:3"); type = XMDC_RESIZE_THIRD; }else if (GTK_TOGGLE_BUTTON(sResizeSelection.Half)->active) { MdcDebugPrint("\t1:2"); type = XMDC_RESIZE_HALF; }else if (GTK_TOGGLE_BUTTON(sResizeSelection.Original)->active) { MdcDebugPrint("\t1:1"); type = XMDC_RESIZE_ORIGINAL; }else if (GTK_TOGGLE_BUTTON(sResizeSelection.Double)->active) { MdcDebugPrint("\t2:1"); type = XMDC_RESIZE_DOUBLE; }else if (GTK_TOGGLE_BUTTON(sResizeSelection.Triple)->active) { MdcDebugPrint("\t3:1"); type = XMDC_RESIZE_TRIPLE; } if (type != sResizeSelection.CurType) { sResizeSelection.CurType = type; if (XMDC_FILE_OPEN == MDC_YES) { XMdcProgressBar(MDC_PROGRESS_BEGIN,0.,"Resizing images:"); XMdcViewerHide(); XMdcViewerEnableAutoShrink(); XMdcViewerReset(); XMdcDisplayImages(); XMdcProgressBar(MDC_PROGRESS_END,0.,NULL); } }else{ XMdcViewerShow(); } } void XMdcResizeSel(void) { GtkWidget *box1; GtkWidget *box2; GtkWidget *box3; GtkWidget *box4; GtkWidget *frame; GtkWidget *button; GtkWidget *separator; GSList *group; if (wresize == NULL) { wresize = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_signal_connect(GTK_OBJECT(wresize),"destroy", GTK_SIGNAL_FUNC(XMdcMedconQuit),NULL); gtk_signal_connect(GTK_OBJECT(wresize),"delete_event", GTK_SIGNAL_FUNC(XMdcHandlerToHide),NULL); gtk_window_set_title(GTK_WINDOW(wresize),"Resize Selection"); gtk_container_set_border_width (GTK_CONTAINER (wresize), 0); box1 = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (wresize), box1); gtk_widget_show(box1); /* create upper box - Initial Resize */ box2 = gtk_vbox_new (FALSE, 5); gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER(box2), 5); gtk_widget_show(box2); box3 = gtk_hbox_new (FALSE, 5); gtk_box_pack_start(GTK_BOX(box2), box3, TRUE, TRUE, 0); gtk_widget_show(box3); frame = gtk_frame_new("Initial Resize"); gtk_box_pack_start(GTK_BOX (box3), frame, TRUE, TRUE, 0); gtk_widget_show(frame); box4 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), box4); gtk_container_set_border_width(GTK_CONTAINER(box4), 5); gtk_widget_show(box4); button = gtk_radio_button_new_with_label(NULL, "[1:4] fourth"); gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0); if (sResizeSelection.CurType == XMDC_RESIZE_FOURTH); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sResizeSelection.Fourth = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group, "[1:3] third"); gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0); if (sResizeSelection.CurType == XMDC_RESIZE_THIRD) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sResizeSelection.Third = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group, "[1:2] half"); gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0); if (sResizeSelection.CurType == XMDC_RESIZE_HALF) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sResizeSelection.Half = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group, "[1:1] original"); gtk_box_pack_start (GTK_BOX(box4), button, TRUE, TRUE, 0); if (sResizeSelection.CurType == XMDC_RESIZE_ORIGINAL) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sResizeSelection.Original = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group, "[2:1] double"); gtk_box_pack_start (GTK_BOX(box4), button, TRUE, TRUE, 0); if (sResizeSelection.CurType == XMDC_RESIZE_DOUBLE) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sResizeSelection.Double = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group, "[3:1] triple"); gtk_box_pack_start (GTK_BOX(box4), button, TRUE, TRUE, 0); if (sResizeSelection.CurType == XMDC_RESIZE_TRIPLE) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sResizeSelection.Triple = button; /* create horizontal separator */ separator = gtk_hseparator_new (); gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, FALSE, 0); gtk_widget_show (separator); /* create bottom button box */ box2 = gtk_hbox_new (FALSE, 0); gtk_box_pack_start(GTK_BOX(box1), box2, TRUE, TRUE, 2); gtk_widget_show(box2); button = gtk_button_new_with_label("Apply"); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 2); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(wresize)); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcResizeSelCallbackApply), NULL); gtk_widget_show(button); button = gtk_button_new_with_label ("Cancel"); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 2); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide),GTK_OBJECT(wresize)); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcViewerShow), NULL); gtk_widget_show(button); }else{ /* set buttons to appropriate state */ GtkWidget *b1, *b2, *b3, *b4, *b5, *b6; gtk_widget_hide(wresize); b1 = sResizeSelection.Fourth; b2 = sResizeSelection.Third; b3 = sResizeSelection.Half; b4 = sResizeSelection.Original; b5 = sResizeSelection.Double; b6 = sResizeSelection.Triple; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b4),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b5),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b6),FALSE); switch (sResizeSelection.CurType) { case XMDC_RESIZE_FOURTH : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),TRUE); break; case XMDC_RESIZE_THIRD : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),TRUE); break; case XMDC_RESIZE_HALF : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3),TRUE); break; case XMDC_RESIZE_ORIGINAL: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b4),TRUE); break; case XMDC_RESIZE_DOUBLE : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b5),TRUE); break; case XMDC_RESIZE_TRIPLE : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b6),TRUE); break; } } XMdcShowWidget(wresize); } void XMdcResizeNeeded(void) { if (XMdcScaleW(my.fi->mwidth) >= (gdk_screen_width() - XMDC_FREE_BORDER) || XMdcScaleH(my.fi->mheight) >= (gdk_screen_height() - XMDC_FREE_BORDER)) { XMdcAskYesNo( GTK_SIGNAL_FUNC(XMdcViewerShow), GTK_SIGNAL_FUNC(XMdcResizeSel), "Images too big for screen. Show images anyway?"); XMdcViewerHide(); }else{ XMdcViewerShow(); } } xmedcon-0.14.1/source/m-dicm.c0000644000175000017510000024263412636253502013005 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-dicm.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : Read DICOM files * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcCheckDICM() - Check DICOM format * * MdcReadDICM() - Read DICOM format * * MdcWriteDICM() - Write DICOM format * * MdcCheckMosaic() - Check Mosaic file * * * * Notes : Source needs VT-DICOM-package written by Tony Voet * * * * Credits : - DICOM library - Tony Voet * * - Mosaic support - Roland Marcus Rutschmann * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-dicm.c,v 1.191 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "dicom.h" #include "medcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_STR_UID_CREATOR "777.777.0.0.0" #define UNDEFINED_LENGTH 0xffffffff #define MDC_DICM_FIX_TYPE MDC_YES /* fix wrong unsigned pixel type */ #define IROW 2 #define ICOL 1 /* extra stuff for reading DICOM */ static void MdcDicomInvert(IMG_DATA *id); static char *MdcDicomHandleImages(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom , IMAGE *image, Uint32 number); static char *MdcHandleMosaic(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom , IMAGE *image); static void MdcPrintDicomInfoDB(FILEINFO *fi); /* extra stuff for writing DICOM */ static Uint32 MdcDicomMakeUID(FILEINFO *fi, Int8 uid, char str[]); static void MdcDicomWriteInfoSeq(FILE *fp, Uint16 group, Uint16 element); static void MdcDicomWriteItem(FILE *fp); static void MdcDicomWriteItemDelItem(FILE *fp); static void MdcDicomWriteInfoSeqDelItem(FILE *fp); static char *MdcDicomWriteMetaHeader (FILEINFO *fi, MDC_DICOM_STUFF_T *dicom); static char *MdcDicomWriteSetModality(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom); static char *MdcDicomWriteG0008(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom); static char *MdcDicomWriteG0010(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom); static char *MdcDicomWriteG0018(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom); static char *MdcDicomWriteG0020(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom); static char *MdcDicomWriteG0028(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom); static char *MdcDicomWriteG0054(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom); static char *MdcDicomWriteG7FE0(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom); /* including the addapted dicom lib functions */ static int mdc_dicom_read(FILEINFO *fi, IMAGE **image, int *number); static void mdc_dicom_dumpinfo(FILEINFO *fi); static void mdc_dicom_printinfo(const ELEMENT *e,const char *description); static void mdc_dicom_getinfo(FILEINFO *fi); static void mdc_dicom_get_vr(ELEMENT *e); static Uint8 *mdc_dicom_handle_vr(ELEMENT *e, Uint8 *tdata); static int mdc_dicom_write_element(FILE *fp, Uint16 group, Uint16 element, Uint32 length, Uint8 *data); static int MDC_DICOM_VERBOSE = MDC_YES; static Uint32 MDC_REWRF_SLOPE; /* rewrite offset to slope tag */ static Uint32 MDC_REWRF_INTERCEPT; /* rewrite offset to intercept tag */ static Int32 mdc_prev_nr_series = -MDC_TYPE_UID_SERIES; static Int32 mdc_prev_series_uid = 0; static time_t mdc_sec, *mdc_psec=NULL; /* universal time */ static char mdc_dummy1[]="1"; static GATED_DATA *gd; static ACQ_DATA *acq; static DYNAMIC_DATA *dd; extern MDC_DICOM_STUFF_T mdc_dicom_stuff; /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcCheckDICM(FILEINFO *fi) { char sig[5]; fseek(fi->ifp,128,SEEK_SET); if (fread(sig,1,4,fi->ifp) != 4) return(MDC_BAD_READ); fseek(fi->ifp,0,SEEK_SET); sig[4]='\0'; MdcLowStr(sig); if (strstr(sig,MDC_DICM_SIG) == NULL) return(MDC_FRMT_NONE); return(MDC_FRMT_DICM); } void MdcDicomInvert(IMG_DATA *id) { double pixvalue; double max=0., min=0.; Uint8 *pixel; Uint32 i, n; n = id->width * id->height; /* retrieve present max/min values */ for (pixel=id->buf, i=0; itype)) { pixvalue = MdcGetDoublePixel(pixel,id->type); if (i==0) { max = pixvalue; min = pixvalue; }else{ if ( pixvalue > max ) max = pixvalue; else if ( pixvalue < min ) min = pixvalue; } } /* invert pixel values */ for (pixel=id->buf, i=0; itype)) { pixvalue = MdcGetDoublePixel(pixel,id->type); pixvalue = max - pixvalue + min; MdcPutDoublePixel(pixel,pixvalue,id->type); } } char *MdcDicomHandleImages(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom, IMAGE *image, Uint32 number) { IMAGE *pimg; IMG_DATA *id; Uint32 img=0, i, f, bytes, t; Uint8 *pdata = NULL; for (img=0, i=0; inumber,NULL); id = &fi->image[img]; id->width = (Uint32)pimg->w; id->height = (Uint32)pimg->h; id->type = fi->type; id->bits = MdcType2Bits(id->type); if (id->type != COLRGB) { id->quant_scale = dicom->si_slope; id->intercept = dicom->si_intercept; } bytes = id->width*id->height*MdcType2Bytes(id->type); id->buf = MdcGetImgBuffer(bytes); if (id->buf == NULL) return("DICM Couldn't allocate image buffer"); if (fi->type == COLRGB) { pdata = (Uint8 *)pimg->data.rgb; }else{ pdata = (Uint8 *)pimg->data.gray; } pdata+=f*bytes; memcpy(id->buf,pdata,bytes); if (!((img == 0) && (f == 0))) { /* copy voxel size and orient values from the first image */ id->pixel_xsize = fi->image[0].pixel_xsize; id->pixel_ysize = fi->image[0].pixel_ysize; id->slice_width = fi->image[0].slice_width; id->slice_spacing = fi->image[0].slice_spacing; } /* image orient/position according to patient coordinate system */ if (id->image_orient_pat[0]==0.0 && id->image_orient_pat[1]==0.0 && id->image_orient_pat[4]==0.0 && id->image_orient_pat[5]==0.0 ) { /* no patient coordinate system defines, try pat_orient */ if ((img == 0) && (f == 0)) fi->pat_slice_orient = MdcTryPatSliceOrient(fi->pat_orient); if (fi->pat_slice_orient != MDC_UNKNOWN) { MdcFillImgPos(fi,img,fi->dim[3]==0 ? 0 : img%fi->dim[3],0.0); MdcFillImgOrient(fi,img); } } /* image orient/position according to device (RETIRED)*/ if (id->image_orient_dev[0]==0.0 && id->image_orient_dev[1]==0.0 && id->image_orient_dev[4]==0.0 && id->image_orient_dev[5]==0.0 ) { /* no patient coordinate system defines */ switch (fi->pat_slice_orient) { case MDC_SUPINE_HEADFIRST_TRANSAXIAL: case MDC_SUPINE_HEADFIRST_SAGITTAL : case MDC_SUPINE_HEADFIRST_CORONAL : /* same coordinate system */ for (t=0; t<6; t++) id->image_orient_dev[t] = id->image_orient_pat[t]; break; } } if (id->image_pos_dev[0] == 0.0 && id->image_pos_dev[1] == 0.0 && id->image_pos_dev[2] == 0.0 ) { switch (fi->pat_slice_orient) { case MDC_SUPINE_HEADFIRST_TRANSAXIAL: case MDC_SUPINE_HEADFIRST_SAGITTAL : case MDC_SUPINE_HEADFIRST_CORONAL : /* same coordinate system */ for (t=0; t<3; t++) id->image_pos_dev[t] = id->image_pos_pat[t]; break; } } if (id->type != COLRGB) { if (dicom->INVERT == MDC_YES) MdcDicomInvert(id); } img+=1; } } return(NULL); } int MdcCheckMosaic(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { /* support enabled ? */ if (MDC_DICOM_MOSAIC_ENABLED == MDC_NO) return(MDC_NO); if (dicom->MOSAIC == MDC_NO) return(MDC_NO); if (MDC_DICOM_MOSAIC_FORCED == MDC_YES) { dicom->mosaic_width = mdc_mosaic_width; dicom->mosaic_height= mdc_mosaic_height; dicom->mosaic_number= mdc_mosaic_number; dicom->mosaic_interlaced = mdc_mosaic_interlaced; } /* do some sanity checks before handling as MOSAIC */ if ( fi->number == 1 && dicom->mosaic_number > 0 && dicom->mosaic_width > 0 && dicom->mosaic_height > 0 && fi->mwidth > dicom->mosaic_width && fi->mheight > dicom->mosaic_height && fi->mwidth % dicom->mosaic_width == 0 && fi->mheight % dicom->mosaic_height == 0 ) { return(MDC_YES); } return(MDC_NO); } char *MdcHandleMosaic(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom, IMAGE *image) { IMG_DATA *id=NULL; IMAGE *pimg = &image[0]; Uint32 width, height, number, bytes, size; Uint32 bytes_per_mosaic, bytes_per_old_img_line, bytes_per_y_plane; Uint32 nr_of_pics_per_line, sl, s, x, y, offset, yline, i; Uint8 *pmosaic, *p, *pdata; Int8 DO_VOXEL_FIX=MDC_NO; float f; /* in case we need to know */ MdcDebugPrint("handling image as MOSAIC"); /* allocate new block of memory */ width = dicom->mosaic_width; height = dicom->mosaic_height; number= dicom->mosaic_number; bytes = MdcType2Bytes(fi->type); size = bytes * width * height; pmosaic = malloc(size * number); if (pmosaic == NULL) return("DICM Bad malloc pmosaic buffer"); /* extract the stamps */ bytes_per_mosaic = bytes * width; bytes_per_old_img_line = bytes * fi->mwidth; nr_of_pics_per_line = bytes_per_old_img_line / bytes_per_mosaic; bytes_per_y_plane = height * bytes_per_old_img_line; for (sl=0; slmosaic_interlaced == MDC_YES) { if (sl%2 == 0) { s = sl/2; }else{ s = number/2 + (sl-1)/2; } }else{ s=sl; } x = s % nr_of_pics_per_line; y = s / nr_of_pics_per_line; offset = (y * bytes_per_y_plane) + (x * bytes_per_mosaic); for (yline=0; yline < height; yline++) { p = pmosaic + sl*size + yline*bytes_per_mosaic; pdata = (Uint8 *)pimg->data.gray + offset; memcpy(p,pdata,bytes_per_mosaic); offset += bytes_per_old_img_line; } } /* fake multi frame image */ MdcFree(pimg->data.gray); pimg->data.gray= (Uint16 *)pmosaic; image[0].frames = number; pimg->w = width; pimg->h = height; /* set FILEINFO appropriate */ fi->dim[3] = number; fi->mwidth = width; fi->mheight = height; if (!MdcGetStructID(fi,number)) { MdcFree(pmosaic); return("DICM Bad malloc IMG_DATA structs for mosaic"); } /* fake DYNAMIC_DATA later */ dicom->frameduration = 1.; /* no idea what tag to use */ /* set IMG_DATA appropriate */ id = &fi->image[0]; id->width = width; id->height = height; if (MDC_DICOM_MOSAIC_FORCED == MDC_YES) { /* mosaic forced: voxel fixing only when requested */ if (MDC_DICOM_MOSAIC_FIX_VOXEL == MDC_YES) { DO_VOXEL_FIX = MDC_YES; }else{ DO_VOXEL_FIX = MDC_NO; } }else{ /* mosaic autodetect: always do voxel fixing */ DO_VOXEL_FIX = MDC_YES; } if (DO_VOXEL_FIX == MDC_YES) { /* handle mosaic calculation of pixel size */ /* mosaic calculates pixsizefact by field of view/nr_of_all_pix not taking*/ /* into account that there are severall slices in the whole picture. */ /* eg 200x200mm fov 8x8 pix each having 64x64 pix. The whole matrix has */ /* 512x512 pix so pixsize is calculated by 200/512 instead of 200/64 */ /* NOTE: apparently valid for MAGNETOM dialect, not valid for SONATA */ id->pixel_xsize *= (float)nr_of_pics_per_line; id->pixel_ysize *= (float)nr_of_pics_per_line; /* set globally as well */ fi->pixdim[1] = id->pixel_xsize; fi->pixdim[2] = id->pixel_ysize; } /* make orthogonal */ for (i=0; i<6; i++) { f = id->image_orient_dev[i]; id->image_orient_dev[i]=(float)MdcGetOrthogonalInt(f); } for (i=0; i<6; i++) { f = id->image_orient_pat[i]; id->image_orient_pat[i]=(float)MdcGetOrthogonalInt(f); } fi->pat_slice_orient = MdcGetPatSliceOrient(fi,0); MdcFillImgPos(fi,0,0,0); return(NULL); } static void MdcPrintDicomInfoDB(FILEINFO *fi) { /* make string */ sprintf(mdcbufr,"%s+%04d%02d%02d+%02d%02d%02d",fi->patient_name ,fi->study_date_year ,fi->study_date_month ,fi->study_date_day ,fi->study_time_hour ,fi->study_time_minute ,fi->study_time_second); /* print string */ MdcPrntScrn("%s\n",mdcbufr); } const char *MdcReadDICM(FILEINFO *fi) { IMAGE *image=NULL, *pimg=NULL; IMG_DATA *id=NULL; MDC_DICOM_STUFF_T *dicom=&mdc_dicom_stuff; Uint32 i, t, number=0, nrimages=0; int COLOR=MDC_NO; const char *msg=NULL; MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; /* init dicom struct */ MdcDicomInitStuff(dicom); /* init MOD structs */ MdcGetStructMOD(fi); if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Reading DICOM:"); if (MDC_VERBOSE) MdcPrntMesg("DICM Reading <%s> ...",fi->ifname); if ((MDC_ECHO_ALIAS == MDC_YES) || (MDC_INFO_DB == MDC_YES)) { /* get one struct to fill */ MdcGetStructID(fi,1); /* retrieve info from file */ mdc_dicom_getinfo(fi); /* echo alias */ if (MDC_ECHO_ALIAS == MDC_YES) MdcEchoAliasName(fi); /* print db info */ if (MDC_INFO_DB == MDC_YES) MdcPrintDicomInfoDB(fi); /* leave */ return(NULL); } MdcMergePath(fi->ipath,fi->idir,fi->ifname); /* first pass: limit log level to errors */ if (MDC_BLOCK_MESSAGES == MDC_LEVEL_ALL) { dicom_log_level = EMERGENCY; }else{ dicom_log_level = ERROR; } /* reading file 1st time for info printout */ if (MDC_INFO) { MdcPrintLine('*',MDC_HALF_LENGTH); MdcPrntScrn("Pass #1: through DICOM reader\n"); MdcPrintLine('*',MDC_HALF_LENGTH); mdc_dicom_dumpinfo(fi); } if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,0.1,NULL); /* second pass: allow warnings */ if (MDC_BLOCK_MESSAGES == MDC_NO) dicom_log_level = NOTICE; /* reading file 2nd time for images */ if (mdc_dicom_read(fi,&image,(Int32 *)&nrimages)) { MdcSplitPath(fi->ipath,fi->idir,fi->ifname); dicom_free(image,(signed)nrimages); return("DICM Error reading file"); } if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,0.1,NULL); MdcSplitPath(fi->ipath,fi->idir,fi->ifname); /* number of images & flag color */ for (number=0, i=0; iframes; if (number == 0 ) { dicom_free(image,(signed)nrimages); return("DICM Bad number of images"); } if (pimg->rgb) COLOR = MDC_YES; /* MARK: all images must be identical */ } if (!MdcGetStructID(fi,number)) { dicom_free(image,(signed)nrimages); return("DICM Bad malloc IMG_DATA structs"); } /* third pass: limit log level back to errors */ if (MDC_BLOCK_MESSAGES == MDC_NO) dicom_log_level = ERROR; /* reading file 3rd time for info retrieving (through Acr/Nema reader) */ if (MDC_INFO) { MdcPrntScrn("\n\n"); MdcPrintLine('*',MDC_HALF_LENGTH); MdcPrntScrn("Pass #2: through Acr/Nema reader\n"); MdcPrintLine('*',MDC_HALF_LENGTH); } MdcMergePath(fi->ipath,fi->idir,fi->ifname); mdc_dicom_getinfo(fi); MdcSplitPath(fi->ipath,fi->idir,fi->ifname); /* init FILEINFO parameters */ if (COLOR == MDC_YES) { fi->map = MDC_MAP_PRESENT; fi->type= COLRGB; }else{ fi->map = MDC_MAP_GRAY; fi->type= (dicom->sign == 1) ? BIT16_S : BIT16_U; } fi->bits = MdcType2Bits(fi->type); fi->endian = MDC_HOST_ENDIAN; fi->dim[0] = 3; fi->pixdim[0] = 0.; /* fix for single image PT modality */ if (dicom->modality == M_PT) { fi->number = 1; for (t=3; t < MDC_MAX_DIMS; t++) fi->dim[t] = 1; } /* in case of mosaic, fake a multi frame image */ if (MdcCheckMosaic(fi,dicom) == MDC_YES) { msg = MdcHandleMosaic(fi,dicom,image); if (msg != NULL) { dicom_free(image,(signed)nrimages); return(msg); } } /* fill in the FILEINFO structs */ for (t=(MDC_MAX_DIMS - 1); t > 3; t--) if (fi->dim[t] > 1) break; fi->dim[0] = t; fi->pixdim[0] = t; fi->pixdim[1] = fi->image[0].pixel_xsize; fi->pixdim[2] = fi->image[0].pixel_ysize; fi->pixdim[3] = fi->image[0].slice_width; id = &fi->image[0]; if (MDC_TRUE_GAP == MDC_YES) id->slice_spacing += id->slice_width; /* fill in DYNAMIC_DATA structs */ if (fi->acquisition_type == MDC_ACQUISITION_TOMO || fi->acquisition_type == MDC_ACQUISITION_DYNAMIC) { if (dicom->frameduration > 0.) { if ((fi->dynnr > 0) && (fi->dyndata != NULL)) { /* preserve but do set frame_duration */ for (i=0; i < fi->dynnr; i++) { dd = &fi->dyndata[i]; if (fi->planar == MDC_YES) { /* planar: sum of all images + delays */ dd->time_frame_duration *= dd->nr_of_slices; dd->time_frame_duration += dd->delay_slices * (dd->nr_of_slices-1); }else{ dd->time_frame_start = dicom->framestart; dd->time_frame_duration = dicom->frameduration; } } }else{ if (!MdcGetStructDD(fi,1)) { dicom_free(image,(signed)nrimages); return("DICM Couldn't malloc DYNAMIC_DATA structs"); } fi->dyndata[0].nr_of_slices = fi->number; fi->dyndata[0].time_frame_start = dicom->framestart; fi->dyndata[0].time_frame_duration = dicom->frameduration; } } } /* fill in GATED_DATA structs */ if (fi->gatednr > 0 && fi->gdata != NULL) { gd = &fi->gdata[0]; gd->nr_projections = dicom->nrframes; gd->extent_rotation = dicom->scan_arc; gd->image_duration = dicom->frametime; gd->time_per_proj = dicom->frameduration; gd->study_duration = dicom->nrframes * dicom->frameduration; gd->cycles_acquired = dicom->intervals_acquired; gd->cycles_observed = dicom->intervals_acquired + dicom->intervals_rejected; gd->window_low = dicom->window_low; gd->window_high= dicom->window_high; } /* put images and info in IMG_DATA structs */ msg = MdcDicomHandleImages(fi,dicom,image,nrimages); if (msg != NULL) { dicom_free(image,(signed)nrimages); return(msg); } dicom_free(image,(signed)nrimages); MdcCloseFile(fi->ifp); return(NULL); } Uint32 MdcDicomMakeUID(FILEINFO *fi, Int8 uid, char str[]) { Int16 year, month, day; Int16 hour, minute, second; Uint32 utc, len, study_uid, series_uid, instance_uid; year = fi->study_date_year; month = fi->study_date_month; day = fi->study_date_day; hour = fi->study_time_hour; minute= fi->study_time_minute; second= fi->study_time_second; if (mdc_psec != NULL) { utc = (Uint32)*mdc_psec; }else{ utc = 777UL; } /* study_uid = hash(patient_name + study_date + study_time) */ sprintf(str,"%s%s%hd%02hd%02hd%02hd%02hd%02hd" ,fi->patient_name,fi->patient_id ,year,month,day,hour,minute,second); study_uid = MdcHashSDBM((unsigned char *)str); if (study_uid == 182208422) { /* Unknown000000000 case */ sprintf(str,"%u",utc); study_uid = MdcHashSDBM((unsigned char *)str); } /* series_uid = hash(input filename)*/ if (mdc_prev_nr_series == -MDC_TYPE_UID_SERIES) { mdc_prev_nr_series = fi->nr_series; series_uid = MdcHashSDBM((unsigned char *)fi->ifname); mdc_prev_series_uid = series_uid; } /* new series_uid for each input file */ if ((fi->nr_series != mdc_prev_nr_series) || (fi->nr_series <= 0)) { mdc_prev_nr_series = fi->nr_series; series_uid = MdcHashSDBM((unsigned char*)fi->ifname); mdc_prev_series_uid = series_uid; }else{ series_uid = mdc_prev_series_uid; } /* new instance_uid for each output file */ instance_uid = MdcHashSDBM((unsigned char *)fi->ofname); switch (uid) { case MDC_TYPE_UID_CREATOR: sprintf(str,"%s",MDC_STR_UID_CREATOR); break; case MDC_TYPE_UID_SOP_INSTANCE: case MDC_TYPE_UID_MEDIA_INSTANCE: sprintf(str,"%s.%u.%u.%u.%u" ,MDC_STR_UID_CREATOR,utc ,study_uid,series_uid,instance_uid); break; case MDC_TYPE_UID_FRAME: case MDC_TYPE_UID_STUDY: sprintf(str,"%s.%u.%u" ,MDC_STR_UID_CREATOR,utc ,study_uid); break; case MDC_TYPE_UID_SERIES: sprintf(str,"%s.%u.%u.%u" ,MDC_STR_UID_CREATOR,utc ,study_uid,series_uid); break; default: sprintf(str,"%s.%u.%u" ,MDC_STR_UID_CREATOR,utc ,study_uid); } len = (Uint32)strlen(str); if (len > MDC_UID_MAXSTR) { MdcPrntWarn("DICM Inappropriate UID length"); } return(len); } void MdcDicomWriteInfoSeq(FILE *fp, Uint16 group, Uint16 element) { mdc_dicom_write_element(fp,group,element,UNDEFINED_LENGTH,NULL); } void MdcDicomWriteItem(FILE *fp) { mdc_dicom_write_element(fp,0xfffe,0xe000,UNDEFINED_LENGTH,NULL); } void MdcDicomWriteItemDelItem(FILE *fp) { mdc_dicom_write_element(fp,0xfffe,0xe00d,0,NULL); } void MdcDicomWriteInfoSeqDelItem(FILE *fp) { mdc_dicom_write_element(fp,0xfffe,0xe0dd,0,NULL); } char *MdcDicomWriteMetaHeader(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { Uint32 REWRF, BEGIN, END, len; Int32 i32; FILE *ofp = fi->ofp; /* write the empty preamable */ memset(mdcbufr,0,128); fwrite(mdcbufr,1,128,ofp); /* write the signature */ strcpy(mdcbufr,"DICM"); fwrite(mdcbufr,1,4,ofp); /* group 0x0002 */ REWRF = ftell(ofp); i32=0; mdc_dicom_write_element(ofp,0x0002,0x0000,4,(Uint8 *)&i32); BEGIN = ftell(ofp); mdcbufr[0]=0x00; mdcbufr[1]=0x01; mdc_dicom_write_element(ofp,0x0002,0x0001,2,(Uint8 *)mdcbufr); switch (dicom->modality) { case M_PT: strcpy(mdcbufr,"1.2.840.10008.5.1.4.1.1.128"); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0002,0x0002,len,(Uint8 *)mdcbufr); break; default : /* default to NM modality */ strcpy(mdcbufr,"1.2.840.10008.5.1.4.1.1.20"); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0002,0x0002,len,(Uint8 *)mdcbufr); } /* strcpy(mdcbufr,"1.2.840.10008.Media.Storage.SOP.Instance"); */ len = MdcDicomMakeUID(fi,MDC_TYPE_UID_MEDIA_INSTANCE,mdcbufr); mdc_dicom_write_element(ofp,0x0002,0x0003,len,(Uint8 *)mdcbufr); /* transfer syntax */ if (MDC_DICOM_WRITE_IMPLICIT == MDC_YES) { strcpy(mdcbufr,"1.2.840.10008.1.2"); /* implicit VR little */ }else{ if (MDC_FILE_ENDIAN == MDC_LITTLE_ENDIAN) { strcpy(mdcbufr,"1.2.840.10008.1.2.1"); /* explicit VR little */ }else{ strcpy(mdcbufr,"1.2.840.10008.1.2.2"); /* explicit VR big */ } } len = strlen(mdcbufr); mdc_dicom_write_element(ofp,0x0002,0x0010,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,"0.0.0.0"); len = strlen(mdcbufr); mdc_dicom_write_element(ofp,0x0002,0x0012,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,"NOTSPECIFIED"); len = strlen(mdcbufr); mdc_dicom_write_element(ofp,0x0002,0x0013,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,"NOTSPECIFIED"); len = strlen(mdcbufr); mdc_dicom_write_element(ofp,0x0002,0x0016,len,(Uint8 *)mdcbufr); END = ftell(ofp); /* rewrite group length */ fseek(ofp,(signed)REWRF,SEEK_SET); i32 = END - BEGIN; mdc_dicom_write_element(ofp,0x0002,0x0000,4,(Uint8 *)&i32); fseek(ofp,0,SEEK_END); if (ferror(ofp)) return("DICM Failure to write MetaHeader"); return(NULL); } /* char *MdcWritePatientModule(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { return(NULL); } char *MdcWriteGeneralStudyModule(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { return(NULL); } char *MdcWriteGeneralSeriesModule(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { return(NULL); } char *MdcWriteNMSeriesModule(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { return(NULL); } char *MdcWriteGeneralEquipmentModule(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { return(NULL); } char *MdcWriteSOPCommonModule(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { return(NULL); } char *MdcWriteGeneralImageModule(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { return(NULL); } char *MdcWriteImagePixelModule(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { return(NULL); } char *MdcWriteMultiFrameModule(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { return(NULL); } char *MdcWriteNMImageModule(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { return(NULL); } char *MdcWriteNMImagePixelModule(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { return(NULL); } char *MdcWriteNMMultiFrameImageModule(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { return(NULL); } char *MdcWriteNMIsotopeImageModule(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { return(NULL); } char *MdcWriteNMDetectorImageModule(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { return(NULL); } */ char *MdcDicomWriteSetModality(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { /* currently only NM writing supported */ switch (fi->modality) { case M_PT: default : dicom->modality = M_NM; } return(NULL); } char *MdcDicomWriteG0008(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { Uint32 bytes, len; char *pdata; /* group 0x0008 */ strcpy(mdcbufr,"DERIVED\\PRIMARY"); switch (dicom->modality) { case M_PT: break; default : /* default to NM modality */ switch (fi->acquisition_type) { case MDC_ACQUISITION_TOMO: if (fi->reconstructed == MDC_YES) strcat(mdcbufr,"\\RECON TOMO"); else strcat(mdcbufr,"\\TOMO"); break; case MDC_ACQUISITION_DYNAMIC: strcat(mdcbufr,"\\DYNAMIC"); break; case MDC_ACQUISITION_GATED: strcat(mdcbufr,"\\GATED"); break; case MDC_ACQUISITION_GSPECT: if (fi->reconstructed == MDC_YES) strcat(mdcbufr,"\\RECON GATED TOMO"); else strcat(mdcbufr,"\\GATED TOMO"); break; case MDC_ACQUISITION_UNKNOWN: /* fake as static */ case MDC_ACQUISITION_STATIC: strcat(mdcbufr,"\\STATIC"); break; default: strcat(mdcbufr,"\\UNSPECIFIED"); } strcat(mdcbufr,"\\EMISSION"); /* MARK: no flag for transmission yet */ } len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0008,len,(Uint8 *)mdcbufr); strftime(mdcbufr,35,"%Y%m%d",localtime(mdc_psec)); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0012,len,(Uint8 *)mdcbufr); strftime(mdcbufr,35,"%H%M%S",localtime(mdc_psec)); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0013,len,(Uint8 *)mdcbufr); len = MdcDicomMakeUID(fi,MDC_TYPE_UID_CREATOR,mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0014,len,(Uint8 *)mdcbufr); switch (dicom->modality) { case M_PT: strcpy(mdcbufr,"1.2.840.10008.5.1.4.1.1.128"); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0016,len,(Uint8 *)mdcbufr); break; default : /* default to NM modality */ strcpy(mdcbufr,"1.2.840.10008.5.1.4.1.1.20"); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0016,len,(Uint8 *)mdcbufr); } len = MdcDicomMakeUID(fi,MDC_TYPE_UID_SOP_INSTANCE,mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0018,len,(Uint8 *)mdcbufr); /* date settings, make sure it is conform */ if (fi->mod != NULL) { pdata = fi->mod->gn_info.study_date; len = strlen(pdata); mdc_dicom_write_element(fi->ofp,0x0008,0x0020,len,(Uint8 *)pdata); pdata = fi->mod->gn_info.series_date; len = strlen(pdata); mdc_dicom_write_element(fi->ofp,0x0008,0x0021,len,(Uint8 *)pdata); pdata = fi->mod->gn_info.acquisition_date; len = strlen(pdata); mdc_dicom_write_element(fi->ofp,0x0008,0x0022,len,(Uint8 *)pdata); pdata = fi->mod->gn_info.image_date; len = strlen(pdata); mdc_dicom_write_element(fi->ofp,0x0008,0x0023,len,(Uint8 *)pdata); }else{ if (fi->study_date_year == 0) { pdata = NULL; bytes=0; }else{ sprintf(mdcbufr,"%04d%02d%02d",fi->study_date_year ,fi->study_date_month ,fi->study_date_day); pdata = mdcbufr; bytes = strlen(mdcbufr); } mdc_dicom_write_element(fi->ofp,0x0008,0x0020,bytes,(Uint8 *)pdata); mdc_dicom_write_element(fi->ofp,0x0008,0x0021,bytes,(Uint8 *)pdata); mdc_dicom_write_element(fi->ofp,0x0008,0x0022,bytes,(Uint8 *)pdata); mdc_dicom_write_element(fi->ofp,0x0008,0x0023,bytes,(Uint8 *)pdata); } /* time settings, can be full of zero's ... */ if (fi->mod != NULL) { pdata = fi->mod->gn_info.study_time; len = strlen(pdata); mdc_dicom_write_element(fi->ofp,0x0008,0x0030,len,(Uint8 *)pdata); pdata = fi->mod->gn_info.series_time; len = strlen(pdata); mdc_dicom_write_element(fi->ofp,0x0008,0x0031,len,(Uint8 *)pdata); pdata = fi->mod->gn_info.acquisition_time; len = strlen(pdata); mdc_dicom_write_element(fi->ofp,0x0008,0x0032,len,(Uint8 *)pdata); pdata = fi->mod->gn_info.image_time; len = strlen(pdata); mdc_dicom_write_element(fi->ofp,0x0008,0x0033,len,(Uint8 *)pdata); }else{ sprintf(mdcbufr,"%02d%02d%02d",fi->study_time_hour ,fi->study_time_minute ,fi->study_time_second); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0030,len,(Uint8 *)mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0031,len,(Uint8 *)mdcbufr); if (fi->image[0].sdata != NULL) { sprintf(mdcbufr,"%02d%02d%02d",fi->image[0].sdata->start_time_hour ,fi->image[0].sdata->start_time_minute ,fi->image[0].sdata->start_time_second); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0032,len,(Uint8 *)mdcbufr); }else{ mdc_dicom_write_element(fi->ofp,0x0008,0x0032,len,(Uint8 *)mdcbufr); } sprintf(mdcbufr,"%02d%02d%02d",fi->study_time_hour ,fi->study_time_minute ,fi->study_time_second); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0033,len,(Uint8 *)mdcbufr); } len = strlen(mdc_dummy1); mdc_dicom_write_element(fi->ofp,0x0008,0x0050,len,(Uint8 *)mdc_dummy1); pdata = MdcGetStrModality((signed)dicom->modality); /* already in mdcbufr */ len = strlen(pdata); mdc_dicom_write_element(fi->ofp,0x0008,0x0060,len,(Uint8 *)pdata); strcpy(mdcbufr,fi->manufacturer); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0070,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,fi->institution); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0080,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,"Unknown^^^^"); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0090,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,fi->study_descr); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x1030,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,fi->series_descr); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x103E,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,fi->operator_name); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x1070,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,MDC_LIBVERS); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x2111,len,(Uint8 *)mdcbufr); return(NULL); } char *MdcDicomWriteG0010(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { Uint32 len; char *pdata; /* group 0x0010 */ sprintf(mdcbufr,"%.64s^^^^",fi->patient_name); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0010,0x0010,len,(Uint8 *)mdcbufr); pdata = fi->patient_id; len = strlen(pdata); mdc_dicom_write_element(fi->ofp,0x0010,0x0020,len,(Uint8 *)pdata); pdata = fi->patient_dob; len = strlen(pdata); if (len > 0 && pdata[0] != '0' ) { mdc_dicom_write_element(fi->ofp,0x0010,0x0030,len,(Uint8 *)pdata); }else{ mdc_dicom_write_element(fi->ofp,0x0010,0x0030,0,NULL); } mdc_dicom_write_element(fi->ofp,0x0010,0x0032,0,NULL); /* Pat Birth Time */ strcpy(mdcbufr,fi->patient_sex); MdcLowStr(mdcbufr); if (strchr(mdcbufr,'f') != NULL) { /* first check for fe-male */ strcpy(mdcbufr,"F"); }else if (strchr(mdcbufr,'m') != NULL) { /* now check for male */ strcpy(mdcbufr,"M"); }else { /* guess what? */ strcpy(mdcbufr,"O"); } len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0010,0x0040,len,(Uint8 *)mdcbufr); sprintf(mdcbufr,"%.2f",fi->patient_height); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0010,0x1020,len,(Uint8 *)mdcbufr); sprintf(mdcbufr,"%.2f",fi->patient_weight); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0010,0x1030,len,(Uint8 *)mdcbufr); return(NULL); } char *MdcDicomWriteG0018(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { Uint32 len; Uint16 ui16; char *pdata; /* 0x0018 */ strcpy(mdcbufr,fi->organ_code); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x0015,len,(Uint8 *)mdcbufr); sprintf(mdcbufr,"%+e",fi->image[0].slice_width); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x0050,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,"0"); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x0070,len,(Uint8 *)mdcbufr); sprintf(mdcbufr,"%+e",fi->image[0].slice_spacing); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x0088,len,(Uint8 *)mdcbufr); if (fi->gatednr > 0 && fi->gdata != NULL) { /* heart beat */ ui16 = (Uint16)MdcGetHeartRate(gd,MDC_HEART_RATE_OBSERVED); sprintf(mdcbufr,"%u",ui16); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1088,len,(Uint8 *)mdcbufr); } switch (dicom->modality) { case M_PT: break; default : /* default to NM modality */ if ((fi->acquisition_type == MDC_ACQUISITION_UNKNOWN) || (fi->acquisition_type == MDC_ACQUISITION_STATIC)) { /* normally whole body too ...*/ if (fi->image[0].sdata != NULL) { sprintf(mdcbufr,"%-12.0f",fi->image[0].sdata->image_duration); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1242,len,(Uint8 *)mdcbufr); } } } if (strcmp(fi->pat_pos,"Unknown") == 0) { pdata = NULL; len = 0; }else{ pdata = fi->pat_pos; len = strlen(pdata); } mdc_dicom_write_element(fi->ofp,0x0018,0x5100,len,(Uint8 *)pdata); return(NULL); } char *MdcDicomWriteG0020(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { Uint32 len; char *pdata; /* group 0x0020 */ len = MdcDicomMakeUID(fi,MDC_TYPE_UID_STUDY,mdcbufr); mdc_dicom_write_element(fi->ofp,0x0020,0x000D,len,(Uint8 *)mdcbufr); len = MdcDicomMakeUID(fi,MDC_TYPE_UID_SERIES,mdcbufr); mdc_dicom_write_element(fi->ofp,0x0020,0x000E,len,(Uint8 *)mdcbufr); pdata = fi->study_id; len = strlen(pdata); mdc_dicom_write_element(fi->ofp,0x0020,0x0010,len,(Uint8 *)pdata); if (fi->nr_series >= 0) sprintf(mdcbufr,"%d",fi->nr_series); else strcpy(mdcbufr,"0"); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0020,0x0011,len,(Uint8 *)mdcbufr); if (fi->nr_acquisition >= 0) sprintf(mdcbufr,"%d",fi->nr_acquisition); else strcpy(mdcbufr,"0"); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0020,0x0012,len,(Uint8 *)mdcbufr); if (fi->nr_instance >= 0) sprintf(mdcbufr,"%d",fi->nr_instance); else strcpy(mdcbufr,"0"); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0020,0x0013,len,(Uint8 *)mdcbufr); len = MdcDicomMakeUID(fi,MDC_TYPE_UID_STUDY,mdcbufr); mdc_dicom_write_element(fi->ofp,0x0020,0x0052,len,(Uint8 *)mdcbufr); sprintf(mdcbufr,"%u",fi->number); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0020,0x1002,len,(Uint8 *)mdcbufr); mdc_dicom_write_element(fi->ofp,0x0020,0x1040,0,NULL); strcpy(mdcbufr,"*** NOT APPROVED ***"); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0020,0x4000,len,(Uint8 *)mdcbufr); return(NULL); } char *MdcDicomWriteG0028(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { Uint32 len, bytes; Uint16 ui16, *pui16, bits_allocated, bits_stored; float intercept=0., slope=1.; Int16 type = dicom->type; /* group 0x0028 */ ui16 = 1; len = sizeof(ui16); mdc_dicom_write_element(fi->ofp,0x0028,0x0002,len,(Uint8 *)&ui16); strcpy(mdcbufr,"MONOCHROME2"); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0028,0x0004,len,(Uint8 *)mdcbufr); sprintf(mdcbufr,"%u",fi->number); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0028,0x0008,len,(Uint8 *)mdcbufr); bytes = 0; pui16 = NULL; switch (dicom->modality) { case M_PT: switch (fi->acquisition_type) { case MDC_ACQUISITION_DYNAMIC: bytes = 4 * sizeof(Uint16); pui16 = (Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc (PT/DYNAMIC) FrameIncrPointer"); pui16[0]=0x0054; pui16[1]=0x0080; /* slices */ pui16[2]=0x0054; pui16[3]=0x0100; /* frames */ dicom->VectDO[MDC_VECT_SLICE] = MDC_YES; dicom->VectDO[MDC_VECT_TIMESLICE] = MDC_YES; break; case MDC_ACQUISITION_TOMO: case MDC_ACQUISITION_STATIC: case MDC_ACQUISITION_UNKNOWN: default: bytes = 2 * sizeof(Uint16); pui16 = (Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc (PT/STATIC) FrameIncrPointer"); pui16[0]=0x0054; pui16[1]=0x0080; /* slices */ dicom->VectDO[MDC_VECT_SLICE] = MDC_YES; } mdc_dicom_write_element(fi->ofp,0x0028,0x0009,bytes,(Uint8 *)pui16); MdcFree(pui16); break; default : /* default to NM modality */ switch (fi->acquisition_type) { case MDC_ACQUISITION_TOMO: bytes = 2 * sizeof(Uint16); pui16 = (Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc (NM/TOMO) FrameIncrPointer"); pui16[0]=0x0054; pui16[1]=0x0080; /* slices */ dicom->VectDO[MDC_VECT_SLICE] = MDC_YES; break; case MDC_ACQUISITION_DYNAMIC: bytes = 8 * sizeof(Uint16); pui16 = (Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc (NM/DYNAMIC) FrameIncrPointer"); pui16[0]=0x0054; pui16[1]=0x0010; /* energy windows */ pui16[2]=0x0054; pui16[3]=0x0020; /* detectors */ pui16[4]=0x0054; pui16[5]=0x0030; /* phases */ pui16[6]=0x0054; pui16[7]=0x0100; /* time slices */ dicom->VectDO[MDC_VECT_ENERGYWINDOW] = MDC_YES; dicom->VectDO[MDC_VECT_DETECTOR] = MDC_YES; dicom->VectDO[MDC_VECT_PHASE] = MDC_YES; dicom->VectDO[MDC_VECT_TIMESLICE] = MDC_YES; break; case MDC_ACQUISITION_GATED: bytes = 8 * sizeof(Uint16); pui16 = (Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc (NM/GATED) FrameIncrPointer"); pui16[0]=0x0054; pui16[1]=0x0010; /* energy windows */ pui16[2]=0x0054; pui16[3]=0x0020; /* detectors */ pui16[4]=0x0054; pui16[5]=0x0060; /* RR-intervals */ pui16[6]=0x0054; pui16[7]=0x0070; /* time slots */ dicom->VectDO[MDC_VECT_ENERGYWINDOW] = MDC_YES; dicom->VectDO[MDC_VECT_DETECTOR] = MDC_YES; dicom->VectDO[MDC_VECT_RRINTERVAL] = MDC_YES; dicom->VectDO[MDC_VECT_TIMESLOT] = MDC_YES; break; case MDC_ACQUISITION_GSPECT: if (fi->reconstructed == MDC_YES) { bytes = 6 * sizeof(Uint16); pui16 = (Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc (NM/RECON GATED) FrameIncrPointer"); pui16[0]=0x0054; pui16[1]=0x0060; /* RR-intervals */ pui16[2]=0x0054; pui16[3]=0x0070; /* time slots */ pui16[4]=0x0054; pui16[5]=0x0080; /* slices */ dicom->VectDO[MDC_VECT_RRINTERVAL] = MDC_YES; dicom->VectDO[MDC_VECT_TIMESLOT] = MDC_YES; dicom->VectDO[MDC_VECT_SLICE] = MDC_YES; }else{ bytes = 12 * sizeof(Uint16); pui16 = (Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc (NM/GATED TOMO) FrameIncrPointer"); pui16[0]=0x0054; pui16[1]=0x0010; /* energy windows */ pui16[2]=0x0054; pui16[3]=0x0020; /* detectors */ pui16[4]=0x0054; pui16[5]=0x0050; /* rotations = 1 */ pui16[6]=0x0054; pui16[7]=0x0060; /* RR-intervals */ pui16[8]=0x0054; pui16[9]=0x0070; /* time slot */ pui16[10]=0x0054;pui16[11]=0x0090;/* angular views */ dicom->VectDO[MDC_VECT_ENERGYWINDOW] = MDC_YES; dicom->VectDO[MDC_VECT_DETECTOR] = MDC_YES; dicom->VectDO[MDC_VECT_ROTATION] = MDC_YES; dicom->VectDO[MDC_VECT_RRINTERVAL] = MDC_YES; dicom->VectDO[MDC_VECT_TIMESLOT] = MDC_YES; dicom->VectDO[MDC_VECT_ANGULARVIEW] = MDC_YES; } break; case MDC_ACQUISITION_UNKNOWN: /* fake as static */ case MDC_ACQUISITION_STATIC: bytes = 4 * sizeof(Uint16); pui16 = (Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc (NM/STATIC) FrameIncrPointer"); pui16[0]=0x0054; pui16[1]=0x0010; /* energy windows */ pui16[2]=0x0054; pui16[3]=0x0020; /* detectors */ dicom->VectDO[MDC_VECT_ENERGYWINDOW] = MDC_YES; dicom->VectDO[MDC_VECT_DETECTOR] = MDC_YES; break; } mdc_dicom_write_element(fi->ofp,0x0028,0x0009,bytes,(Uint8 *)pui16); MdcFree(pui16); } ui16 = (Uint16) fi->mheight; len = sizeof(ui16); mdc_dicom_write_element(fi->ofp,0x0028,0x0010,len,(Uint8 *)&ui16); ui16 = (Uint16) fi->mwidth; len = sizeof(ui16); mdc_dicom_write_element(fi->ofp,0x0028,0x0011,len,(Uint8 *)&ui16); sprintf(mdcbufr,"%+e\\%+e",fi->pixdim[IROW],fi->pixdim[ICOL]); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0028,0x0030,len,(Uint8 *)mdcbufr); mdcbufr[0]='\0'; if (fi->decay_corrected) strcat(mdcbufr,"DECY\\"); if (fi->flood_corrected) strcat(mdcbufr,"UNIF\\"); len = strlen(mdcbufr); /* if present, remove last redundant backslash */ if (len > 0) { len -= 1; mdcbufr[len] = '\0'; } mdc_dicom_write_element(fi->ofp,0x0028,0x0051,len,(Uint8 *)mdcbufr); bits_allocated = (Uint16)MdcType2Bits(type); if (MDC_FORCE_INT == BIT16_S) { bits_stored = MDC_INT16_BITS_USED; }else{ bits_stored = MdcType2Bits(type); } ui16 = bits_allocated; /* bits allocated */ len = sizeof(ui16); mdc_dicom_write_element(fi->ofp,0x0028,0x0100,len,(Uint8 *)&ui16); ui16 = bits_stored; /* bits stored */ len = sizeof(ui16); mdc_dicom_write_element(fi->ofp,0x0028,0x0101,len,(Uint8 *)&ui16); ui16 = bits_stored - 1; /* high bit */ len = sizeof(ui16); mdc_dicom_write_element(fi->ofp,0x0028,0x0102,len,(Uint8 *)&ui16); switch (type) { case BIT8_U: case BIT16_U: case BIT32_U: case BIT64_U: ui16 = 0; break; case BIT8_S: case BIT16_S: case BIT32_S: case BIT64_S: ui16 = 1; break; default: ui16 = 0; } if (type == BIT16_S && MDC_INT16_BITS_USED < 16) ui16 = 0; /* unsigned */ len = sizeof(ui16); mdc_dicom_write_element(fi->ofp,0x0028,0x0103,len,(Uint8 *)&ui16); /* need to rewrite the following tag after rescaling images */ MDC_REWRF_INTERCEPT = ftell(fi->ofp); sprintf(mdcbufr,"%+e",intercept); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0028,0x1052,len,(Uint8 *)mdcbufr); /* need to rewrite the following tag after rescaling images */ MDC_REWRF_SLOPE = ftell(fi->ofp); sprintf(mdcbufr,"%+e",slope); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0028,0x1053,len,(Uint8 *)mdcbufr); return(NULL); } /* write NM Image Information */ char *MdcDicomWriteG0054(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { ACQ_DATA tmp_acqdata, *acqdata=NULL; DYNAMIC_DATA *dd=NULL; Uint32 i, t, bytes, dim, vect, len, acqnr; Uint32 ph, ts, inr; Uint16 ui16, *pui16; float v; if (fi->acqnr > 0 && fi->acqdata != NULL) { acqnr = fi->acqnr; acqdata = (ACQ_DATA *)fi->acqdata; }else{ acqnr = 1; acqdata = (ACQ_DATA *)&tmp_acqdata; MdcInitAD(acqdata); if (gd->nr_projections > 0.) { acqdata->angle_step = gd->extent_rotation / gd->nr_projections; }else{ acqdata->angle_step = acqdata->scan_arc / (float)fi->dim[3]; } } /* group 0x0054 */ if (dicom->VectDO[MDC_VECT_ENERGYWINDOW] == MDC_YES) { /* MARK: window vectors */ if (fi->dim[7] == 0) return("DICM Bad zero value for fi->dim[7]"); if (fi->number % fi->dim[7]) return("DICM Garbled value for fi->dim[7]"); vect = fi->number / fi->dim[7]; bytes = fi->number * sizeof(Uint16); pui16 = (Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc EnergyWindowVector"); for (i=0; inumber; i++) pui16[i] = (Uint16)((i/vect)+1); mdc_dicom_write_element(fi->ofp,0x0054,0x0010,bytes,(Uint8 *)pui16); MdcFree(pui16); } /* number of energy windows */ ui16 = fi->dim[7]; len = sizeof(ui16); mdc_dicom_write_element(fi->ofp,0x0054,0x0011,len,(Uint8 *)&ui16); /* window information sequence */ MdcDicomWriteInfoSeq(fi->ofp,0x0054,0x0012); /* item */ MdcDicomWriteItem(fi->ofp); /* window range sequence */ MdcDicomWriteInfoSeq(fi->ofp,0x0054,0x0013); /* item */ MdcDicomWriteItem(fi->ofp); /* item delimitation item */ MdcDicomWriteItemDelItem(fi->ofp); /* sequence delimitation item*/ MdcDicomWriteInfoSeqDelItem(fi->ofp); /* item delimitation item */ MdcDicomWriteItemDelItem(fi->ofp); /* sequence delimitation item */ MdcDicomWriteInfoSeqDelItem(fi->ofp); /* radiopharmaceutical info sequence */ MdcDicomWriteInfoSeq(fi->ofp,0x0054,0x0016); /* item */ MdcDicomWriteItem(fi->ofp); strcpy(mdcbufr,fi->radiopharma); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x0031,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,"0.0"); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1071,len,(Uint8 *)mdcbufr); sprintf(mdcbufr,"%02d%02d%02d",fi->dose_time_hour ,fi->dose_time_minute ,fi->dose_time_second); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1072,len,(Uint8 *)mdcbufr); sprintf(mdcbufr,"%g",fi->injected_dose); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1074,len,(Uint8 *)mdcbufr); sprintf(mdcbufr,"%g",fi->isotope_halflife); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1075,len,(Uint8 *)mdcbufr); /* radionuclidecode info sequence */ MdcDicomWriteInfoSeq(fi->ofp,0x0054,0x0300); /* item */ MdcDicomWriteItem(fi->ofp); strcpy(mdcbufr,fi->isotope_code); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0100,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,"99SDM"); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0102,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,fi->isotope_code); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0104,len,(Uint8 *)mdcbufr); /* item delimitation item */ MdcDicomWriteItemDelItem(fi->ofp); /* sequence delimiter */ MdcDicomWriteInfoSeqDelItem(fi->ofp); MdcDicomWriteInfoSeq(fi->ofp,0x0054,0x0304); /* item */ MdcDicomWriteItem(fi->ofp); strcpy(mdcbufr,fi->radiopharma); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0100,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,"99SDM"); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0102,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,fi->radiopharma); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0104,len,(Uint8 *)mdcbufr); /* item delimitation item */ MdcDicomWriteItemDelItem(fi->ofp); /* sequence delimiter */ MdcDicomWriteInfoSeqDelItem(fi->ofp); /* item delimitation item */ MdcDicomWriteItemDelItem(fi->ofp); /* sequence delimiter */ MdcDicomWriteInfoSeqDelItem(fi->ofp); if (dicom->VectDO[MDC_VECT_DETECTOR] == MDC_YES) { /* MARK: detector vectors */ if (fi->dim[6] == 0) return("DICM Bad zero value for fi->dim[6]"); if (fi->number % fi->dim[6]) return("DICM Garbled value for fi->dim[6]"); vect = fi->number / fi->dim[6]; bytes = fi->number * sizeof(Uint16); pui16 = (Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc DetectorVector"); for (i=0; inumber; i++) pui16[i] = (Uint16)((i/vect)+1); mdc_dicom_write_element(fi->ofp,0x0054,0x0020,bytes,(Uint8 *)pui16); MdcFree(pui16); } /* number of detector heads */ ui16 = fi->dim[6]; len = sizeof(ui16); mdc_dicom_write_element(fi->ofp,0x0054,0x0021,len,(Uint8 *)&ui16); /* detector info sequence */ MdcDicomWriteInfoSeq(fi->ofp,0x0054,0x0022); /* item */ MdcDicomWriteItem(fi->ofp); /* colimator type */ mdc_dicom_write_element(fi->ofp,0x0018,0x1181,0,NULL); /* focal distance */ mdc_dicom_write_element(fi->ofp,0x0018,0x1182,0,NULL); /* image pos patient */ sprintf(mdcbufr,"%+e\\%+e\\%+e",fi->image[0].image_pos_pat[0] ,fi->image[0].image_pos_pat[1] ,fi->image[0].image_pos_pat[2]); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0020,0x0032,len,(Uint8 *)mdcbufr); /* image orient patient */ sprintf(mdcbufr,"%+e\\%+e\\%+e\\%+e\\%+e\\%+e" ,fi->image[0].image_orient_pat[0] ,fi->image[0].image_orient_pat[1] ,fi->image[0].image_orient_pat[2] ,fi->image[0].image_orient_pat[3] ,fi->image[0].image_orient_pat[4] ,fi->image[0].image_orient_pat[5]); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0020,0x0037,len,(Uint8 *)mdcbufr); /* static image label */ if (fi->image[0].sdata != NULL) { STATIC_DATA *sd = fi->image[0].sdata; if (fi->number > 1) { MdcPrntWarn("DICM static info lost; to prevent choose to split slices"); } /* view code sequence */ MdcDicomWriteInfoSeq(fi->ofp,0x0054,0x0220); /* item */ MdcDicomWriteItem(fi->ofp); strcpy(mdcbufr,sd->label); len = strlen(sd->label); mdc_dicom_write_element(fi->ofp,0x0008,0x0100,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,"99SDM"); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0008,0x0102,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,sd->label); len = strlen(sd->label); mdc_dicom_write_element(fi->ofp,0x0008,0x0104,len,(Uint8 *)mdcbufr); /* item delimitation item */ MdcDicomWriteItemDelItem(fi->ofp); /* sequence delimitation item */ MdcDicomWriteInfoSeqDelItem(fi->ofp); }else{ /* start angle */ v = acqdata[0].angle_start; v = MdcRotateAngle(v,180.); sprintf(mdcbufr,"%g",v); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0054,0x0200,len,(Uint8 *)mdcbufr); } /* item delimitation item */ MdcDicomWriteItemDelItem(fi->ofp); /* sequence delimitation item */ MdcDicomWriteInfoSeqDelItem(fi->ofp); if (dicom->modality == M_PT) { switch (fi->acquisition_type) { /* PET MODALITY */ case MDC_ACQUISITION_DYNAMIC: /* MARK: slice vector */ if (dicom->VectDO[MDC_VECT_SLICE] == MDC_YES) { if (fi->dim[3] == 0) return("DICM Bad zero value for fi->dim[3] (PT)"); vect = fi->dim[3]; bytes = fi->number*sizeof(Uint16); pui16=(Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc SliceVector (PT)"); for (i=0; inumber; i++) pui16[i]=(Uint16)((i%vect)+1); mdc_dicom_write_element(fi->ofp,0x0054,0x0080,bytes,(Uint8 *)pui16); MdcFree(pui16); } ui16 = (Uint16) fi->dim[3]; len = sizeof(ui16); mdc_dicom_write_element(fi->ofp,0x0054,0x0081,len,(Uint8 *)&ui16); /* MARK: time slice vector */ if (dicom->VectDO[MDC_VECT_TIMESLICE] == MDC_YES) { if (fi->dim[4] == 0) return("DICM Bad zero value for fi->dim[4] (PT)"); if (fi->number % fi->dim[4]) return("DICM Garbled value for fi->dim[4] (PT)"); vect = fi->number / fi->dim[4]; bytes = fi->number * sizeof(Uint16); pui16 = (Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc TimeSlotVector (PT)"); for (i=0; inumber; i++) pui16[i] = (Uint16)((i/vect)+1); mdc_dicom_write_element(fi->ofp,0x0054,0x0100,bytes,(Uint8 *)pui16); MdcFree(pui16); } ui16 = (Uint16) fi->dim[4]; mdc_dicom_write_element(fi->ofp,0x0054,0x0101,len,(Uint8 *)&ui16); break; case MDC_ACQUISITION_STATIC : case MDC_ACQUISITION_TOMO : case MDC_ACQUISITION_UNKNOWN: default: if (fi->dim[4] > 1) return("DICM Unsupported dim[]-values (PT)"); /* MARK: slice vector */ if (dicom->VectDO[MDC_VECT_SLICE] == MDC_YES) { bytes = fi->number*sizeof(Uint16); pui16=(Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc slice vector buffer (PT)"); for (i=0; inumber; i++) pui16[i]=(Uint16)i+1; mdc_dicom_write_element(fi->ofp,0x0054,0x0080,bytes,(Uint8 *)pui16); MdcFree(pui16); } ui16 = (Uint16) fi->dim[3]; len = sizeof(ui16); mdc_dicom_write_element(fi->ofp,0x0054,0x0081,len,(Uint8 *)&ui16); } switch (fi->acquisition_type) { case MDC_ACQUISITION_TOMO: strcpy(mdcbufr,"STATIC"); break; case MDC_ACQUISITION_DYNAMIC: strcpy(mdcbufr,"DYNAMIC"); break; case MDC_ACQUISITION_UNKNOWN: /* fake as static */ case MDC_ACQUISITION_STATIC : strcpy(mdcbufr,"STATIC"); break; default: strcpy(mdcbufr,"UNSPECIFIED"); } /* type of detector motion */ /* strcpy(mdcbufr,"UNDEFINED"); */ /* mdc_dicom_write_element(fi->ofp,0x0054,0x0202,strlen(mdcbufr) */ /* ,(Uint8 *)mdcbufr);*/ /* patient orientation code sequence */ MdcDicomWriteInfoSeq(fi->ofp,0x0054,0x0410); /* sequence delimitation item */ MdcDicomWriteInfoSeqDelItem(fi->ofp); /* patient gantry relationship code sequence */ MdcDicomWriteInfoSeq(fi->ofp,0x0054,0x0414); /* sequence delimitation item */ MdcDicomWriteInfoSeqDelItem(fi->ofp); if (fi->reconstructed == MDC_YES) strcat(mdcbufr,"\\IMAGE"); else strcat(mdcbufr,"\\REPROJECTION"); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0054,0x1000,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,"UNKNOWN"); /* units */ len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0054,0x1001,len,(Uint8 *)mdcbufr); strcpy(mdcbufr,"UNKNOWN"); /* counts source */ len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0054,0x1002,len,(Uint8 *)mdcbufr); if (fi->decay_corrected) { strcpy(mdcbufr,"ADMIN"); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0054,0x1102,len,(Uint8 *)mdcbufr); } }else{ /* NM-MODALITY */ /* MARK: phases vector*/ if (dicom->VectDO[MDC_VECT_PHASE] == MDC_YES) { if ((fi->dynnr == 0) || (fi->dyndata == NULL)) return("DICM Required DYNAMIC_DATA values missing"); bytes = fi->number * sizeof(Uint16); pui16 = (Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc PhaseVector (NM)"); for (i=0; inumber; i++) pui16[i] = (Uint16)fi->image[i].frame_number; mdc_dicom_write_element(fi->ofp,0x0054,0x0030,bytes,(Uint8 *)pui16); MdcFree(pui16); /* number of phases */ ui16 = (Uint16)fi->dynnr; len = sizeof(ui16); mdc_dicom_write_element(fi->ofp,0x0054,0x0031,len,(Uint8 *)&ui16); MdcDicomWriteInfoSeq(fi->ofp,0x0054,0x0032); for (i=0; idynnr; i++) { MdcDicomWriteItem(fi->ofp); dd = &fi->dyndata[i]; sprintf(mdcbufr,"%-12.0f",MdcSingleImageDuration(fi,i)); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1242,len,(Uint8 *)mdcbufr); /* number of slices in phase */ ui16 = (Uint16)dd->nr_of_slices; len = sizeof(ui16); mdc_dicom_write_element(fi->ofp,0x0054,0x0033,len,(Uint8 *)&ui16); sprintf(mdcbufr,"%-12.0f",dd->time_frame_delay); len = strlen(mdcbufr); /* phase delay */ mdc_dicom_write_element(fi->ofp,0x0054,0x0036,len,(Uint8 *)mdcbufr); /* pause between frames */ sprintf(mdcbufr,"%-12.0f",dd->delay_slices); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0054,0x0038,len,(Uint8 *)mdcbufr); MdcDicomWriteItemDelItem(fi->ofp); } MdcDicomWriteInfoSeqDelItem(fi->ofp); } /* MARK: Rotation Vector: we always consider it as 1, */ /* we don't know how to map on InterFile tomographic */ if (dicom->VectDO[MDC_VECT_ROTATION] == MDC_YES) { vect = fi->number / 1; bytes = fi->number * sizeof(Uint16); pui16=(Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc RotationVector (NM)"); for (i=0; inumber; i++) pui16[i]=(Uint16)((i/vect)+1); mdc_dicom_write_element(fi->ofp,0x0054,0x0050,bytes,(Uint8 *)pui16); MdcFree(pui16); } /* Rotation sequence must be included for all TOMO types */ if ( fi->acquisition_type == MDC_ACQUISITION_TOMO || fi->acquisition_type == MDC_ACQUISITION_GSPECT ) { /* number of rotations */ ui16 = (Uint16)acqnr; len = sizeof(ui16); mdc_dicom_write_element(fi->ofp,0x0054,0x0051,len,(Uint8 *)&ui16); /* rotation info sequence */ MdcDicomWriteInfoSeq(fi->ofp,0x0054,0x0052); for (i=0; iofp); /* MARK: distance source to detector: only transmission */ /* mdc_dicom_write_element(fi->ofp,0x0018,0x1110,0,NULL); */ switch (acq->rotation_direction) { case MDC_ROTATION_CW: strcpy(mdcbufr,"CW"); break; case MDC_ROTATION_CC: strcpy(mdcbufr,"CC"); break; default : mdcbufr[0] = '\0'; } len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1140,len,(Uint8 *)mdcbufr); sprintf(mdcbufr,"%g",acq->radial_position); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1142,len,(Uint8 *)mdcbufr); sprintf(mdcbufr,"%g",acq->scan_arc); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1143,len,(Uint8 *)mdcbufr); sprintf(mdcbufr,"%g",acq->angle_step); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1144,len,(Uint8 *)mdcbufr); sprintf(mdcbufr,"%g",acq->rotation_offset); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1145,len,(Uint8 *)mdcbufr); if (fi->acquisition_type == MDC_ACQUISITION_GSPECT) { /* gspect: gd->time_per_proj */ v = gd->time_per_proj; }else{ /* tomo : dd->time_frame_duration */ if ((fi->dynnr > 0) && (fi->dyndata != NULL)) { v = fi->dyndata[0].time_frame_duration; }else{ v = 0.; } } sprintf(mdcbufr,"%-12.0f",v); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1242,len,(Uint8 *)mdcbufr); if (gd->nr_projections > 0.) { ui16 = (Uint16)gd->nr_projections; len = sizeof(ui16); }else{ ui16 = (Uint16)fi->dim[3]; len = sizeof(ui16); } mdc_dicom_write_element(fi->ofp,0x0054,0x0053,len,(Uint8 *)&ui16); v = acq->angle_start; v = MdcRotateAngle(v, 180.); sprintf(mdcbufr,"%g",v); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0054,0x0200,len,(Uint8 *)mdcbufr); switch (acq->detector_motion) { case MDC_MOTION_STEP: strcpy(mdcbufr,"STEP AND SHOOT"); break; case MDC_MOTION_CONT: strcpy(mdcbufr,"CONTINUOUS"); break; case MDC_MOTION_DRNG: strcpy(mdcbufr,"ACQ DURING STEP"); break; default : strcpy(mdcbufr,"UNDEFINED"); } len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0054,0x0202,len,(Uint8 *)mdcbufr); MdcDicomWriteItemDelItem(fi->ofp); } /* sequence delimitation item */ MdcDicomWriteInfoSeqDelItem(fi->ofp); } /* MARK: interval vectors */ if (dicom->VectDO[MDC_VECT_RRINTERVAL] == MDC_YES) { if (fi->dim[5] == 0) return("DICM Bad zero value for fi->dim[5] (NM)"); if (fi->number % fi->dim[5]) return("DICM Garbled value for fi->dim[5] (NM)"); vect = fi->number / fi->dim[5]; bytes = fi->number * sizeof(Uint16); pui16=(Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc RRIntervalVector (NM)"); for (i=0; inumber; i++) pui16[i]=(Uint16)((i/vect)+1); mdc_dicom_write_element(fi->ofp,0x0054,0x0060,bytes,(Uint8 *)pui16); MdcFree(pui16); /* number of intervals */ ui16 = (Uint16) fi->dim[5]; mdc_dicom_write_element(fi->ofp,0x0054,0x0061,sizeof(Uint16) ,(Uint8 *)&ui16); MdcDicomWriteInfoSeq(fi->ofp,0x0054,0x0062); for (i=0; idim[5]; i++) { MdcDicomWriteItem(fi->ofp); MdcDicomWriteInfoSeq(fi->ofp,0x0054,0x0063); MdcDicomWriteItem(fi->ofp); /* nominal interval*/ mdc_dicom_write_element(fi->ofp,0x0018,0x1062,0,NULL); /* frame time */ sprintf(mdcbufr,"%+e",gd->image_duration); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1063,len,(Uint8 *)mdcbufr); /* low RR value */ sprintf(mdcbufr,"%u",(Uint16)gd->window_low); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1081,len,(Uint8 *)mdcbufr); /* high RR value */ sprintf(mdcbufr,"%u",(Uint16)gd->window_high); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1082,len,(Uint8 *)mdcbufr); /* intervals acquired */ ui16 = (Uint16) gd->cycles_acquired; sprintf(mdcbufr,"%u",ui16); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1083,len,(Uint8 *)mdcbufr); /* intervals rejected */ ui16 = (Uint16) (gd->cycles_observed - gd->cycles_acquired); sprintf(mdcbufr,"%u",ui16); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0018,0x1084,len,(Uint8 *)mdcbufr); MdcDicomWriteInfoSeq(fi->ofp,0x0054,0x0072); for (t=0; tdim[4]; t++) { MdcDicomWriteItem(fi->ofp); v = (gd->cycles_acquired * gd->image_duration)/(float)fi->number; sprintf(mdcbufr,"%+e",v); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0054,0x0073 ,len,(Uint8 *)mdcbufr); MdcDicomWriteItemDelItem(fi->ofp); } MdcDicomWriteInfoSeqDelItem(fi->ofp); MdcDicomWriteItemDelItem(fi->ofp); MdcDicomWriteInfoSeqDelItem(fi->ofp); MdcDicomWriteItemDelItem(fi->ofp); } MdcDicomWriteInfoSeqDelItem(fi->ofp); } /* MARK: timeslot vectors */ if (dicom->VectDO[MDC_VECT_TIMESLOT] == MDC_YES) { if (fi->acquisition_type == MDC_ACQUISITION_GATED) { /* MARK: for gated, time slot is the last dimension !! */ dim = fi->dim[3]; }else{ dim = fi->dim[4]; } if (dim == 0) return("DICM Bad zero value for fi->dim[3|4] (NM)"); if (fi->number % dim) return("DICM Garbled value for fi->dim[3|4] (NM)"); vect = fi->number / dim; bytes = fi->number * sizeof(Uint16); pui16=(Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc TimeSlotVector (NM)"); for (i=0; inumber; i++) pui16[i]=(Uint16)((i/vect)+1); mdc_dicom_write_element(fi->ofp,0x0054,0x0070,bytes,(Uint8 *)pui16); MdcFree(pui16); /* number of intervals */ ui16 = (Uint16) dim; mdc_dicom_write_element(fi->ofp,0x0054,0x0071,sizeof(Uint16) ,(Uint8 *)&ui16); } /* MARK: slice vector */ if (dicom->VectDO[MDC_VECT_SLICE] == MDC_YES) { bytes = fi->number*sizeof(Uint16); pui16=(Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc SliceVector (NM)"); vect = fi->dim[3]; for (i=0; inumber; i++) pui16[i]=(Uint16)((i%vect)+1); mdc_dicom_write_element(fi->ofp,0x0054,0x0080,bytes,(Uint8 *)pui16); MdcFree(pui16); /* number of slices */ ui16 = (Uint16) fi->dim[3]; mdc_dicom_write_element(fi->ofp,0x0054,0x0081,sizeof(Uint16) ,(Uint8 *)&ui16); } /* MARK: angular view vector */ if (dicom->VectDO[MDC_VECT_ANGULARVIEW] == MDC_YES) { bytes = fi->number*sizeof(Uint16); pui16=(Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc AngularViewVector (NM)"); vect = fi->dim[3]; for (i=0; inumber; i++) pui16[i]=(Uint16)((i%vect)+1); mdc_dicom_write_element(fi->ofp,0x0054,0x0090,bytes,(Uint8 *)pui16); MdcFree(pui16); } /* MARK: time slice vector */ if (dicom->VectDO[MDC_VECT_TIMESLICE] == MDC_YES) { if ((fi->dynnr > 0) && (fi->dyndata != NULL)) { bytes = fi->number * sizeof(Uint16); pui16 = (Uint16 *)malloc(bytes); if (pui16 == NULL) return("DICM Bad malloc TimeSliceVector (NM)"); /* phases */ inr = 0; for (ph = 0; ph < fi->dynnr; ph++ ) { /* timeslices */ for (ts=0; ts < fi->dyndata[ph].nr_of_slices ; ts++) { pui16[inr++] = (Uint16)ts + 1; } } mdc_dicom_write_element(fi->ofp,0x0054,0x0100,bytes,(Uint8 *)pui16); MdcFree(pui16); }else{ return("DICM Missing dynamic data structs"); } } /* patient orientation code sequence */ MdcDicomWriteInfoSeq(fi->ofp,0x0054,0x0410); /* sequence delimitation item */ MdcDicomWriteInfoSeqDelItem(fi->ofp); /* patient gantry relationship code sequence */ MdcDicomWriteInfoSeq(fi->ofp,0x0054,0x0414); /* sequence delimitation item */ MdcDicomWriteInfoSeqDelItem(fi->ofp); } return(NULL); } /* write Images */ char *MdcDicomWriteG7FE0(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom) { Uint32 i, bytes, pixels, len, PAD_EVEN=0; Uint8 *newbuff, *buff, c=0x00; float slope, intercept; /* group 0x7FE0 - dump the images */ bytes = fi->number * fi->mwidth * fi->mheight * MdcType2Bytes(dicom->type); if (bytes%2) { PAD_EVEN=1; bytes+=1; } mdc_dicom_write_element(fi->ofp,0x7fe0,0x0010,bytes,(Uint8 *)&dicom->type); for (i=0; inumber; i++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); switch (dicom->type) { case BIT8_U : newbuff = MdcGetImgBIT8_U(fi,i); break; case BIT16_S: newbuff = MdcGetImgBIT16_S(fi,i); break; default: newbuff = NULL; /* bad pixel type */ } if (newbuff == NULL) return("DICM Bad malloc newbuff image"); if (fi->diff_size == MDC_YES) { buff = MdcGetResizedImage(fi,newbuff,dicom->type,i); if (buff == NULL) return("DICM Bad malloc resized image"); MdcFree(newbuff); }else buff = newbuff; if (MDC_FILE_ENDIAN != MDC_HOST_ENDIAN) MdcMakeImgSwapped(buff, fi, i, fi->mwidth, fi->mheight, dicom->type); pixels = fi->mwidth * fi->mheight; bytes = MdcType2Bytes(dicom->type); if (fwrite(buff,bytes,pixels,fi->ofp) != pixels) return("DICM Bad writing of image"); MdcFree(buff); } if (PAD_EVEN) { if (fwrite(&c,1,1,fi->ofp) != 1) { return("DICM Failed to pad image"); } } if (MDC_QUANTIFY == MDC_YES || MDC_CALIBRATE == MDC_YES) { /* rewrite the true intercept value */ fseek(fi->ofp,(signed)MDC_REWRF_INTERCEPT,SEEK_SET); intercept = fi->image[0].rescaled_intercept; sprintf(mdcbufr,"%+e",intercept); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0028,0x1052,len,(Uint8 *)mdcbufr); /* rewrite the true slope value */ fseek(fi->ofp,(signed)MDC_REWRF_SLOPE,SEEK_SET); slope = fi->image[0].rescaled_slope; sprintf(mdcbufr,"%+e",slope); len = strlen(mdcbufr); mdc_dicom_write_element(fi->ofp,0x0028,0x1053,len,(Uint8 *)mdcbufr); } return(NULL); } const char *MdcWriteDICM(FILEINFO *fi) { GATED_DATA tmpgd; MDC_DICOM_STUFF_T *dicom=&mdc_dicom_stuff; const char *msg; if (MDC_DICOM_WRITE_IMPLICIT == MDC_YES) { MDC_FILE_ENDIAN = MDC_LITTLE_ENDIAN; }else{ MDC_FILE_ENDIAN = MDC_WRITE_ENDIAN; } if (fi->gatednr > 0 && fi->gdata != NULL) { gd = (GATED_DATA *)&fi->gdata[0]; }else{ gd = (GATED_DATA *)&tmpgd; MdcInitGD(gd); } /* no batch process in GUI, change UID's for each write */ if (XMDC_GUI == MDC_YES) mdc_psec = NULL; if (mdc_psec == NULL) { /* for first time, retrieve universal time (seconds) */ if ( time(&mdc_sec) == ((time_t)-1) ) { MdcPrntMesg("DICM Generating unique UID failed"); }else{ mdc_psec = &mdc_sec; } } if (XMDC_GUI == MDC_NO) { MdcDefaultName(fi,MDC_FRMT_DICM,fi->ofname,fi->ifname); } if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Writing DICOM:"); if (MDC_VERBOSE) MdcPrntMesg("DICM Writing <%s> ...",fi->ofname); /* check for colored files */ if (fi->map == MDC_MAP_PRESENT) return("DICM Colored files unsupported"); if (MDC_FILE_STDOUT == MDC_YES) { fi->ofp = stdout; }else{ if (MdcKeepFile(fi->ofname)) return("DICM File exists!!"); if ( (fi->ofp=fopen(fi->ofname,"wb")) == NULL) return("DICM Couldn't open file"); } /* init dicom struct */ MdcDicomInitStuff(dicom); /* set modality to write */ MdcDicomWriteSetModality(fi,dicom); /* check for requested pixel type */ if (MDC_FORCE_INT != MDC_NO) dicom->type = MDC_FORCE_INT; /* only Int16 or Uint8 type supported */ if ( (dicom->type != BIT16_S) && (dicom->type != BIT8_U) ) { dicom->type = BIT16_S; MdcPrntWarn("DICM Only Int16 or Uint8 pixels supported"); } /* NM dynamic inappropriate for non-planar */ if (dicom->modality == M_NM && fi->planar == MDC_NO && fi->acquisition_type == MDC_ACQUISITION_DYNAMIC) { MdcPrntWarn("DICM Inappropriate for non-planar dynamic studies (NM)"); } if (MDC_DICOM_WRITE_NOMETA == MDC_NO) { msg = MdcDicomWriteMetaHeader(fi,dicom); if (msg != NULL) return(msg); } msg = MdcDicomWriteG0008(fi,dicom); if (msg != NULL) return(msg); msg = MdcDicomWriteG0010(fi,dicom); if (msg != NULL) return(msg); msg = MdcDicomWriteG0018(fi,dicom); if (msg != NULL) return(msg); msg = MdcDicomWriteG0020(fi,dicom); if (msg != NULL) return(msg); msg = MdcDicomWriteG0028(fi,dicom); if (msg != NULL) return(msg); switch (dicom->modality) { case M_PT: default : /* default to NM modality */ msg = MdcDicomWriteG0054(fi,dicom); if (msg != NULL) return(msg); } msg = MdcDicomWriteG7FE0(fi,dicom); if (msg != NULL) return(msg); MdcCloseFile(fi->ofp); return NULL; } /********** * images * **********/ static int mdc_dicom_read(FILEINFO *fi, IMAGE **image, int *number) { int err; dicom_init(fi->ifp); /* last argument: parametric(=1) (see more in vtdicom file transform.c)*/ /* we need original values, preventing the rescaling to max/inverting */ /* for doing the things ourselves (width/center or slope/intercept) */ err = dicom_read(fi->ipath,image,number,1); return(err); } /******** * info * ********/ static void mdc_dicom_getinfo(FILEINFO *fi) { ELEMENT *e; DICTIONARY *d; MDC_ACR_TAG acrtag; MDC_SEQ_TAG seqtag, *seq; /* MARK Int8 saved_file_endian = MDC_FILE_ENDIAN; */ dicom_log(INFO,"dump_open()"); dicom_init(fi->ifp); if (dicom_open(fi->ipath)) return; for (;;) { e=dicom_element(); if (!e) return; d=dicom_query(e); if (e->vr==UN) e->vr=d->vr; if (mdc_dicom_load(e->vr)) return; acrtag.group = e->group; acrtag.element= e->element; acrtag.length = e->length; acrtag.data = (Uint8 *)e->value.UN; seqtag.group = e->sqtag.group; seqtag.element= e->sqtag.element; seq = (e->sequence) ? &seqtag : NULL; if (acrtag.data != NULL) { if (mdc_dicom_skip_sequence(e) == 0) MdcDoTag(seq,&acrtag,fi,0); MdcFree(e->value.UN); } } } /******** * open * ********/ static void mdc_dicom_dumpinfo(FILEINFO *fi) { ELEMENT *e; DICTIONARY *d; dicom_log(INFO,"dump_open()"); dicom_init(fi->ifp); if (dicom_open(fi->ipath)) return; for (;;) { e=dicom_element(); if (!e) return; d=dicom_query(e); if (e->vr==UN && d->vr!=ox) { /* replace, except for special tags */ e->vr=d->vr; } if (dicom_load(e->vr)) return; mdc_dicom_printinfo(e,d->description); MdcFree(e->value.UN); } } /********* * print * *********/ static void mdc_dicom_printinfo(const ELEMENT *e,const char *description) { U32 i, len; dicom_log(INFO,"dump_print()"); for (i=e->sequence; i; i--) MdcPrntScrn(" "); if (MDC_DICOM_VERBOSE) MdcPrntScrn("(%.4X,%.4X) %c%c[%u] " ,e->group,e->element ,e->vr>>8,e->vr&0xFF,e->vm); MdcPrntScrn("%s%s: ",e->encapsulated?"Encapsulated ":"",description); if (!e->vm) { puts("(no value)"); return; } if (e->length == UNDEFINED_LENGTH) { puts("(undefined length)"); return; } for (i=0; ivm; i++) switch(e->vr) { case US : MdcPrntScrn("%u ",e->value.US[i]); break; case SS : MdcPrntScrn("%d ",e->value.SS[i]); break; case UL : MdcPrntScrn("%u ",e->value.UL[i]); break; case SL : MdcPrntScrn("%d ",e->value.SL[i]); break; case AT : MdcPrntScrn("(%.4X,%.4X) ",e->value.AT[i].group,e->value.AT[i].element); break; case FL : MdcPrntScrn("%f ",e->value.FL[i]); break; case FD : MdcPrntScrn("%f ",e->value.FD[i]); break; case LT : case ST : if (e->length > 128) { strcpy(mdcbufr,"..."); }else{ MdcGetSafeString(mdcbufr,e->value.LT,e->length,MDC_2KB_OFFSET); } MdcPrntScrn("[%s] ",mdcbufr); break; case AE : case AS : case CS : case DA : case DS : case DT : case IS : case LO : case PN : case SH : case TM : case UI : len = strlen(e->value.AE[i]); if (len > 128) { strcpy(mdcbufr,"..."); }else{ MdcGetSafeString(mdcbufr,e->value.AE[i],len,MDC_2KB_OFFSET); } MdcPrntScrn("[%s] ",mdcbufr); break; default : MdcPrntScrn("(%u bytes)\n",e->length); return; } if (MDC_DICOM_VERBOSE) MdcPrntScrn("(%u bytes)",e->length); puts(""); } void mdc_dicom_get_vr(ELEMENT *e) { DICTIONARY *d; d = dicom_query(e); e->vr = d->vr; } Uint8 *mdc_dicom_handle_vr(ELEMENT *e, Uint8 *tdata) { switch (e->vr) { case ox: if ((e->group == 0x7fe0) && (e->element == 0x0010)) { Int16 type; memcpy(&type,tdata,2); switch (type) { case BIT8_U : e->vr = OB; return(NULL); case BIT16_S: e->vr = OW; return(NULL); } } /* else other handle code */ break; default: return(tdata); /* no special VR */ } /* error exit = unhandled special VR */ MdcPrntErr(MDC_BAD_CODE,"Internal ## Extra code required for tag %x:%x" ,e->group,e->element); return(tdata); } /********* * write * *********/ int mdc_dicom_write_element(FILE *fp, Uint16 group, Uint16 element, Uint32 length, Uint8 *data) { ELEMENT element_t, *e; Uint32 i, vr_w, length32_w; Uint16 length16_w; Int8 file_endian_saved=MDC_FILE_ENDIAN; Int8 MAKE_EVEN=0, DO_IMPLICIT=MDC_DICOM_WRITE_IMPLICIT; Uint8 *ndata=NULL; /* make even tags */ if ((length%2) && (length != UNDEFINED_LENGTH)) { MAKE_EVEN = 1; } /* fill in the values */ e = &element_t; e->group = group; e->element = element; e->length = length + MAKE_EVEN; length32_w = e->length; length16_w = (Uint16)e->length; /* default transfer = explicit */ if (DO_IMPLICIT == MDC_YES) { /* only implicit VR little */ MDC_FILE_ENDIAN = MDC_LITTLE_ENDIAN; } /* meta group must be explicit VR little */ if (e->group == 0x0002) { MDC_FILE_ENDIAN = MDC_LITTLE_ENDIAN; DO_IMPLICIT = MDC_NO; } /* fix endian of tag items to write */ MdcSWAP(group); MdcSWAP(element); MdcSWAP(length16_w); MdcSWAP(length32_w); /* write group */ fwrite((Uint8 *)&group,1,sizeof(e->group),fp); /* write element */ fwrite((Uint8 *)&element,1,sizeof(e->element),fp); /* write value representation & length */ mdc_dicom_get_vr(e); /* handle special VR values */ ndata = mdc_dicom_handle_vr(e,data); vr_w = e->vr; if (MdcHostBig()) vr_w = (vr_w << 16); else MdcForceSwap((Uint8 *)&vr_w,2); switch (e->vr) { case OB : case OW : case SQ : case UN : case UT : if (DO_IMPLICIT == MDC_YES) { fwrite((Uint8 *)&length32_w,1,4,fp); }else{ if (e->group != 0xfffe) fwrite((Uint8 *)&vr_w,1,4,fp); fwrite((Uint8 *)&length32_w,1,4,fp); } break; case AT : /* 2 bytes endian sensitive data */ case SS : case US : if (DO_IMPLICIT == MDC_YES) { fwrite((Uint8 *)&length32_w,1,4,fp); }else{ fwrite((Uint8 *)&vr_w,1,2,fp); fwrite((Uint8 *)&length16_w,1,2,fp); } e->vm = length >> 1; for (i=0; ivm; i++) MdcSwapBytes(ndata+(i<<1),2); break; case FL : /* 4 bytes endian sensitive data */ case SL : case UL : if (DO_IMPLICIT == MDC_YES) { fwrite((Uint8 *)&length32_w,1,4,fp); }else{ fwrite((Uint8 *)&vr_w,1,2,fp); fwrite((Uint8 *)&length16_w,1,2,fp); } e->vm = length >> 2; for (i=0; ivm; i++) MdcSwapBytes(ndata+(i<<2),4); break; case FD : /* 8 bytes endian sensitive data */ if (DO_IMPLICIT == MDC_YES) { fwrite((Uint8 *)&length32_w,1,4,fp); }else{ fwrite((Uint8 *)&vr_w,1,2,fp); fwrite((Uint8 *)&length16_w,1,2,fp); } e->vm = length >> 3; for (i=0; ivm; i++) MdcSwapBytes(ndata+(i<<3),8); break; default : if (DO_IMPLICIT == MDC_YES) { fwrite((Uint8 *)&length32_w,1,4,fp); }else{ fwrite((Uint8 *)&vr_w,1,2,fp); fwrite((Uint8 *)&length16_w,1,2,fp); } } /* write value data */ if ((ndata != NULL) && (length != 0) && (length != UNDEFINED_LENGTH)) { fwrite((Uint8 *)ndata,1,length,fp); if (MAKE_EVEN) { switch (e->vr) { case UI: fputc('\0',fp); break; default: fputc(' ',fp); } } } /* restore original output file endian */ MDC_FILE_ENDIAN = file_endian_saved; if (ferror(fp)) return(MDC_NO); return(MDC_YES); } xmedcon-0.14.1/source/m-anlz.c0000644000175000017510000010471012636253501013024 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-anlz.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : read and write ANALYZE files * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcCheckANLZ() - Check ANALYZE format * * MdcReadANLZ() - Read ANALYZE file * * MdcWriteANLZ() - Write ANALYZE file * * MdcWriteHeaderKey() - Write Header Key to file * * MdcWriteImageDimension() - Write Image Dimension to file * * MdcWriteDataHistory() - Write Data History to file * * MdcWriteImagesData() - Write the images to file * * MdcGetSpmOpt() - Get specific SPM options * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-anlz.c,v 1.90 2015/12/22 13:59:29 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #ifdef HAVE_UNISTD_H #include #endif #include "medcon.h" /**************************************************************************** D E F I N E S *****************************************************************************/ static Int8 INIT_SPMOPT = MDC_YES; static MDC_SPMOPT spmopt; #define MDC_ALWAYS_SET_4D 1 /* 0/1 disable/enable always set 4 dims */ /**************************************************************************** F U N C T I O N S *****************************************************************************/ int MdcCheckANLZ(FILEINFO *fi) { MDC_ANLZ_HEADER_KEY hk; int check=2, FORMAT=MDC_FRMT_NONE; if (fread((char *)&hk,1,MDC_ANLZ_HK_SIZE,fi->ifp) != MDC_ANLZ_HK_SIZE) return(MDC_BAD_READ); MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; while (check--) { if ( (hk.sizeof_hdr==348 || hk.sizeof_hdr==148 || hk.sizeof_hdr==228 || hk.sizeof_hdr==384) && (hk.regular == MDC_ANLZ_SIG ) ) { FORMAT = MDC_FRMT_ANLZ; break; } MDC_FILE_ENDIAN = !MDC_HOST_ENDIAN; MdcSWAP(hk.sizeof_hdr); } return(FORMAT); } const char *MdcReadANLZ(FILEINFO *fi) { MDC_SPMOPT *opt = &spmopt; FILE *fp=fi->ifp; MDC_ANLZ_HEADER_KEY hk; MDC_ANLZ_IMAGE_DIMS imd; MDC_ANLZ_DATA_HIST dh; IMG_DATA *id=NULL; DYNAMIC_DATA *dd=NULL; Uint32 bytes, i, plane, f, number; Uint8 *img8=NULL; Int8 WAS_COMPRESSED = MDC_NO; char *origpath=NULL; const char *err=NULL; if (MDC_FILE_STDIN == MDC_YES) return("ANLZ File input from stdin unsupported"); if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Reading Analyze:"); if (MDC_VERBOSE) MdcPrntMesg("ANLZ Reading <%s> ...",fi->ifname); /* get endian of the file in MDC_FILE_ENDIAN */ i=MdcCheckANLZ(fi); fseek(fp,0,SEEK_SET); if (i != MDC_FRMT_ANLZ) { if (MDC_FALLBACK_FRMT == MDC_FRMT_ANLZ) { /* set host endian to try analyze */ MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; }else{ /* bail out */ return("ANLZ Endian check failed"); } } memset(&hk,0,MDC_ANLZ_HK_SIZE); memset(&imd,0,MDC_ANLZ_IMD_SIZE); memset(&dh,0,MDC_ANLZ_DH_SIZE); /* put some default we use */ fi->reconstructed = MDC_YES; fi->acquisition_type = MDC_ACQUISITION_TOMO; dh.orient=(char)0xff; if (fread((char *)&hk,1,MDC_ANLZ_HK_SIZE,fp) != MDC_ANLZ_HK_SIZE) return("ANLZ Bad read HeadKey struct"); fi->endian=MDC_FILE_ENDIAN; MdcSWAP(hk.sizeof_hdr); MdcSWAP(hk.extents); MdcSWAP(hk.session_error); if (MDC_INFO) { MdcPrntScrn("\nMDC_ANLZ_HEADER_KEY (%d bytes)\n",MDC_ANLZ_HK_SIZE); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("sizeof_hdr : %d\n",hk.sizeof_hdr); strncpy(mdcbufr,hk.data_type,10); mdcbufr[10]='\0'; MdcPrntScrn("data_type : "); MdcPrintStr(mdcbufr); strncpy(mdcbufr,hk.db_name,18); mdcbufr[18]='\0'; MdcPrntScrn("db_name : "); MdcPrintStr(mdcbufr); MdcPrntScrn("extents : %d\n",hk.extents); MdcPrntScrn("session_error : %hd\n",hk.session_error); MdcPrntScrn("regular : "); MdcPrintChar(hk.regular); MdcPrntScrn("\n"); MdcPrntScrn("hkey_un0 : "); MdcPrintChar(hk.hkey_un0); MdcPrntScrn("\n"); } if (MDC_INFO) { MdcPrntScrn("\nIMAGE_DIMENSION (%d bytes)\n",MDC_ANLZ_IMD_SIZE); MdcPrintLine('-',MDC_HALF_LENGTH); } if (fread((char *)&imd,1,MDC_ANLZ_IMD_SIZE,fp)!=MDC_ANLZ_IMD_SIZE) return("ANLZ Bad read ImageDimensions struct"); for (i=0; i (MDC_ANLZ_MAX_DIMS - 1))) { if (MDC_FALLBACK_FRMT == MDC_FRMT_ANLZ) { /* force reading, set to an acceptable value */ /* hope unused dims were initialized to zero */ for (i = 3; i < MDC_ANLZ_MAX_DIMS; i++) if (imd.dim[i] <= 0) break; imd.dim[0] = i-1; MdcPrntWarn("ANLZ Bad header value in dim[0] dimension"); }else{ /* bail out safely */ return("ANLZ Bad header value in dim[0] dimension"); } } if (MDC_INFO) { for (i=0; i - ANLZ Truncated header",fi->ifname); } memcpy(&opt->origin_x,&dh.originator[0],2); MdcSWAP(opt->origin_x); memcpy(&opt->origin_y,&dh.originator[2],2); MdcSWAP(opt->origin_y); memcpy(&opt->origin_z,&dh.originator[4],2); MdcSWAP(opt->origin_z); MdcSWAP(dh.views); MdcSWAP(dh.vols_added); MdcSWAP(dh.start_field); MdcSWAP(dh.field_skip); MdcSWAP(dh.omax); MdcSWAP(dh.omin); MdcSWAP(dh.smax); MdcSWAP(dh.smin); if (MDC_INFO) { strncpy(mdcbufr,dh.descrip,80); mdcbufr[80]='\0'; MdcPrntScrn("description : "); MdcPrintStr(mdcbufr); strncpy(mdcbufr,dh.aux_file,24); mdcbufr[24]='\0'; MdcPrntScrn("aux_file : "); MdcPrintStr(mdcbufr); MdcPrntScrn("orient : "); switch (dh.orient) { case MDC_ANLZ_TRANS_UNFLIPPED: MdcPrntScrn("transverse unflipped"); break; case MDC_ANLZ_CORON_UNFLIPPED: MdcPrntScrn("coronal unflipped"); break; case MDC_ANLZ_SAGIT_UNFLIPPED: MdcPrntScrn("sagittal unflipped"); break; case MDC_ANLZ_TRANS_FLIPPED : MdcPrntScrn("transverse flipped"); break; case MDC_ANLZ_CORON_FLIPPED : MdcPrntScrn("coronal flipped"); break; case MDC_ANLZ_SAGIT_FLIPPED : MdcPrntScrn("sagittal flipped"); break; default: MdcPrntScrn("Unknown"); } MdcPrntScrn("\n"); strncpy(mdcbufr,dh.originator,10); mdcbufr[10]='\0'; MdcPrntScrn("originator : "); MdcPrintStr(mdcbufr); strncpy(mdcbufr,dh.generated,10); mdcbufr[10]='\0'; MdcPrntScrn("generated : "); MdcPrintStr(mdcbufr); strncpy(mdcbufr,dh.scannum,10); mdcbufr[10]='\0'; MdcPrntScrn("scannum : "); MdcPrintStr(mdcbufr); strncpy(mdcbufr,dh.patient_id,10); mdcbufr[10]='\0'; MdcPrntScrn("patient_id : "); MdcPrintStr(mdcbufr); strncpy(mdcbufr,dh.exp_date,10); mdcbufr[10]='\0'; MdcPrntScrn("exp_date : "); MdcPrintStr(mdcbufr); strncpy(mdcbufr,dh.exp_time,10); mdcbufr[10]='\0'; MdcPrntScrn("exp_time : "); MdcPrintStr(mdcbufr); MdcPrntScrn("views : %d\n",dh.views); MdcPrntScrn("vols_added : %d\n",dh.vols_added); MdcPrntScrn("start_field : %d\n",dh.start_field); MdcPrntScrn("omax : %d\n",dh.omax); MdcPrntScrn("omin : %d\n",dh.omin); MdcPrntScrn("smax : %d\n",dh.smax); MdcPrntScrn("smin : %d\n",dh.smin); } if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('=',MDC_FULL_LENGTH); MdcPrntScrn("SPM - HEADER INTERPRETATION\n"); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("image {x} : %hd\n",imd.dim[1]); MdcPrntScrn("image {y} : %hd\n",imd.dim[2]); MdcPrntScrn("image {z} : %hd\n",imd.dim[3]); MdcPrntScrn("voxel {x} : %+e\n",imd.pixdim[1]); MdcPrntScrn("voxel {y} : %+e\n",imd.pixdim[2]); MdcPrntScrn("voxel {z} : %+e\n",imd.pixdim[3]); MdcPrntScrn("scaling : %+e\n",imd.spm_pix_rescale); MdcPrntScrn("data type : %hd\n",imd.datatype); MdcPrntScrn("offset : %+e\n",imd.avw_vox_offset); MdcPrntScrn("origin : %hd %hd %hd\n",opt->origin_x ,opt->origin_y ,opt->origin_z); MdcPrntScrn("description : "); MdcPrintStr(dh.descrip); MdcPrintLine('=',MDC_FULL_LENGTH); } /* save the offset, valid for AVW / SPM / MRIcro Analyze files */ opt->offset = imd.avw_vox_offset; /* update our FILEINFO structure */ MdcStringCopy(fi->study_descr,dh.descrip,80); MdcStringCopy(fi->patient_id,dh.patient_id,10); MdcStringCopy(fi->study_id,dh.scannum,10); if (MDC_ECHO_ALIAS == MDC_YES) { MdcEchoAliasName(fi); return(NULL); } memcpy(fi->dim,imd.dim,sizeof(imd.dim)); memcpy(fi->pixdim,imd.pixdim,sizeof(imd.pixdim)); fi->mwidth = (Uint32) imd.dim[1]; fi->mheight = (Uint32) imd.dim[2]; for ( number=1, i=3; i<=imd.dim[0]; i++) number*=imd.dim[i]; if (number == 0) return("ANLZ No valid images specified"); fi->bits = imd.bitpix; switch (imd.datatype) { case MDC_ANLZ_DT_BINARY : fi->type=BIT1; fi->bits=8; break; case MDC_ANLZ_DT_UNSIGNED_CHAR: fi->type=BIT8_U; fi->bits=8; break; case MDC_ANLZ_DT_SIGNED_SHORT : fi->type=BIT16_S; fi->bits=16; break; case MDC_ANLZ_DT_SIGNED_INT : fi->type=BIT32_S; fi->bits=32; break; case MDC_ANLZ_DT_FLOAT : fi->type=FLT32; fi->bits=32; break; case MDC_ANLZ_DT_COMPLEX : return("ANLZ Datatype `complex' unsupported"); break; case MDC_ANLZ_DT_DOUBLE : fi->type=FLT64; fi->bits=64; break; case MDC_ANLZ_DT_RGB : fi->type=COLRGB; fi->bits=24; fi->map=MDC_MAP_PRESENT; break; case MDC_ANLZ_DT_ALL : return("ANLZ Datatype `All' unsupported"); break; default : switch (fi->bits) { case 1: fi->type=BIT1; break; case 8: fi->type=BIT8_U; break; case 16: fi->type=BIT16_S; break; case 32: fi->type=BIT32_S; break; /* could be FLT32 as well */ default: MdcPrntWarn("ANLZ Unknown datatype"); } } /* preserve original path */ MdcMergePath(fi->ipath,fi->idir,fi->ifname); if ((origpath=malloc(strlen(fi->ipath) + 1)) == NULL) return("ANLZ Couldn't allocate original path"); strcpy(origpath,fi->ipath); MdcSplitPath(fi->ipath,fi->idir,fi->ifname); /* read the image file */ MdcCloseFile(fi->ifp); MdcMergePath(fi->ipath,fi->idir,fi->ifname); MdcSetExt(fi->ipath,"img"); /* check for compressed image file */ if (MdcFileExists(fi->ipath) == MDC_NO) { MdcAddCompressionExt(fi->compression,fi->ipath); if (MdcDecompressFile(fi->ipath) != MDC_OK) { MdcFree(origpath); return("ANLZ Decompression image file failed"); } WAS_COMPRESSED = MDC_YES; } if ( (fi->ifp=fopen(fi->ipath,"rb")) == NULL ) { MdcFree(origpath); return("ANLZ Couldn't open image file"); } if (WAS_COMPRESSED == MDC_YES) { unlink(fi->ipath); if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Reading Analyze:"); } MdcSplitPath(fi->ipath,fi->idir,fi->ifname); if (MDC_ANLZ_SPM == MDC_YES) { /* interpret offset value from the header but we keep */ /* our precautions ... badly initialized headers */ long offsetu = (long)opt->offset; if ((float)offsetu == opt->offset) fseek(fi->ifp,offsetu,SEEK_SET); } if (!MdcGetStructID(fi,number)) { MdcFree(origpath); return("ANLZ Bad malloc IMG_DATA structs"); } /* attempt to fill in orientation information */ switch (dh.orient) { /* flipped, what's the meaning of flipped here ? */ case MDC_ANLZ_TRANS_UNFLIPPED: fi->pat_slice_orient=MDC_SUPINE_HEADFIRST_TRANSAXIAL; break; case MDC_ANLZ_CORON_UNFLIPPED: fi->pat_slice_orient=MDC_SUPINE_HEADFIRST_CORONAL; break; case MDC_ANLZ_SAGIT_UNFLIPPED: fi->pat_slice_orient=MDC_SUPINE_HEADFIRST_SAGITTAL; break; case MDC_ANLZ_TRANS_FLIPPED: fi->pat_slice_orient=MDC_SUPINE_HEADFIRST_TRANSAXIAL; break; case MDC_ANLZ_CORON_FLIPPED: fi->pat_slice_orient=MDC_SUPINE_HEADFIRST_CORONAL; break; case MDC_ANLZ_SAGIT_FLIPPED: fi->pat_slice_orient=MDC_SUPINE_HEADFIRST_SAGITTAL; break; } strcpy(fi->pat_pos,MdcGetStrPatPos(fi->pat_slice_orient)); strcpy(fi->pat_orient,MdcGetStrPatOrient(fi->pat_slice_orient)); for ( i=0; i < fi->number; i++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); plane = i % fi->dim[3]; id = &fi->image[i]; id->width = fi->mwidth; id->height = fi->mheight; id->bits = fi->bits; id->type = fi->type; if (MDC_ANLZ_SPM) { /* consider the scaling factor */ if (imd.spm_pix_rescale > 0.0 ) id->quant_scale = imd.spm_pix_rescale; } if (fi->pixdim[0] == 3.0 ) { id->pixel_xsize = fi->pixdim[1]; id->pixel_ysize = fi->pixdim[2]; id->slice_width = fi->pixdim[3]; }else if (fi->pixdim[0] == 4.0 ) { id->pixel_xsize = fi->pixdim[1]; id->pixel_ysize = fi->pixdim[2]; id->slice_width = fi->pixdim[3]; }else if ( (fi->pixdim[1] > 0.0) && (fi->pixdim[2] > 0.0) && (fi->pixdim[3] > 0.0) ) { /* we will try it anyway */ /* some don't fill in pixdim[0] */ /* for example PMOD (11-Apr-2000) */ id->pixel_xsize = fi->pixdim[1]; id->pixel_ysize = fi->pixdim[2]; id->slice_width = fi->pixdim[3]; fi->pixdim[0] = 3.0; }else { id->pixel_xsize = 1.0; id->pixel_ysize = 1.0; id->slice_width = 1.0; } id->slice_spacing = id->slice_width; MdcFillImgPos(fi,i,plane,0.0); MdcFillImgOrient(fi,i); bytes = MdcPixels2Bytes(fi->mwidth*fi->mheight*fi->bits); if ( (id->buf=MdcGetImgBuffer(bytes)) == NULL ) { MdcFree(img8); MdcFree(origpath); return("ANLZ Bad malloc image buffer"); } if (img8 != NULL) { /* image from buffer */ memcpy(id->buf,img8+i*bytes,bytes); }else{ /* image from file */ if (fread(id->buf,1,bytes,fi->ifp) != bytes ) { err=MdcHandleTruncated(fi, i+1,MDC_YES); if (err != NULL) { MdcFree(origpath); return(err); } } if (fi->truncated) break; } } MdcFree(img8); MdcCloseFile(fi->ifp); /* check some final FILEINFO entries */ if (fi->dim[4] > 1) { fi->acquisition_type = MDC_ACQUISITION_DYNAMIC; /* fill in dynamic data struct */ if (!MdcGetStructDD(fi,(unsigned)fi->dim[4])) return("ANLZ Couldn't malloc DYNAMIC_DATA structs"); for (f=0; f < fi->dynnr; f++) { dd = &fi->dyndata[f]; dd->nr_of_slices = fi->dim[3]; dd->time_frame_duration = fi->pixdim[4]; dd->time_frame_start = f * dd->time_frame_duration; } } /* restore original filename */ strcpy(fi->ipath,origpath); MdcSplitPath(fi->ipath,fi->idir,fi->ifname); MdcFree(origpath); if (fi->truncated) return("ANLZ Truncated image file"); return NULL; } int MdcWriteHeaderKey(FILEINFO *fi) { MDC_ANLZ_HEADER_KEY hk; char *p = NULL; memset(&hk,0,MDC_ANLZ_HK_SIZE); hk.sizeof_hdr = MDC_ANLZ_HK_SIZE + MDC_ANLZ_IMD_SIZE + MDC_ANLZ_DH_SIZE; sprintf(hk.data_type,"dsr"); MdcSplitPath(fi->opath,fi->odir,fi->ofname); p = strrchr(fi->ofname,'.'); if (p != NULL) *p = '\0'; /* remove extension */ sprintf(hk.db_name,"%.17s",fi->ofname); if (p != NULL) *p = '.'; /* add extension */ MdcMergePath(fi->opath,fi->odir,fi->ofname); hk.extents=16384; hk.session_error=0; hk.regular='r'; MdcSWAP(hk.sizeof_hdr); MdcSWAP(hk.extents); MdcSWAP(hk.session_error); fwrite((char *)&hk,1,MDC_ANLZ_HK_SIZE,fi->ofp); if (ferror(fi->ofp)) return(MDC_NO); return(MDC_YES); } int MdcWriteImageDimension(FILEINFO *fi, MDC_SPMOPT *opt) { MDC_ANLZ_IMAGE_DIMS imd; float glmax=0., glmin=0.; int i; memset(&imd,0,MDC_ANLZ_IMD_SIZE); strcpy(imd.avw_vox_units,"mm"); for (i=0; i <= fi->dim[0]; i++) imd.dim[i] = fi->dim[i]; for (i=0; i <= fi->pixdim[0]; i++) imd.pixdim[i] = fi->pixdim[i]; #if MDC_ALWAYS_SET_4D /* set dummy 4th dimension (time) */ if (imd.dim[0] == 3) { imd.dim[0] = 4; imd.dim[4] = 1; } if (imd.pixdim[0] == 3.) { imd.pixdim[0] = 4.; imd.pixdim[4] = 0.; } #endif #ifdef MDC_USE_SLICE_SPACING if (fi->number > 1) imd.pixdim[3] = fi->image[0].slice_spacing; #endif imd.dim[1] = (Int16) fi->mwidth; imd.dim[2] = (Int16) fi->mheight; if (fi->map == MDC_MAP_PRESENT) { /* colored */ imd.datatype = MDC_ANLZ_DT_RGB; imd.bitpix = 24; }else{ /* grayscale */ if (MDC_FORCE_INT != MDC_NO) { switch (MDC_FORCE_INT) { case BIT8_U : imd.datatype = MDC_ANLZ_DT_UNSIGNED_CHAR; imd.bitpix = 8; break; case BIT16_S: imd.datatype = MDC_ANLZ_DT_SIGNED_SHORT; imd.bitpix = 16; break; default : imd.datatype = MDC_ANLZ_DT_SIGNED_SHORT; imd.bitpix = 16; } }else if (!(MDC_QUANTIFY || MDC_CALIBRATE)) { if ( fi->diff_type ) { imd.datatype = MDC_ANLZ_DT_SIGNED_SHORT; imd.bitpix = 16; }else{ switch ( fi->type ) { case BIT8_U: case BIT8_S: imd.datatype = MDC_ANLZ_DT_UNSIGNED_CHAR; imd.bitpix = 8; break; case BIT16_U: case BIT16_S: imd.datatype = MDC_ANLZ_DT_SIGNED_SHORT; imd.bitpix = 16; break; #ifdef HAVE_8BYTE_INT case BIT64_U: case BIT64_S: #endif case BIT32_U: case BIT32_S: imd.datatype = MDC_ANLZ_DT_SIGNED_INT; imd.bitpix = 32; break; case FLT32: imd.datatype = MDC_ANLZ_DT_FLOAT; imd.bitpix = 32; break; case FLT64: imd.datatype = MDC_ANLZ_DT_DOUBLE; imd.bitpix = 64; break; } } }else{ if (MDC_ANLZ_SPM == MDC_YES) { /* BIT16_S with scaling factor */ imd.datatype = MDC_ANLZ_DT_SIGNED_SHORT; imd.bitpix = 16; }else{ imd.datatype = MDC_ANLZ_DT_FLOAT; imd.bitpix = 32; } } } /* find and set max/min values */ for (i = 0; i < fi->number; i++) { IMG_DATA *id = &fi->image[i]; if (id->rescaled == MDC_YES) { if (i == 0) { /* init values */ glmax = id->rescaled_max; glmin = id->rescaled_min; }else{ /* get max/min */ glmax = (id->rescaled_max > glmax) ? id->rescaled_max : glmax; glmin = (id->rescaled_min < glmin) ? id->rescaled_min : glmin; } }else{ if (i == 0) { /* init values */ glmax = id->max; glmin = id->min; }else{ /* get max/min */ glmax = (id->max > glmax) ? id->max : glmax; glmin = (id->min < glmin) ? id->min : glmin; } } } imd.glmax = (Int32) glmax; imd.glmin = (Int32) glmin; imd.avw_cal_max = fi->qglmax; imd.avw_cal_min = fi->qglmin; /* thinking about SPM */ if (imd.pixdim[0] <= 0.0 || imd.pixdim[0] >= (float)MDC_ANLZ_MAX_DIMS) { imd.pixdim[0]=3.; imd.pixdim[1]=1.; imd.pixdim[2]=1.; imd.pixdim[3]=1.; } if (opt != NULL) imd.avw_vox_offset = opt->offset; if (MDC_ANLZ_SPM == MDC_YES) { /* the scaling factor */ if (fi->image[0].rescaled) imd.spm_pix_rescale=(float)fi->image[0].rescaled_fctr; /* did rescale over all images -> all images same factor */ }else{ imd.spm_pix_rescale=1.; } /* swap the data if necessary */ for (i=0; iofp); if (ferror(fi->ofp)) return(MDC_NO); return(MDC_YES); } int MdcWriteDataHistory(FILEINFO *fi, MDC_SPMOPT *opt) { MDC_ANLZ_DATA_HIST dh; memset(&dh,0,MDC_ANLZ_DH_SIZE); sprintf(dh.descrip,"%.35s",fi->study_descr); sprintf(dh.scannum,"%.9s",fi->study_id); sprintf(dh.patient_id,"%.9s",fi->patient_id); sprintf(dh.generated,"%.9s",MDC_PRGR); switch (fi->pat_slice_orient) { case MDC_SUPINE_HEADFIRST_TRANSAXIAL : case MDC_PRONE_HEADFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL: case MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL : case MDC_SUPINE_FEETFIRST_TRANSAXIAL : case MDC_PRONE_FEETFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL: case MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL : dh.orient = MDC_ANLZ_TRANS_UNFLIPPED; break; case MDC_SUPINE_HEADFIRST_CORONAL : case MDC_PRONE_HEADFIRST_CORONAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL : case MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL : case MDC_SUPINE_FEETFIRST_CORONAL : case MDC_PRONE_FEETFIRST_CORONAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL : case MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL : dh.orient = MDC_ANLZ_CORON_UNFLIPPED; break; case MDC_SUPINE_HEADFIRST_SAGITTAL : case MDC_PRONE_HEADFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL : case MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL : case MDC_SUPINE_FEETFIRST_SAGITTAL : case MDC_PRONE_FEETFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL : case MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL : dh.orient = MDC_ANLZ_SAGIT_UNFLIPPED; break; } if (opt != NULL) { MdcSWAP(opt->origin_x); memcpy(&dh.originator[0],&opt->origin_x,2); MdcSWAP(opt->origin_y); memcpy(&dh.originator[2],&opt->origin_y,2); MdcSWAP(opt->origin_z); memcpy(&dh.originator[4],&opt->origin_z,2); } fwrite((char *)&dh,1,MDC_ANLZ_DH_SIZE,fi->ofp); if (ferror(fi->ofp)) return(MDC_NO); return(MDC_YES); } char *MdcWriteImagesData(FILEINFO *fi) { double pval; Uint8 grval; Uint32 i, FREE; Uint32 size, n, nr; Uint16 type; Uint8 *buf, *maxbuf; Int8 saved_norm_over_frames=MDC_NORM_OVER_FRAMES; IMG_DATA *id; for (i=fi->number; i>0; i-- ) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); nr = fi->number - i; /* normal planes */ id = &fi->image[nr]; buf = id->buf; FREE = MDC_NO; type = id->type; if (fi->map != MDC_MAP_PRESENT) { /* grayscale */ if (MDC_FORCE_INT != MDC_NO) { if (MDC_ANLZ_SPM) MDC_NORM_OVER_FRAMES = MDC_NO; switch (MDC_FORCE_INT) { case BIT8_U : buf = MdcGetImgBIT8_U(fi,nr); type=BIT8_U; FREE=MDC_YES; break; case BIT16_S: buf = MdcGetImgBIT16_S(fi,nr); type=BIT16_S; FREE=MDC_YES; break; default : buf = MdcGetImgBIT16_S(fi,nr); type=BIT16_S; FREE=MDC_YES; } if (MDC_ANLZ_SPM) MDC_NORM_OVER_FRAMES = saved_norm_over_frames; }else if (!(MDC_QUANTIFY || MDC_CALIBRATE)) { if ( fi->diff_type ) { switch (id->type) { case BIT16_S: buf = id->buf; type = BIT16_S; FREE=MDC_NO; break; default : buf = MdcGetImgBIT16_S(fi,nr); type = BIT16_S; FREE=MDC_YES; break; } }else{ switch (id->type) { case BIT8_S: buf = MdcGetImgBIT8_U(fi,nr); type=BIT8_U ; FREE=MDC_YES; break; case BIT16_U: buf = MdcGetImgBIT16_S(fi,nr); type=BIT16_S; FREE=MDC_YES; break; case BIT32_U: buf = MdcGetImgBIT32_S(fi,nr); type=BIT32_S; FREE=MDC_YES; break; case BIT64_S: case BIT64_U: buf = MdcGetImgBIT32_S(fi,nr); type=BIT32_S; FREE=MDC_YES; break; } } }else{ if (MDC_ANLZ_SPM == MDC_YES) { /* using the global scale factor <=> normalize over ALL images! */ /* so all images have the same scale factor */ MDC_NORM_OVER_FRAMES=MDC_NO; buf = MdcGetImgBIT16_S(fi,nr); type = BIT16_S; FREE=MDC_YES; MDC_NORM_OVER_FRAMES=saved_norm_over_frames; }else{ buf = MdcGetImgFLT32(fi,nr); type=FLT32; FREE=MDC_YES; } } } if (buf == NULL) return("ANLZ Bad malloc image buffer"); if (fi->diff_size) { maxbuf = MdcGetResizedImage(fi, buf, type, nr); if (maxbuf == NULL) return("ANLZ Bad malloc maxbuf"); if (FREE) MdcFree(buf); FREE = MDC_YES; }else{ maxbuf = buf; } size = fi->mwidth * fi->mheight * MdcType2Bytes(type); if (fi->type == COLRGB) { /* true color */ if (fwrite(maxbuf,1,size,fi->ofp) != size) return("ANLZ Bad write RGB buffer"); }else{ for (n=0; n < size; n += MdcType2Bytes(type)) { /* indexed */ pval = MdcGetDoublePixel((Uint8 *)&maxbuf[n],type); if (fi->map == MDC_MAP_PRESENT) { /* colored */ grval = (Uint8)pval; fwrite(&fi->palette[grval * 3 + 0], 1, 1, fi->ofp); /* red */ fwrite(&fi->palette[grval * 3 + 1], 1, 1, fi->ofp); /* green */ fwrite(&fi->palette[grval * 3 + 2], 1, 1, fi->ofp); /* blue */ if (ferror(fi->ofp)) return("ANLZ Bad write colored pixel"); }else{ /* grayscale */ if (!MdcWriteDoublePixel(pval,type,fi->ofp)) return("ANLZ Bad write image pixel"); } } } if (FREE) MdcFree(maxbuf); if (ferror(fi->ofp)) return("ANLZ Bad writing of images"); } return NULL; } void MdcGetSpmOpt(FILEINFO *fi, MDC_SPMOPT *opt) { if (INIT_SPMOPT == MDC_YES) { opt->origin_x = 0; opt->origin_y = 0; opt->origin_z = 0; opt->offset = 0.; INIT_SPMOPT = MDC_NO; } if (MDC_FILE_STDIN == MDC_YES) return; /* stdin already in use */ MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("\tSPM OPTIONS\t\tORIG FILE: %s\n",fi->ifname); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("\n\tThe origin values must be an Int16 value"); MdcPrntScrn("\n\tThere is NO check performed on the input!\n"); MdcPrntScrn("\n\tOrigin X [%d]? ",opt->origin_x); if (!MdcPutDefault(mdcbufr)) opt->origin_x = (Int16)atoi(mdcbufr); MdcPrntScrn("\n\tOrigin Y [%d]? ",opt->origin_y); if (!MdcPutDefault(mdcbufr)) opt->origin_y = (Int16)atoi(mdcbufr); MdcPrntScrn("\n\tOrigin Z [%d]? ",opt->origin_z); if (!MdcPutDefault(mdcbufr)) opt->origin_z = (Int16)atoi(mdcbufr); /* MARK: skip asking about offset */ /* MdcPrntScrn("\n\tOffset [%+e]? ",opt->offset); */ /* if (!MdcPutDefault(mdcbufr)) opt->offset = (float)atof(mdcbufr); */ MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); } const char *MdcWriteANLZ(FILEINFO *fi) { MDC_SPMOPT *opt = &spmopt; char tmpfname[MDC_MAX_PATH + 1]; const char *msg; MDC_FILE_ENDIAN = MDC_WRITE_ENDIAN; /* user wanted to supply some parameters */ if ((MDC_ANLZ_OPTIONS == MDC_YES) && (XMDC_GUI == MDC_NO)) { MdcGetSpmOpt(fi,opt); }else { /* set default origin to image centre of middle slice */ opt->origin_x = (Int16)((fi->dim[1] + 1)/2); opt->origin_y = (Int16)((fi->dim[2] + 1)/2); opt->origin_z = (Int16)((fi->dim[3] + 1)/2); opt->offset = 0.; } /* header and image separate, rescaled stuff very important */ /* so we will write the images first ! */ /* get filename: no longer with truncation */ /* SPM, PMOD etc don't rely on db_name[18]) */ if (XMDC_GUI == MDC_YES) { strcpy(tmpfname,fi->opath); }else{ if (MDC_ALIAS_NAME == MDC_YES) { MdcAliasName(fi,tmpfname); }else{ strcpy(tmpfname,fi->ifname); } MdcDefaultName(fi,MDC_FRMT_ANLZ,fi->ofname,tmpfname); } if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Writing Analyze:"); if (MDC_VERBOSE) MdcPrntMesg("ANLZ Writing <%s> & <.img> ...",fi->ofname); /* writing images */ if (XMDC_GUI == MDC_YES) { fi->ofname[0]='\0'; MdcNewExt(fi->ofname,tmpfname,"img"); }else{ MdcNewName(fi->ofname,tmpfname,"img"); } if (MDC_FILE_STDOUT == MDC_YES) { /* send image data to stdout (1>stdout) */ fi->ofp = stdout; }else{ if (MdcKeepFile(fi->ofname)) return("ANLZ Image file exists!!"); if ( (fi->ofp=fopen(fi->ofname,"wb")) == NULL ) return ("ANLZ Couldn't open image file"); } msg = MdcWriteImagesData(fi); if (msg != NULL) return(msg); MdcCloseFile(fi->ofp); /* writing header with rescaled stuff */ if (XMDC_GUI == MDC_YES) { strcpy(fi->ofname,tmpfname); }else{ MdcDefaultName(fi,MDC_FRMT_ANLZ,fi->ofname,tmpfname); } if (MDC_FILE_STDOUT == MDC_YES) { /* send header to stderr (2>stderr) */ fi->ofp = stderr; }else{ if (MdcKeepFile(fi->ofname)) return("ANLZ Header file exists!!"); if ( (fi->ofp=fopen(fi->ofname,"wb")) == NULL ) return("ANLZ Couldn't open header file"); } if ( !MdcWriteHeaderKey(fi) ) return("ANLZ Bad write HeaderKey struct"); if ( !MdcWriteImageDimension(fi, opt) ) return("ANLZ Bad write ImageDimension struct"); if ( !MdcWriteDataHistory(fi, opt) ) return("ANLZ Bad write DataHistory struct"); MdcCheckQuantitation(fi); MdcCloseFile(fi->ofp); return(NULL); } xmedcon-0.14.1/source/m-rslice.c0000644000175000017510000004264212636253502013347 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-rslice.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : reslice in different projections * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcGetImageProjection() - Retrieve image projection * * MdcGetNewPatSliceOrient() - Get new patient slice orient * * MdcCheckReslice() - Check before reslicing * * MdcResliceImages() - Reslice image (tra,cor,sag) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-rslice.c,v 1.36 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "medcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_VOLUME_REQUIRED 10 /* minimum slices considered viewable */ /**************************************************************************** F U N C T I O N S ****************************************************************************/ Int8 MdcGetSliceProjection(FILEINFO *cur) { Int8 slice_projection = cur->slice_projection; if (cur->slice_projection == MDC_UNKNOWN) { switch (cur->pat_slice_orient) { case MDC_SUPINE_HEADFIRST_TRANSAXIAL : case MDC_SUPINE_FEETFIRST_TRANSAXIAL : case MDC_PRONE_HEADFIRST_TRANSAXIAL : case MDC_PRONE_FEETFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL : case MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL : case MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL : slice_projection = MDC_TRANSAXIAL; break; case MDC_SUPINE_HEADFIRST_SAGITTAL : case MDC_SUPINE_FEETFIRST_SAGITTAL : case MDC_PRONE_HEADFIRST_SAGITTAL : case MDC_PRONE_FEETFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL : case MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL : case MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL : slice_projection = MDC_SAGITTAL; break; case MDC_SUPINE_HEADFIRST_CORONAL : case MDC_SUPINE_FEETFIRST_CORONAL : case MDC_PRONE_HEADFIRST_CORONAL : case MDC_PRONE_FEETFIRST_CORONAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL : case MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL : case MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL : slice_projection = MDC_CORONAL; break; default: slice_projection = MDC_TRANSAXIAL; } } return(slice_projection); } Int8 MdcGetNewPatSliceOrient(FILEINFO *cur, Int8 newproj) { Int8 pat_slice_orient=MDC_UNKNOWN; switch (cur->pat_slice_orient) { case MDC_SUPINE_HEADFIRST_TRANSAXIAL : case MDC_SUPINE_HEADFIRST_SAGITTAL : case MDC_SUPINE_HEADFIRST_CORONAL : switch (newproj) { case MDC_TRANSAXIAL : pat_slice_orient = MDC_SUPINE_HEADFIRST_TRANSAXIAL; break; case MDC_SAGITTAL : pat_slice_orient = MDC_SUPINE_HEADFIRST_SAGITTAL; break; case MDC_CORONAL : pat_slice_orient = MDC_SUPINE_HEADFIRST_CORONAL; break; } break; case MDC_PRONE_HEADFIRST_TRANSAXIAL : case MDC_PRONE_HEADFIRST_SAGITTAL : case MDC_PRONE_HEADFIRST_CORONAL : switch (newproj) { case MDC_TRANSAXIAL: pat_slice_orient = MDC_PRONE_HEADFIRST_TRANSAXIAL; break; case MDC_SAGITTAL : pat_slice_orient = MDC_PRONE_HEADFIRST_SAGITTAL; break; case MDC_CORONAL : pat_slice_orient = MDC_PRONE_HEADFIRST_CORONAL; break; } break; case MDC_SUPINE_FEETFIRST_TRANSAXIAL : case MDC_SUPINE_FEETFIRST_SAGITTAL : case MDC_SUPINE_FEETFIRST_CORONAL : switch (newproj) { case MDC_TRANSAXIAL : pat_slice_orient = MDC_SUPINE_FEETFIRST_TRANSAXIAL; break; case MDC_SAGITTAL : pat_slice_orient = MDC_SUPINE_FEETFIRST_SAGITTAL; break; case MDC_CORONAL : pat_slice_orient = MDC_SUPINE_FEETFIRST_CORONAL; break; } break; case MDC_PRONE_FEETFIRST_TRANSAXIAL : case MDC_PRONE_FEETFIRST_SAGITTAL : case MDC_PRONE_FEETFIRST_CORONAL : switch (newproj) { case MDC_TRANSAXIAL : pat_slice_orient = MDC_PRONE_FEETFIRST_TRANSAXIAL; break; case MDC_SAGITTAL : pat_slice_orient = MDC_PRONE_FEETFIRST_SAGITTAL; break; case MDC_CORONAL : pat_slice_orient = MDC_PRONE_FEETFIRST_CORONAL; break; } break; case MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL : switch (newproj) { case MDC_TRANSAXIAL : pat_slice_orient = MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL; break; case MDC_SAGITTAL : pat_slice_orient = MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL; break; case MDC_CORONAL : pat_slice_orient = MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL; break; } break; case MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL : case MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL : case MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL : switch (newproj) { case MDC_TRANSAXIAL: pat_slice_orient = MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL; break; case MDC_SAGITTAL : pat_slice_orient = MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL; break; case MDC_CORONAL : pat_slice_orient = MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL; break; } break; case MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL : switch (newproj) { case MDC_TRANSAXIAL : pat_slice_orient = MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL; break; case MDC_SAGITTAL : pat_slice_orient = MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL; break; case MDC_CORONAL : pat_slice_orient = MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL; break; } break; case MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL : case MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL : case MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL : switch (newproj) { case MDC_TRANSAXIAL : pat_slice_orient = MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL; break; case MDC_SAGITTAL : pat_slice_orient = MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL; break; case MDC_CORONAL : pat_slice_orient = MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL; break; } break; } return(pat_slice_orient); } char *MdcCheckReslice(FILEINFO *cur, Int8 newproj) { Int8 curproj; curproj = MdcGetSliceProjection(cur); /* some sanity checks before allowing reslicing */ if (cur->planar == MDC_YES) { strcpy(mdcbufr,"Planar study inappropriate"); return(mdcbufr); } /* don't fail in a batched job */ if (XMDC_GUI == MDC_YES) { if (newproj == curproj) { switch (curproj) { case MDC_TRANSAXIAL : sprintf(mdcbufr,"Already in XY - TRANSVERSE projection"); break; case MDC_SAGITTAL : sprintf(mdcbufr,"Already in YZ - SAGITTAL projection"); break; case MDC_CORONAL : sprintf(mdcbufr,"Already in XZ - CORONAL projection"); break; } return(mdcbufr); } } if (curproj == MDC_UNKNOWN) { strcpy(mdcbufr,"Current projection unknown"); return(mdcbufr); } if (cur->diff_type == MDC_YES) { strcpy(mdcbufr,"Identical pixel types required"); return(mdcbufr); } if (cur->diff_size == MDC_YES) { strcpy(mdcbufr,"Identical image sizes required"); return(mdcbufr); } if (cur->dim[3] <= 2) { strcpy(mdcbufr,"No volume detected"); return(mdcbufr); } if (cur->dim[3] <= MDC_VOLUME_REQUIRED) { strcpy(mdcbufr,"Volume too small"); return(mdcbufr); } if (cur->reconstructed == MDC_NO) { strcpy(mdcbufr,"Reconstructed data required"); return(mdcbufr); } return(NULL); } /* X, Y, Z: the true indices for x,y,z in our arrays */ /* OX, OY, OZ: old dim = new dim (do the reslice) */ /* DX, DY, DZ: new dim = old dim (get the sizes ) */ char *MdcResliceImages(FILEINFO *cur, Int8 newproj) { FILEINFO *new; IMG_DATA *newid, *curid; Uint32 nbytes, obytes, pixels, olength; Uint32 newX, newY, newZ, curX=0, curY=0, curZ=0, f, frames; Uint32 X=1, Y=2, Z=3, OX=X, OY=Y, OZ=Z, DX=X, DY=Y, DZ=Z; Uint8 *newp, *curp; Int8 curproj; double pixval; char *msg; curproj = MdcGetSliceProjection(cur); /* some sanity checks before doing reslice */ msg = MdcCheckReslice(cur,newproj); if (msg != NULL) return(msg); /* get temporary FILEINFO structure */ new = (FILEINFO *)malloc(sizeof(FILEINFO)); if (new == NULL) return("Couldn't malloc FILEINFO struct"); MdcCopyFI(new,cur,MDC_NO,MDC_YES); /* change orientation information */ new->pat_slice_orient = MdcGetNewPatSliceOrient(cur,newproj); strcpy(new->pat_orient,MdcGetStrPatOrient(new->pat_slice_orient)); /* prepare dimension mappings */ switch (newproj) { case MDC_TRANSAXIAL : switch (curproj) { case MDC_TRANSAXIAL : OX=X; OY=Y; OZ=Z; /* T -> T (===) */ DX=X; DY=Y; DZ=Z; break; case MDC_SAGITTAL : OX=Y; OY=Z; OZ=X; /* S -> T (sag) */ DX=Z; DY=X; DZ=Y; break; case MDC_CORONAL : OX=X; OY=Z; OZ=Y; /* C -> T (cor) */ DX=X; DY=Z; DZ=Y; break; } break; case MDC_SAGITTAL : switch (curproj) { case MDC_TRANSAXIAL : OX=Z; OY=X; OZ=Y; /* T -> S (sag) */ DX=Y; DY=Z; DZ=X; break; case MDC_SAGITTAL : OX=X; OY=Y; OZ=Z; /* S -> S (===) */ DX=X; DY=Y; DZ=Z; break; case MDC_CORONAL : OX=Z; OY=Y; OZ=X; /* C -> S (c2s) */ DX=Z; DY=Y; DZ=X; break; } break; case MDC_CORONAL : switch (curproj) { case MDC_TRANSAXIAL : OX=X; OY=Z; OZ=Y; /* T -> C (cor) */ DX=X; DY=Z; DZ=Y; break; case MDC_SAGITTAL : OX=Z; OY=Y; OZ=X; /* S -> C (s2c) */ DX=Z; DY=Y; DZ=X; break; case MDC_CORONAL : OX=X; OY=Y; OZ=Z; /* C -> C (===) */ DX=X; DY=Y; DZ=Z; break; } break; } /* first remove gaps between slices */ cur->pixdim[Z] = cur->image[0].slice_spacing; /* number of frames stay the same */ new->dim[0] = cur->dim[0]; for (frames=1, f=4; f<=cur->dim[0]; f++) { frames *= cur->dim[f]; new->dim[f] = cur->dim[f]; } new->pixdim[0] = cur->pixdim[0]; for (f=4; f<=cur->pixdim[0]; f++) new->pixdim[f] = cur->pixdim[f]; /* fill in new dimension values */ if (OX == 3) new->number = cur->dim[X] * frames; else if (OY == 3) new->number = cur->dim[Y] * frames; else if (OZ == 3) new->number = cur->dim[Z] * frames; new->dim[X] = cur->dim[DX]; new->pixdim[X] = cur->pixdim[DX]; new->dim[Y] = cur->dim[DY]; new->pixdim[Y] = cur->pixdim[DY]; new->dim[Z] = cur->dim[DZ]; new->pixdim[Z] = cur->pixdim[DZ]; new->mwidth = new->dim[X]; new->mheight = new->dim[Y]; /* handle pixel stuff */ if (MDC_QUANTIFY || MDC_CALIBRATE) { new->type = FLT32; new->bits = MdcType2Bits(new->type); }else{ new->type = cur->type; new->bits = cur->bits; } pixels = new->dim[X] * new->dim[Y]; obytes = MdcType2Bytes(cur->type); nbytes = MdcType2Bytes(new->type); /* get new IMG_DATA structs */ if (!MdcGetStructID(new,new->number)) { MdcCleanUpFI(new); return("Couldn't malloc IMG_DATA structs"); } /* reslice images and fill in structures */ olength = cur->dim[X]; for (f=0; fdim[Z]; newZ++) { newid = &new->image[newZ + (f * new->dim[Z])]; newid->buf = MdcGetImgBuffer(pixels * nbytes); if (newid->buf == NULL) { MdcCleanUpFI(new); return("Couldn't malloc image buffer"); } newp = newid->buf; newid->width = new->mwidth; newid->height= new->mheight; newid->bits = new->bits; newid->type = new->type; newid->pixel_xsize = new->pixdim[X]; newid->pixel_ysize = new->pixdim[Y]; newid->slice_width = new->pixdim[Z]; newid->slice_spacing= new->pixdim[Z]; MdcFillImgPos(new,newZ,newZ,0.); MdcFillImgOrient(new,newZ); for (newY=0; newYdim[Y]; newY++) { for (newX=0; newXdim[X]; newX++) { /* X-mapping */ if (OX == X) curX = newX; else if (OX == Y) curX = newY; else if (OX == Z) curX = newZ; /* Y-mapping */ if (OY == X) curY = newX; else if (OY == Y) curY = newY; else if (OY == Z) curY = newZ; /* Z-mapping */ if (OZ == X) curZ = newX; else if (OZ == Y) curZ = newY; else if (OZ == Z) curZ = newZ; curid = &cur->image[curZ + (f * cur->dim[Z])]; curp = curid->buf + (((curY * olength) + curX) * obytes); if (MDC_QUANTIFY || MDC_CALIBRATE) { pixval = MdcGetDoublePixel(curp,curid->type); pixval *= (double)curid->rescale_slope; pixval += (double)curid->rescale_intercept; MdcPutDoublePixel(newp,pixval,newid->type); }else{ memcpy(newp,curp,nbytes); } newp += nbytes; } } } if (cur->acquisition_type == MDC_ACQUISITION_GATED || cur->acquisition_type == MDC_ACQUISITION_GSPECT) { /* alter a gated parameter to keep things in line */ /* through different reslices: based on HeartRate */ /* since this depends on number of images per frame */ if (cur->gdata != NULL && new->gdata != NULL) { new->gdata[0].time_per_proj = cur->gdata[0].time_per_proj; new->gdata[0].time_per_proj *= (float)cur->dim[Z]; new->gdata[0].time_per_proj /= (float)new->dim[Z]; } } if (cur->acquisition_type == MDC_ACQUISITION_TOMO || cur->acquisition_type == MDC_ACQUISITION_DYNAMIC) { /* Just fix nr_of_slices for each DYNAMIC_DATA struct. */ /* All other entries can be preserved for tomo study. */ for (f=0; fdynnr; f++) new->dyndata[f].nr_of_slices = new->dim[3]; } /* set new slice projection */ new->slice_projection = newproj; /* check integrity */ if ((msg = MdcImagesPixelFiddle(new)) != NULL) { MdcCleanUpFI(new); MdcFree(new) return(msg); } /* remove cur */ MdcCleanUpFI(cur); /* copy new -> cur */ MdcCopyFI(cur,new,MDC_NO,MDC_YES); /* just rehang image pointer */ cur->number= new->number; cur->image = new->image; /* and mask new image pointer */ new->number = 0; new->image = NULL; /* now safely remove new */ MdcCleanUpFI(new); MdcFree(new); return(NULL); } xmedcon-0.14.1/source/xmnuftry.h0000644000175000017510000000354412636253502013533 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xmnuftry.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xmnuftry.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xmnuftry.h,v 1.16 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XMNUFTRY_H__ #define __XMNUFTRY_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcMenusGetMain(GtkWidget *window, GtkWidget **menubar); #endif xmedcon-0.14.1/source/xviewer.h0000644000175000017510000000402212636253503013321 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xviewer.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xviewer.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xviewer.h,v 1.16 2015/12/22 13:59:31 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XVIEWER_H__ #define __XVIEWER_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ int XMdcGetBoardDimensions(void); void XMdcHandleBoardDimensions(void); void XMdcBuildViewerWindow(void); void XMdcViewerHide(void); void XMdcViewerShow(void); void XMdcViewerEnableAutoShrink(void); void XMdcViewerDisableAutoShrink(void); #endif xmedcon-0.14.1/source/m-debug.c0000644000175000017510000005136512636253502013156 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-debug.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : print FILEINFO structure * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcPrintFI() - Display FILEINFO struct * * MdcDebugPrint() - Print MDC_MY_DEBUG info * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-debug.c,v 1.74 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include #include #include "m-defs.h" #include "m-fancy.h" #include "m-files.h" #include "m-debug.h" #if GLIBSUPPORTED #include #endif /**************************************************************************** F U N C T I O N S ****************************************************************************/ void MdcPrintFI(FILEINFO *fi) { Uint32 i, j; int v; float f; IMG_DATA *id; MdcPrntScrn("\n"); MdcPrintLine('#',MDC_FULL_LENGTH); MdcPrntScrn("FILEINFO - Global Data\n"); MdcPrintLine('#',MDC_FULL_LENGTH); MdcPrntScrn("FILE *ifp : "); if (fi->ifp == NULL) MdcPrntScrn("\n"); else MdcPrntScrn("%p\n",fi->ifp); MdcPrntScrn("FILE *ofp : "); if (fi->ofp == NULL) MdcPrntScrn("\n"); else MdcPrntScrn("%p\n",fi->ofp); MdcPrntScrn("ipath : %s\n",fi->ipath); MdcPrntScrn("opath : %s\n",fi->opath); if (fi->idir == NULL) MdcPrntScrn("idir : \n"); else MdcPrntScrn("idir : %s\n",fi->idir); if (fi->odir == NULL) MdcPrntScrn("odir : \n"); else MdcPrntScrn("odir : %s\n",fi->odir); MdcPrntScrn("ifname : %s\n",fi->ifname); MdcPrntScrn("ofname : %s\n",fi->ofname); MdcPrntScrn("iformat : %d (= %s)\n",fi->iformat ,FrmtString[fi->iformat]); MdcPrntScrn("oformat : %d (= %s)\n",fi->oformat ,FrmtString[fi->oformat]); MdcPrntScrn("modality : %d (= %s)\n",fi->modality ,MdcGetStrModality(fi->modality)); v = (int)fi->rawconv; MdcPrntScrn("rawconv : %d (= %s)\n",v,MdcGetStrRawConv(v)); v = (int)fi->endian; MdcPrntScrn("endian : %d (= %s)\n",v,MdcGetStrEndian(v)); v = (int)fi->compression; MdcPrntScrn("compression : %d (= %s)\n",v,MdcGetStrCompression(v)); MdcPrntScrn("truncated : %d ",fi->truncated); MdcPrintYesNo(fi->truncated); MdcPrntScrn("diff_type : %d ",fi->diff_type); MdcPrintYesNo(fi->diff_type); MdcPrntScrn("diff_size : %d ",fi->diff_size); MdcPrintYesNo(fi->diff_size); MdcPrntScrn("diff_scale : %d ",fi->diff_scale); MdcPrintYesNo(fi->diff_scale); MdcPrntScrn("number : %u\n",fi->number); MdcPrntScrn("mwidth : %u\n",fi->mwidth); MdcPrntScrn("mheight : %u\n",fi->mheight); MdcPrntScrn("bits : %hu\n",fi->bits); v = (int)fi->type; MdcPrntScrn("type : %d (= %s)\n",v,MdcGetStrPixelType(v)); MdcPrntScrn("dim[0] : %-5hd (= total in use)\n",fi->dim[0]); MdcPrntScrn("dim[1] : %-5hd (= pixels X-dim)\n",fi->dim[1]); MdcPrntScrn("dim[2] : %-5hd (= pixels Y-dim)\n",fi->dim[2]); MdcPrntScrn("dim[3] : %-5hd (= planes | (time) slices)\n" ,fi->dim[3]); MdcPrntScrn("dim[4] : %-5hd (= frames | time slots | phases)\n" ,fi->dim[4]); MdcPrntScrn("dim[5] : %-5hd (= gates | R-R intervals)\n" ,fi->dim[5]); MdcPrntScrn("dim[6] : %-5hd (= beds | detector heads)\n" ,fi->dim[6]); MdcPrntScrn("dim[7] : %-5hd (= ... | energy windows)\n" ,fi->dim[7]); MdcPrntScrn("pixdim[0] : %+e\n",fi->pixdim[0]); MdcPrntScrn("pixdim[1] : %+e [mm]\n",fi->pixdim[1]); MdcPrntScrn("pixdim[2] : %+e [mm]\n",fi->pixdim[2]); MdcPrntScrn("pixdim[3] : %+e [mm]\n",fi->pixdim[3]); for (i=4; ipixdim[i]); MdcPrntScrn("glmin : %+e\n",fi->glmin); MdcPrntScrn("glmax : %+e\n",fi->glmax); MdcPrntScrn("qglmin : %+e\n",fi->qglmin); MdcPrntScrn("qglmax : %+e\n",fi->qglmax); MdcPrntScrn("contrast_remapped : %hd ",fi->contrast_remapped); MdcPrintYesNo(fi->contrast_remapped); MdcPrntScrn("window_centre : %g\n",fi->window_centre); MdcPrntScrn("window_width : %g\n",fi->window_width); MdcPrntScrn("slice_projection : %d (= %s)\n",fi->slice_projection, MdcGetStrSlProjection(fi->slice_projection)); MdcPrntScrn("pat_slice_orient : %d (= %s)\n",fi->pat_slice_orient, MdcGetStrPatSlOrient(fi->pat_slice_orient)); MdcPrntScrn("pat_pos : %s\n",fi->pat_pos); MdcPrntScrn("pat_orient : %s\n",fi->pat_orient); MdcPrntScrn("patient_sex : %s\n",fi->patient_sex); MdcPrntScrn("patient_name : %s\n",fi->patient_name); MdcPrntScrn("patient_id : %s\n",fi->patient_id); MdcPrntScrn("patient_dob : %s\n",fi->patient_dob); MdcPrntScrn("patient_weight : %.2f [kg]\n",fi->patient_weight); MdcPrntScrn("patient_height : %.2f [m]\n",fi->patient_height); MdcPrntScrn("operator_name : %s\n",fi->operator_name); MdcPrntScrn("study_descr : %s\n",fi->study_descr); MdcPrntScrn("study_id : %s\n",fi->study_id); MdcPrntScrn("study_date_year : %02d\n",fi->study_date_year); MdcPrntScrn("study_date_month : %02d\n",fi->study_date_month); MdcPrntScrn("study_date_day : %02d\n",fi->study_date_day); MdcPrntScrn("study_time_hour : %02d\n",fi->study_time_hour); MdcPrntScrn("study_time_minute : %02d\n",fi->study_time_minute); MdcPrntScrn("study_time_second : %02d\n",fi->study_time_second); MdcPrntScrn("dose_time_hour : %02d\n",fi->dose_time_hour); MdcPrntScrn("dose_time_minute : %02d\n",fi->dose_time_minute); MdcPrntScrn("dose_time_second : %02d\n",fi->dose_time_second); MdcPrntScrn("nr_series : %-10d ",fi->nr_series); if (fi->nr_series < 0) MdcPrintYesNo(MDC_NO); else MdcPrintYesNo(MDC_YES); MdcPrntScrn("nr_acquisition : %-10d ",fi->nr_acquisition); if (fi->nr_acquisition < 0) MdcPrintYesNo(MDC_NO); else MdcPrintYesNo(MDC_YES); MdcPrntScrn("nr_instance : %-10d ",fi->nr_instance); if (fi->nr_instance < 0) MdcPrintYesNo(MDC_NO); else MdcPrintYesNo(MDC_YES); v = fi->acquisition_type; MdcPrntScrn("acquisition_type : %d (= %s)\n",v,MdcGetStrAcquisition(v)); MdcPrntScrn("planar : %d ",fi->planar); MdcPrintYesNo(fi->planar); MdcPrntScrn("decay_corrected : %d ",fi->decay_corrected); MdcPrintYesNo(fi->decay_corrected); MdcPrntScrn("flood_corrected : %d ",fi->flood_corrected); MdcPrintYesNo(fi->flood_corrected); MdcPrntScrn("reconstructed : %d ",fi->reconstructed); MdcPrintYesNo(fi->reconstructed); MdcPrntScrn("recon_method : %s\n",fi->recon_method); MdcPrntScrn("institution : %s\n",fi->institution); MdcPrntScrn("manufacturer : %s\n",fi->manufacturer); MdcPrntScrn("series_descr : %s\n",fi->series_descr); MdcPrntScrn("radiopharma : %s\n",fi->radiopharma); MdcPrntScrn("filter_type : %s\n",fi->filter_type); MdcPrntScrn("organ_code : %s\n",fi->organ_code); MdcPrntScrn("isotope_code : %s\n",fi->isotope_code); MdcPrntScrn("isotope_halflife : %+e [sec] or %g [hrs]\n" ,fi->isotope_halflife ,fi->isotope_halflife/3600.); MdcPrntScrn("injected_dose : %+e [MBq]\n",fi->injected_dose); MdcPrntScrn("gantry_tilt : %+e [degrees]\n",fi->gantry_tilt); v = (int) fi->map; MdcPrntScrn("map : %u (= %s)\n",v,MdcGetStrColorMap(v)); MdcPrntScrn("comm_length : %u\n",fi->comm_length); MdcPrntScrn("comment : "); if ((fi->comment != NULL) && (fi->comm_length != 0)) { for (i=0; icomm_length; i++) MdcPrntScrn("%c",fi->comment[i]); }else{ MdcPrntScrn(""); } MdcPrntScrn("\n"); /* GATED DATA */ MdcPrntScrn("\ngatednr : %u\n",fi->gatednr); if (fi->gdata != NULL) { for (i=0; i < fi->gatednr; i++) { GATED_DATA *gd = &fi->gdata[i]; MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("FILEINFO - Gated (SPECT) Data #%.3u\n",i+1); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("gspect_nesting : %d (= %s)\n",gd->gspect_nesting ,MdcGetStrGSpectNesting(gd->gspect_nesting)); MdcPrntScrn("nr_projections : %g\n",gd->nr_projections); MdcPrntScrn("extent_rotation : %g\n",gd->extent_rotation); MdcPrntScrn("study_duration : %+e [ms] = %s\n" ,gd->study_duration,MdcGetStrHHMMSS(gd->study_duration)); MdcPrntScrn("image_duration : %+e [ms] = %s\n" ,gd->image_duration,MdcGetStrHHMMSS(gd->image_duration)); MdcPrntScrn("time_per_proj : %+e [ms] = %s\n" ,gd->time_per_proj,MdcGetStrHHMMSS(gd->time_per_proj)); MdcPrntScrn("window_low : %+e [ms] = %s\n" ,gd->window_low,MdcGetStrHHMMSS(gd->window_low)); MdcPrntScrn("window_high : %+e [ms] = %s\n" ,gd->window_high,MdcGetStrHHMMSS(gd->window_high)); MdcPrntScrn("cycles_observed : %+e\n",gd->cycles_observed); MdcPrntScrn("cycles_acquired : %+e\n\n",gd->cycles_acquired); MdcPrntScrn("heart rate (observed): %d [bpm] (auto-filled)\n" ,(int)MdcGetHeartRate(gd,MDC_HEART_RATE_OBSERVED)); MdcPrntScrn("heart rate (acquired): %d [bpm] (auto-filled)\n" ,(int)MdcGetHeartRate(gd,MDC_HEART_RATE_ACQUIRED)); } }else{ MdcPrntScrn("gdata : \n"); } /* ACQUISITION DATA */ MdcPrntScrn("\nacqnr : %u\n",fi->acqnr); if (fi->acqdata != NULL) { for (i=0; i < fi->acqnr; i++) { ACQ_DATA *acq = &fi->acqdata[i]; MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("FILEINFO - Acquisition Data #%.3u\n",i+1); MdcPrintLine('-',MDC_FULL_LENGTH); v = acq->rotation_direction; MdcPrntScrn("rotation_direction : %d (= %s)\n",v,MdcGetStrRotation(v)); v = acq->detector_motion; MdcPrntScrn("detector_motion : %d (= %s)\n",v,MdcGetStrMotion(v)); MdcPrntScrn("rotation_offset : %g [mm]\n",acq->rotation_offset); MdcPrntScrn("radial_position : %g [mm]\n",acq->radial_position); MdcPrntScrn("angle_start : %g [degrees]\n",acq->angle_start); MdcPrntScrn("angle_step : %g [degrees]\n",acq->angle_step); MdcPrntScrn("scan_arc : %g [degrees]\n",acq->scan_arc); } }else{ MdcPrntScrn("acqdata : \n"); } /* DYNAMIC DATA */ MdcPrntScrn("\ndynnr : %u\n",fi->dynnr); if (fi->dyndata != NULL) { for (i=0; i < fi->dynnr; i++) { DYNAMIC_DATA *dd = &fi->dyndata[i]; MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("FILEINFO - Dynamic Data #%.3u\n",i+1); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("number of slices : %u\n",dd->nr_of_slices); MdcPrntScrn("time_frame_start : %+e [ms] = %s\n" ,dd->time_frame_start,MdcGetStrHHMMSS(dd->time_frame_start)); MdcPrntScrn("time_frame_delay : %+e [ms] = %s\n" ,dd->time_frame_delay,MdcGetStrHHMMSS(dd->time_frame_delay)); MdcPrntScrn("time_frame_duration: %+e [ms] = %s\n" ,dd->time_frame_duration,MdcGetStrHHMMSS(dd->time_frame_duration)); MdcPrntScrn("delay_slices : %+e [ms] = %s\n" ,dd->delay_slices,MdcGetStrHHMMSS(dd->delay_slices)); } }else{ MdcPrntScrn("dyndata : \n"); } /* BED DATA */ MdcPrntScrn("\nbednr : %u\n",fi->bednr); if (fi->beddata != NULL) { for (i=0; i < fi->bednr; i++) { BED_DATA *bd = &fi->beddata[i]; MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("FILEINFO - Bed Data #%.3u\n",i+1); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("hoffset : %+e [mm]\n" ,bd->hoffset); MdcPrntScrn("voffset : %+e [mm]\n" ,bd->voffset); } }else{ MdcPrntScrn("beddata : \n"); } /* IMAGE DATA */ for (i=0; inumber; i++) { id = &fi->image[i]; MdcPrntScrn("\n"); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("FILEINFO - Image Data #%.3u\n",i+1); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("width : %u\n",id->width); MdcPrntScrn("height : %u\n",id->height); MdcPrntScrn("bits : %hd\n",id->bits); MdcPrntScrn("type : %hd (= %s)\n",id->type ,MdcGetStrPixelType(id->type)); MdcPrntScrn("flags : 0x%x\n",id->flags); MdcPrntScrn("min : %+e\n",id->min); MdcPrntScrn("max : %+e\n",id->max); MdcPrntScrn("qmin : %+e\n",id->qmin); MdcPrntScrn("qmax : %+e\n",id->qmax); MdcPrntScrn("fmin : %+e\n",id->fmin); MdcPrntScrn("fmax : %+e\n",id->fmax); MdcPrntScrn("qfmin : %+e\n",id->qfmin); MdcPrntScrn("qfmax : %+e\n",id->qfmax); MdcPrntScrn("rescale_slope : %+e\n",id->rescale_slope); MdcPrntScrn("rescale_intercept : %+e\n",id->rescale_intercept); MdcPrntScrn("frame_number : %u\n",id->frame_number); MdcPrntScrn("slice_start : %+e [ms] = %s\n" ,id->slice_start,MdcGetStrHHMMSS(id->slice_start)); f = MdcSingleImageDuration(fi,id->frame_number-1); MdcPrntScrn("slice_duration : %+e [ms] = %s (auto-filled)\n" ,f,MdcGetStrHHMMSS(f)); MdcPrntScrn("rescaled : %d ",id->rescaled); MdcPrintYesNo(id->rescaled); MdcPrntScrn("rescaled_min : %+e\n",id->rescaled_min); MdcPrntScrn("rescaled_max : %+e\n",id->rescaled_max); MdcPrntScrn("rescaled_fctr : %+e\n",id->rescaled_fctr); MdcPrntScrn("rescaled_slope : %+e\n",id->rescaled_slope); MdcPrntScrn("rescaled_intercept : %+e\n",id->rescaled_intercept); MdcPrntScrn("buf : %p\n",id->buf); MdcPrntScrn("load_location : %ld\n",id->load_location); MdcPrntScrn("quant_units : %hd\n",id->quant_units); MdcPrntScrn("calibr_units : %hd\n",id->calibr_units); MdcPrntScrn("quant_scale : %+e\n",id->quant_scale); MdcPrntScrn("calibr_fctr : %+e\n",id->calibr_fctr); MdcPrntScrn("intercept : %+e\n",id->intercept); MdcPrntScrn("pixel_xsize : %+e [mm]\n",id->pixel_xsize); MdcPrntScrn("pixel_ysize : %+e [mm]\n",id->pixel_ysize); MdcPrntScrn("slice_width : %+e [mm]\n",id->slice_width); MdcPrntScrn("recon_scale : %+e\n",id->recon_scale); for (j=0; j<3; j++) MdcPrntScrn("image_pos_dev[%u] : %+e [mm]\n",j ,id->image_pos_dev[j]); for (j=0; j<3; j++) MdcPrntScrn("image_pos_pat[%u] : %+e [mm]\n",j ,id->image_pos_pat[j]); for (j=0; j<6; j++) MdcPrntScrn("image_orient_dev[%u]: %+e [mm]\n",j ,id->image_orient_dev[j]); for (j=0; j<6; j++) MdcPrntScrn("image_orient_pat[%u]: %+e [mm]\n",j ,id->image_orient_pat[j]); MdcPrntScrn("slice_spacing : %+e [mm]\n",id->slice_spacing); MdcPrntScrn("ct_zoom_fctr : %+e\n",id->ct_zoom_fctr); if (id->sdata != NULL) { STATIC_DATA *sd = id->sdata; MdcPrntScrn("\n"); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("FILEINFO - Static Data #%.3u\n",i+1); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("label : %s\n",sd->label); MdcPrntScrn("total_counts : %g\n",sd->total_counts); MdcPrntScrn("image_duration : %+e [ms] = %s\n" ,sd->image_duration,MdcGetStrHHMMSS(sd->image_duration)); MdcPrntScrn("start_time_hour : %02hd\n",sd->start_time_hour); MdcPrntScrn("start_time_minute : %02hd\n",sd->start_time_minute); MdcPrntScrn("start_time_second : %02hd\n",sd->start_time_second); MdcPrintLine('-',MDC_HALF_LENGTH); } } /* DICOM MOD */ if (fi->mod != NULL) { GN_INFO *gn = &fi->mod->gn_info; MR_INFO *mr = &fi->mod->mr_info; MdcPrntScrn("\n"); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("FILEINFO - DICOM General Info\n"); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("study_date : %s\n",gn->study_date); MdcPrntScrn("study_time : %s\n",gn->study_time); MdcPrntScrn("series_date : %s\n",gn->series_date); MdcPrntScrn("series_time : %s\n",gn->series_time); MdcPrntScrn("acquisition_date : %s\n",gn->acquisition_date); MdcPrntScrn("acquisition_time : %s\n",gn->acquisition_time); MdcPrntScrn("image_date : %s\n",gn->image_date); MdcPrntScrn("image_time : %s\n",gn->image_time); switch (fi->modality) { case M_MR: MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("FILEINFO - DICOM MR Modality Info\n"); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("repetition_time : %f\n",mr->repetition_time); MdcPrntScrn("echo_time : %g\n",mr->echo_time); MdcPrntScrn("inversion_time : %g\n",mr->inversion_time); MdcPrntScrn("num_averages : %g\n",mr->num_averages); MdcPrntScrn("imaging_freq : %f\n",mr->imaging_freq); MdcPrntScrn("pixel_bandwidth : %g\n",mr->pixel_bandwidth); MdcPrntScrn("flip_angle : %g\n",mr->flip_angle); MdcPrntScrn("dbdt : %g\n",mr->dbdt); MdcPrntScrn("transducer_freq : %u\n",mr->transducer_freq); MdcPrntScrn("transducer_type : %s\n",mr->transducer_type); MdcPrntScrn("pulse_repetition_freq : %u\n",mr->pulse_repetition_freq); MdcPrntScrn("pulse_seq_name : %s\n",mr->pulse_seq_name); MdcPrntScrn("steady_state_pulse_seq: %s\n",mr->steady_state_pulse_seq); MdcPrntScrn("slab_thickness : %g\n",mr->slab_thickness); MdcPrntScrn("sampling_freq : %g\n",mr->sampling_freq); break; } } } void MdcDebugPrint(char *fmt, ...) { va_list args; if (MDC_MY_DEBUG) { va_start(args,fmt); #if GLIBSUPPORTED g_logv(MDC_PRGR,G_LOG_LEVEL_DEBUG, fmt, args); #else fprintf(stdout,"\n%s: Debug : ",MDC_PRGR); vsprintf(mdcbufr, fmt, args); fprintf(stdout,"%s",mdcbufr); fflush(stdout); #endif va_end(args); } } xmedcon-0.14.1/source/m-algori.h0000644000175000017510000001016312636253501013340 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-algori.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-algori.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-algori.h,v 1.28 2015/12/22 13:59:29 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_ALGORI_H__ #define __M_ALGORI_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ #define MdcPixels2Bytes(n) ((n+7)/8) /* bits -> bytes */ #define MdcSWAP(x) MdcSwapBytes( (Uint8 *)&x, sizeof(x)) /* HOST <> FILE */ #define MdcGRAY(r,g,b) ( ((int)(r)*11 + (int)(g)*16 + (int)(b)*5) >> 5) #define MdcFree(p) { if (p!=NULL) free(p); p=NULL; } #define MdcMakeIEEEfl(a) MdcVAXfl_to_IEEEfl(&a) #define MdcMakeVAXfl(a) MdcIEEEfl_to_VAXfl(&a) #define MdcmCi2MBq(dose) (dose * 37.) /* mCi -> MBq */ #define MdcMBq2mCi(dose) (dose / 37.) /* MBq -> mCi */ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void *MdcRealloc(void *p, Uint32 bytes); Uint32 MdcCeilPwr2(Uint32 x); float MdcRotateAngle(float angle, float rotate); int MdcDoSwap(void); int MdcHostBig(void); void MdcSwapBytes(Uint8 *ptr, int bytes); void MdcForceSwap(Uint8 *ptr, int bytes); void MdcIEEEfl_to_VAXfl(float *f); void MdcVAXfl_to_IEEEfl(float *f); int MdcFixFloat(float *ref); int MdcFixDouble(double *ref); int MdcType2Bytes(int type); int MdcType2Bits(int type); double MdcTypeIntMax(int type); float MdcSingleImageDuration(FILEINFO *fi, Uint32 frame); char *MdcImagesPixelFiddle(FILEINFO *fi); double MdcGetDoublePixel(Uint8 *buf, int type); void MdcPutDoublePixel(Uint8 *buf, double pix, int type); int MdcDoSimpleCast(double minv, double maxv, double negmin, double posmax); Uint8 *MdcGetResizedImage(FILEINFO *fi,Uint8 *buffer,int type,Uint32 img); Uint8 *MdcGetDisplayImage(FILEINFO *fi, Uint32 img); Uint8 *MdcMakeBIT8_U(Uint8 *cbuf, FILEINFO *fi, Uint32 img); Uint8 *MdcGetImgBIT8_U(FILEINFO *fi, Uint32 img); Uint8 *MdcMakeBIT16_S(Uint8 *cbuf, FILEINFO *fi, Uint32 img); Uint8 *MdcGetImgBIT16_S(FILEINFO *fi, Uint32 img); Uint8 *MdcMakeBIT32_S(Uint8 *cbuf, FILEINFO *fi, Uint32 img); Uint8 *MdcGetImgBIT32_S(FILEINFO *fi, Uint32 img); Uint8 *MdcMakeFLT32(Uint8 *cbuf, FILEINFO *fi, Uint32 img); Uint8 *MdcGetImgFLT32(FILEINFO *fi, Uint32 img); Uint8 *MdcMakeImgSwapped(Uint8 *cbuf, FILEINFO *fi, Uint32 img, Uint32 width, Uint32 height, int type); Uint8 *MdcGetImgSwapped(FILEINFO *fi, Uint32 img); int MdcUnpackBIT12(FILEINFO *fi, Uint32 img); Uint32 MdcHashDJB2(unsigned char *str); Uint32 MdcHashSDBM(unsigned char *str); #endif xmedcon-0.14.1/source/xtransf.c0000644000175000017510000000617312636253502013320 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xtransf.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : simple images transformation routines * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcTransformImages() - Transform the images * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xtransf.c,v 1.21 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include #include "xmedcon.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcTransformImages(GtkWidget *widget, guint transformation) { char *msg=NULL; if (XMdcNoFileOpened()) return; XMdcProgressBar(MDC_PROGRESS_BEGIN,0.,"Transform images:"); XMdcViewerHide(); XMdcViewerEnableAutoShrink(); XMdcViewerReset(); switch (transformation) { case MDC_TRANSF_HORIZONTAL: msg = MdcFlipHorizontal(my.fi); break; case MDC_TRANSF_VERTICAL : msg = MdcFlipVertical(my.fi); break; case MDC_TRANSF_REVERSE : msg = MdcSortReverse(my.fi); break; case MDC_TRANSF_CINE_APPLY: msg = MdcSortCineApply(my.fi); break; case MDC_TRANSF_CINE_UNDO : msg = MdcSortCineUndo(my.fi); break; case MDC_TRANSF_SQR1 : msg = MdcMakeSquare(my.fi,MDC_TRANSF_SQR1); break; case MDC_TRANSF_SQR2 : msg = MdcMakeSquare(my.fi,MDC_TRANSF_SQR2); break; } if (msg != NULL) XMdcDisplayErr("Transform - %s",msg); XMdcDisplayImages(); XMdcProgressBar(MDC_PROGRESS_END,0.,NULL); XMDC_FILE_TYPE = XMDC_TRANSF; } xmedcon-0.14.1/source/xreset.c0000644000175000017510000000673512636253502013151 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xreset.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : reset file/structures routines * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcStructsReset() - Reset the global structures * * XMdcViewerReset() - Reset the viewer window * * XMdcFileReset() - Reset and close current file * * XMdcColorMapReset() - Reset to a new colormap * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xreset.c,v 1.23 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #include "xmedcon.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcStructsReset(void) { my.viewbox = NULL; my.cmap = NULL; my.curpage = 0; my.prevpage = 0; my.scale_width = 1.; my.scale_height = 1.; my.RESIZE = MDC_YES; } void XMdcViewerReset(void) { Uint32 i; if (my.viewwindow != NULL) { MdcDebugPrint("Removing viewer box & images ..."); gtk_widget_destroy(my.viewbox); gtk_widget_unrealize(my.viewwindow); g_object_unref(my.imcmap); for (i=0; ipalette); my.fi->map = map; } xmedcon-0.14.1/source/m-transf.h0000644000175000017510000000617412636253502013370 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-transf.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-transf.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-transf.h,v 1.22 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_TRANSF_H__ #define __M_TRANSF_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ /* image transformations */ #define MDC_TRANSF_HORIZONTAL 1 /* flip horizontal */ #define MDC_TRANSF_VERTICAL 2 /* flip vertical */ #define MDC_TRANSF_REVERSE 3 /* reverse sorting */ #define MDC_TRANSF_CINE_APPLY 4 /* cine apply sorting */ #define MDC_TRANSF_CINE_UNDO 5 /* cine undo sorting */ #define MDC_TRANSF_SQR1 6 /* make square */ #define MDC_TRANSF_SQR2 7 /* make square pwr2 */ #define MDC_TRANSF_CROP 8 /* crop image dims */ /* crop structure */ typedef struct Mdc_Crop_Info_t { Uint32 xoffset; Uint32 yoffset; Uint32 width; Uint32 height; } MDC_CROP_INFO; /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcFlipImgHorizontal(IMG_DATA *id); int MdcFlipImgVertical(IMG_DATA *id); char *MdcFlipHorizontal(FILEINFO *fi); char *MdcFlipVertical(FILEINFO *fi); char *MdcSortReverse(FILEINFO *fi); char *MdcSortCineApply(FILEINFO *fi); char *MdcSortCineUndo(FILEINFO *fi); char *MdcMakeSquare(FILEINFO *fi, int SQR_TYPE); char *MdcCropImages(FILEINFO *fi, MDC_CROP_INFO *ecrop); char *MdcMakeGray(FILEINFO *fi); char *MdcHandleColor(FILEINFO *fi); char *MdcContrastRemap(FILEINFO *fi); #endif xmedcon-0.14.1/source/xmedcon.c0000644000175000017510000001525712636253502013273 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xmedcon.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : main routine * * * * project : (X)MedCon by Erik Nolf * * * * Functions : main() - Main XMedCon routine * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xmedcon.c,v 1.36 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "xmedcon.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ int main(int argc, char *argv[]) { GtkWidget *main_vbox; GtkWidget *menubar; FILEINFO fi; my.fi = &fi; /* init library */ MdcInit(); /* set progress functions */ MdcProgress = XMdcProgressBar; MDC_PROGRESS = MDC_YES; /* some MedCon options initialized */ XMDC_GUI=MDC_YES; MDC_INFO=MDC_NO; MDC_VERBOSE=MDC_NO; MdcPrintShortInfo(); /* some XMedCon options initialized */ sLabelSelection.CurState = MDC_YES; sLabelSelection.CurColor = XMDC_LABEL_YELLOW; sLabelSelection.CurStyle = XMDC_LABEL_STYLE_ABS; sColormapSelection.CurMap = MDC_MAP_GRAY; sExtractSelection.input = &mdcextractinput; sExtractSelection.input->style = MDC_INPUT_NORM_STYLE; sResizeSelection.CurType = XMDC_RESIZE_ORIGINAL; sPagesSelection.CurType = XMDC_PAGES_FRAME_BY_FRAME; sRenderSelection.Dither = GDK_RGB_DITHER_MAX; sRenderSelection.Interp = GDK_INTERP_HYPER; /*GDK_INTERP_BILINEAR;*/ sGbc.mod.gamma = 256; sGbc.mod.brightness = 256; sGbc.mod.contrast = 256; XMdcSetGbcCorrection(&sGbc.mod); sGbc.im = NULL; MdcInitRawPrevInput(); #ifndef GTKONE /* preserve POSIX locale: decimal = point */ gtk_disable_setlocale(); #endif /* initialize the GTK/GDK_RGB engines */ gtk_init(&argc, &argv); gdk_rgb_init(); /* prevent unwanted Gdk-ERROR messages */ gtk_widget_set_default_colormap(gdk_rgb_get_cmap()); gtk_widget_set_default_visual(gdk_rgb_get_visual()); /* initialize XMedCon global struct */ my.viewwindow = NULL; XMdcStructsReset(); /* process possible medcon settings */ switch (argc) { case 1: /* without arguments */ break; case 2: /* one argument */ if ( ( strcmp(argv[1],"-h") == 0 ) || ( strcmp(argv[1],"/?") == 0 ) || ( strcmp(argv[1],"--help") == 0 ) ) { /* requesting merely some help */ MdcPrintUsage(argv[0]); }else{ if ( argv[1][0] == '-' ) { /* an option, sorry no files starting with - allowed */ if (MdcHandleArgs(&fi,argc,argv,1) != MDC_OK) { MdcPrintUsage(argv[0]); } }else{ /* must be an image file */ mdc_arg_files[0]=argv[1]; mdc_arg_total[MDC_FILES]=1; } } break; default: /* several arguments */ if (MdcHandleArgs(&fi,argc,argv,1) != MDC_OK) { MdcPrintUsage(argv[0]); } } /* set the initial palette we want */ sColormapSelection.Nr = MDC_COLOR_MAP; switch (MDC_COLOR_MAP) { case MDC_MAP_GRAY: sColormapSelection.CurMap = MDC_MAP_GRAY; break; case MDC_MAP_INVERTED: sColormapSelection.CurMap = MDC_MAP_INVERTED; break; case MDC_MAP_RAINBOW: sColormapSelection.CurMap = MDC_MAP_RAINBOW; break; case MDC_MAP_COMBINED: sColormapSelection.CurMap = MDC_MAP_COMBINED; break; case MDC_MAP_HOTMETAL: sColormapSelection.CurMap = MDC_MAP_HOTMETAL; break; case MDC_MAP_LOADED: sColormapSelection.CurMap = MDC_MAP_LOADED; } #ifdef _WIN32 XMdcCreateLogConsole(); #endif XMdcConfigureXMedcon(); my.mainwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_signal_connect(GTK_OBJECT(my.mainwindow), "destroy", GTK_SIGNAL_FUNC(XMdcMedconQuit), "WM destroy"); gtk_window_set_title(GTK_WINDOW(my.mainwindow), MDC_PRGR); gtk_window_set_policy(GTK_WINDOW(my.mainwindow),FALSE,TRUE,FALSE); main_vbox = gtk_vbox_new(FALSE, 1); gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 1); gtk_container_add(GTK_CONTAINER(my.mainwindow), main_vbox); gtk_widget_show(main_vbox); XMdcMenusGetMain(my.mainwindow, &menubar); gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, TRUE, 0); gtk_widget_show(menubar); gtk_widget_show(my.mainwindow); /* get some prefered stuff */ XMdcMakeMyCursors(); /* cursors for over pixmaps images */ XMdcMakeMyColors(); /* colors for the pixmaps labels */ XMdcMakeMyFonts(); /* fixed fonts */ /* display file on argument */ if (mdc_arg_total[MDC_FILES] == 1) XMdcDisplayFile(mdc_arg_files[0]); /* disable further stdin input */ MDC_FILE_STDIN = MDC_NO; gtk_main(); /* finish library */ MdcFinish(); return(0); } xmedcon-0.14.1/source/xreader.c0000644000175000017510000006517012636253502013267 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xreader.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : file reader * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcReadFile() - Read selected file * * XMdcRawReadFinish() - Finish raw read * * XMdcRawReadInteractive() - Interactive raw read * * XMdcRawReadPredef() - Read predefined raw * * XMdcRawReadCancel() - Raw read break up * * XMdcGetImageInfoPixelType() - Get specified pixeltype* * XMdcGetImageInfoCallbackApply() - Img Info Apply callback* * XMdcGetImageInfoCallbackCancel()- Img Info Cancel * * XMdcGetImageInfo() - Ask Img Info * * XMdcGetHeaderInfoCallbackApply()- Hdr Info Cont callback * * XMdcGetHeaderInfo() - Ask Hdr Info * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xreader.c,v 1.36 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "xmedcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ static RawReadSelectionStruct *raw = &sRawReadSelection; static MdcRawInputStruct *input = &mdcrawinput; static MdcRawPrevInputStruct *prev = &mdcrawprevinput; /**************************************************************************** F U N C T I O N S ****************************************************************************/ int XMdcReadFile(const char *fname) { if (MdcOpenFile(my.fi,fname) != MDC_OK) { XMdcDisplayErr("Failure opening file"); return(MDC_BAD_OPEN); } if (MdcReadFile(my.fi,0,NULL) != MDC_OK) { XMdcDisplayErr("Failure reading file"); return(MDC_BAD_READ); } return(MDC_OK); } void XMdcRawReadFinish(guint otype) { char *msg; /* open the file */ if ( (my.fi->ifp = fopen(my.fi->ipath,"rb")) == NULL) { MdcSplitPath(my.fi->ipath,my.fi->idir,my.fi->ifname); sprintf(mdcbufr,"Couldn't open <%s>",my.fi->ifname); XMdcRawReadCancel(otype); XMdcDisplayErr("Reading: %s",mdcbufr); return; }else{ MdcSplitPath(my.fi->ipath,my.fi->idir,my.fi->ifname); } /* read the file */ msg = MdcReadRAW(my.fi); if (msg != NULL) { if (strstr(msg,"Truncated image") == NULL) { XMdcRawReadCancel(otype); XMdcDisplayErr("Reading: %s",msg); XMdcProgressBar(MDC_PROGRESS_END,0.,NULL); return; }else{ XMdcDisplayWarn(msg); } } /* warn user about change in MedCon settings */ if (MDC_NEGATIVE == MDC_NO) { sprintf(xmdcstr,"Changed MedCon Pixel Value settings:\n" \ "disabled quantifications\n" \ "enabled negative values"); XMdcDisplayDialog(MDC_OK,"Important Note",xmdcstr); } /* change MedCon settings: disable quantifications, enable negative */ MDC_QUANTIFY = MDC_NO; MDC_CALIBRATE = MDC_NO; MDC_NEGATIVE = MDC_YES; MdcGetColorMap(sColormapSelection.CurMap,my.fi->palette); msg = MdcImagesPixelFiddle(my.fi); if (msg != NULL) { XMdcRawReadCancel(otype); XMdcDisplayErr("Reading: %s",msg); XMdcProgressBar(MDC_PROGRESS_END,0.,NULL); return; } XMDC_FILE_OPEN = MDC_YES; XMDC_FILE_TYPE = XMDC_RAW; XMdcViewerEnableAutoShrink(); XMdcDisplayImages(); XMdcProgressBar(MDC_PROGRESS_END,0.,NULL); if (otype == XMDC_RAW) gtk_widget_destroy(sRawReadSelection.HdrInfoWindow); } void XMdcRawReadInteractive(GtkWidget *fs) { const char *fname; XMdcMainWidgetsInsensitive(); gtk_widget_hide(fs); XMdcViewerHide(); XMdcFileReset(); fname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs)); MdcInitFI(my.fi, fname); XMdcGetHeaderInfo(); } void XMdcRawReadPredef(GtkWidget *fs) { IMG_DATA *id; Uint32 i; const char *fname; XMdcMainWidgetsInsensitive(); gtk_widget_hide(fs); XMdcViewerHide(); XMdcFileReset(); fname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs)); MdcInitFI(my.fi, fname); /* fill in input struct with predef values */ input->gen_offset = prev->GENHDR; input->img_offset = prev->IMGHDR; input->DIFF = prev->DIFF; input->REPEAT = prev->HDRREP; /* now fill structs with predef values */ if (!MdcGetStructID(my.fi,prev->NRIMGS)) { XMdcDisplayErr("Bad malloc IMG_DATA structs"); return; } for (i=0; inumber; i++) { id = &my.fi->image[i]; id->width = prev->XDIM; id->height= prev->YDIM; id->type = prev->PTYPE; id->bits = MdcType2Bits(id->type); } if (prev->PSWAP == MDC_YES) { MDC_FILE_ENDIAN = !MDC_HOST_ENDIAN; }else{ MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; } my.fi->endian = MDC_FILE_ENDIAN; my.fi->dim[0] = 3; my.fi->dim[3] = my.fi->number; my.fi->diff_type = MDC_NO; my.fi->diff_size = MDC_NO; my.fi->diff_scale= MDC_NO; XMdcRawReadFinish(XMDC_PREDEF); } void XMdcRawReadCancel(guint otype) { MdcCleanUpFI(my.fi); if (otype == XMDC_RAW) gtk_widget_destroy(sRawReadSelection.HdrInfoWindow); } Int16 XMdcGetImageInfoPixelType(void) { MdcDebugPrint("pixel type: "); if (GTK_TOGGLE_BUTTON(raw->typeBIT1)->active) { MdcDebugPrint("\tBIT1"); return(BIT1); }else if (GTK_TOGGLE_BUTTON(raw->typeASCII)->active) { MdcDebugPrint("\tASCII"); return(ASCII); }else if (GTK_TOGGLE_BUTTON(raw->typeBIT8_S)->active) { MdcDebugPrint("\tBIT8_S"); return(BIT8_S); }else if (GTK_TOGGLE_BUTTON(raw->typeBIT8_U)->active) { MdcDebugPrint("\tBIT8_U"); return(BIT8_U); }else if (GTK_TOGGLE_BUTTON(raw->typeBIT16_S)->active) { MdcDebugPrint("\tBIT16_S"); return(BIT16_S); }else if (GTK_TOGGLE_BUTTON(raw->typeBIT16_U)->active) { MdcDebugPrint("\tBIT16_U"); return(BIT16_U); }else if (GTK_TOGGLE_BUTTON(raw->typeBIT32_S)->active) { MdcDebugPrint("\tBIT32_S"); return(BIT32_S); }else if (GTK_TOGGLE_BUTTON(raw->typeBIT32_U)->active) { MdcDebugPrint("\tBT32_U"); return(BIT32_U); #ifdef HAVE_8BYTE_INT }else if (GTK_TOGGLE_BUTTON(raw->typeBIT64_S)->active) { MdcDebugPrint("\tBIT64_S"); return(BIT64_S); }else if (GTK_TOGGLE_BUTTON(raw->typeBIT64_U)->active) { MdcDebugPrint("\tBIT64_U"); return(BIT64_U); #endif }else if (GTK_TOGGLE_BUTTON(raw->typeFLT32)->active) { MdcDebugPrint("\tFLT32"); return(FLT32); }else if (GTK_TOGGLE_BUTTON(raw->typeFLT64)->active) { MdcDebugPrint("\tFLT64"); return(FLT64); }else if (GTK_TOGGLE_BUTTON(raw->typeCOLRGB)->active) { MdcDebugPrint("\tRGB"); return(COLRGB); }else{ XMdcDisplayFatalErr(MDC_BAD_CODE,"Unknown pixeltype encountered"); } return(MDC_BAD_CODE); } /* Apply = Finish or Next */ void XMdcGetImageInfoCallbackApply(void) { IMG_DATA *id=NULL; const char *entry; Uint32 i, width, height, imgnr, offset; Int16 type; imgnr = raw->ImgCounter - 1; MdcDebugPrint("image nr = %u",imgnr); entry = gtk_entry_get_text(GTK_ENTRY(raw->AbsOffset)); offset = (Uint32) atol(entry); prev->ABSHDR = offset; MdcDebugPrint("abs offset = %u",offset); entry = gtk_entry_get_text(GTK_ENTRY(raw->ImgWidth)); width = (Uint32) atol(entry); prev->XDIM = width; MdcDebugPrint("image width = %u",width); entry = gtk_entry_get_text(GTK_ENTRY(raw->ImgHeight)); height= (Uint32) atol(entry); prev->YDIM = height; MdcDebugPrint("image height= %u",height); type = XMdcGetImageInfoPixelType(); prev->PTYPE = type; if (width == 0) { XMdcDisplayErr("No width specified"); XMdcRawReadCancel(XMDC_RAW); return; } if (height == 0) { XMdcDisplayErr("No height specified"); XMdcRawReadCancel(XMDC_RAW); return; } if (input->DIFF) { id = &my.fi->image[imgnr]; id->load_location = (size_t)offset; id->width = width; id->height= height; id->type = type; id->bits = MdcType2Bits(id->type); }else{ for (i=0; inumber; i++) { id = &my.fi->image[i]; id->load_location = (size_t)offset; id->width = width; id->height= height; id->type = type; id->bits = MdcType2Bits(id->type); } } if (raw->ImgCounter < my.fi->number) { /* next -> get info for next image */ raw->ImgCounter += 1; XMdcGetImageInfo(); }else{ /* finish -> read the file */ my.fi->endian = MDC_FILE_ENDIAN; my.fi->dim[0] = 3; my.fi->dim[3] = my.fi->number; XMdcRawReadFinish(XMDC_RAW); } } void XMdcGetImageInfoCallbackCancel(void) { XMdcRawReadCancel(XMDC_RAW); } void XMdcGetImageInfo(void) { GtkWidget *window=NULL; GtkWidget *box1; GtkWidget *box2; GtkWidget *table; GtkWidget *frame; GtkWidget *label; GtkWidget *button; GtkWidget *entry; GtkWidget *separator; GSList *group; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_signal_connect(GTK_OBJECT(window),"destroy", GTK_SIGNAL_FUNC(gtk_widget_destroy),NULL); gtk_window_set_title(GTK_WINDOW(window),"Input Image Info"); gtk_widget_set_uposition(window,10,10); gtk_container_set_border_width(GTK_CONTAINER(window), 0); box1 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(window),box1); gtk_container_set_border_width(GTK_CONTAINER(box1), 0); gtk_widget_show(box1); if (input->DIFF) { sprintf(xmdcstr,"** IMAGE %u/%u **",raw->ImgCounter,my.fi->number); label = gtk_label_new(xmdcstr); }else{ label = gtk_label_new("** ALL IMAGES **"); } gtk_box_pack_start(GTK_BOX(box1),label,TRUE,TRUE,0); gtk_widget_show(label); /* Absolute offset in bytes */ frame = gtk_frame_new("Absolute Offset to Image"); gtk_box_pack_start(GTK_BOX(box1),frame,TRUE,TRUE, 5); gtk_container_set_border_width(GTK_CONTAINER(frame), 5); gtk_widget_show(frame); box2 = gtk_vbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(frame),box2); gtk_container_set_border_width(GTK_CONTAINER(box2), 5); gtk_widget_show(box2); table = gtk_table_new(1,2,FALSE); gtk_container_add(GTK_CONTAINER(box2),table); gtk_widget_show(table); label = gtk_label_new(" Offset in bytes "); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,0,1); gtk_widget_show(label); entry = gtk_entry_new_with_max_length(10); sprintf(xmdcstr,"%u",prev->ABSHDR); gtk_entry_set_text(GTK_ENTRY(entry),xmdcstr); gtk_editable_select_region(GTK_EDITABLE(entry),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,0,1); gtk_widget_show(entry); raw->AbsOffset = entry; /* Image dimensions */ frame = gtk_frame_new("Dimensions (pixels)"); gtk_box_pack_start(GTK_BOX(box1),frame,TRUE,TRUE,5); gtk_container_set_border_width(GTK_CONTAINER(frame), 5); gtk_widget_show(frame); box2 = gtk_vbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(frame),box2); gtk_container_set_border_width(GTK_CONTAINER(box2),5); gtk_widget_show(box2); table = gtk_table_new(2,2,FALSE); gtk_container_add(GTK_CONTAINER(box2),table); gtk_widget_show(table); label = gtk_label_new(" Columns "); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name (label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,0,1); gtk_widget_show(label); entry = gtk_entry_new_with_max_length(5); sprintf(xmdcstr,"%u",prev->XDIM); gtk_entry_set_text(GTK_ENTRY(entry),xmdcstr); gtk_editable_select_region(GTK_EDITABLE(entry),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,0,1); gtk_widget_show(entry); raw->ImgWidth = entry; label = gtk_label_new(" Rows "); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name (label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,1,2); gtk_widget_show(label); entry = gtk_entry_new_with_max_length(5); sprintf(xmdcstr,"%u",prev->YDIM); gtk_entry_set_text(GTK_ENTRY(entry),xmdcstr); gtk_editable_select_region(GTK_EDITABLE(entry),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,1,2); gtk_widget_show(entry); raw->ImgHeight = entry; /* Pixel Type */ frame = gtk_frame_new("Pixeltype"); gtk_box_pack_start(GTK_BOX(box1),frame,TRUE,TRUE,5); gtk_container_set_border_width(GTK_CONTAINER(frame), 5); gtk_widget_show(frame); box2 = gtk_vbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(frame),box2); gtk_container_set_border_width(GTK_CONTAINER(box2),5); gtk_widget_show(box2); table = gtk_table_new(7,2,FALSE); gtk_container_add(GTK_CONTAINER(box2),table); gtk_widget_show(table); button = gtk_radio_button_new_with_label(NULL,"1-bit"); gtk_table_attach_defaults(GTK_TABLE(table),button,0,1,0,1); if (prev->PTYPE == BIT1) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); } gtk_widget_show(button); raw->typeBIT1=button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"ASCII"); gtk_table_attach_defaults(GTK_TABLE(table),button,1,2,0,1); if (prev->PTYPE == ASCII) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); } gtk_widget_show(button); raw->typeASCII=button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"Int8"); gtk_table_attach_defaults(GTK_TABLE(table),button,0,1,1,2); if (prev->PTYPE == BIT8_S) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); } gtk_widget_show(button); raw->typeBIT8_S=button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"Uint8"); if (prev->PTYPE == BIT8_U) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); } gtk_table_attach_defaults(GTK_TABLE(table),button,1,2,1,2); gtk_widget_show(button); raw->typeBIT8_U=button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"Int16"); if (prev->PTYPE == BIT16_S) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); } gtk_table_attach_defaults(GTK_TABLE(table),button,0,1,2,3); gtk_widget_show(button); raw->typeBIT16_S=button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"Uint16"); gtk_table_attach_defaults(GTK_TABLE(table),button,1,2,2,3); if (prev->PTYPE == BIT16_U) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); } gtk_widget_show(button); raw->typeBIT16_U=button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"Int32"); gtk_table_attach_defaults(GTK_TABLE(table),button,0,1,3,4); if (prev->PTYPE == BIT32_S) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); } gtk_widget_show(button); raw->typeBIT32_S=button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"Uint32"); gtk_table_attach_defaults(GTK_TABLE(table),button,1,2,3,4); if (prev->PTYPE == BIT32_U) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); } gtk_widget_show(button); raw->typeBIT32_U=button; #ifdef HAVE_8BYTE_INT group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"Int64"); gtk_table_attach_defaults(GTK_TABLE(table),button,0,1,4,5); if (prev->PTYPE == BIT64_S) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); } gtk_widget_show(button); raw->typeBIT64_S=button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"Uint64"); gtk_table_attach_defaults(GTK_TABLE(table),button,1,2,4,5); if (prev->PTYPE == BIT64_U) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); } gtk_widget_show(button); raw->typeBIT64_U=button; #endif group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"float"); gtk_table_attach_defaults(GTK_TABLE(table),button,0,1,5,6); if (prev->PTYPE == FLT32) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); } gtk_widget_show(button); raw->typeFLT32=button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"double"); gtk_table_attach_defaults(GTK_TABLE(table),button,1,2,5,6); if (prev->PTYPE == FLT64) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); } gtk_widget_show(button); raw->typeFLT64=button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"RGB"); gtk_table_attach_defaults(GTK_TABLE(table),button,0,1,6,7); if (prev->PTYPE == COLRGB) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); } gtk_widget_show(button); raw->typeCOLRGB=button; separator = gtk_hseparator_new(); gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, FALSE, 0); gtk_widget_show (separator); box2 = gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(box1),box2,TRUE,TRUE,2); gtk_widget_show(box2); if (raw->ImgCounter == my.fi->number) { button = gtk_button_new_with_label("Finish"); }else{ button = gtk_button_new_with_label ("Next"); } gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 2); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(window)); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcGetImageInfoCallbackApply), NULL); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(window)); gtk_widget_show(button); button = gtk_button_new_with_label("Cancel"); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 2); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcGetImageInfoCallbackCancel), NULL); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(window)); gtk_widget_show(button); XMdcShowWidget(window); } /* Apply = Continue */ void XMdcGetHeaderInfoCallbackApply(void) { Uint32 number; const char *entry = NULL; /* total number of images */ entry = gtk_entry_get_text(GTK_ENTRY(raw->NrImages)); number = (Uint32) atol(entry); prev->NRIMGS = number; MdcDebugPrint("total images = %u",number); if (number == 0) { XMdcRawReadCancel(XMDC_RAW); XMdcDisplayErr("No images specified"); return; } if (!MdcGetStructID(my.fi,number)) { XMdcRawReadCancel(XMDC_RAW); XMdcDisplayErr("Bad alloc IMG_DATA structs"); return; } /* general header offset */ entry = gtk_entry_get_text(GTK_ENTRY(raw->GenOffset)); input->gen_offset = (Uint32) atol(entry); prev->GENHDR=input->gen_offset; MdcDebugPrint("general header offset = %u",input->gen_offset); /* image header offset */ entry = gtk_entry_get_text(GTK_ENTRY(raw->ImgOffset)); input->img_offset = (Uint32) atol(entry); prev->IMGHDR=input->img_offset; MdcDebugPrint("image header offset = %u",input->gen_offset); /* image header repeated */ if (GTK_TOGGLE_BUTTON(raw->IhdrRep)->active) { input->REPEAT = MDC_YES; prev->HDRREP = MDC_YES; MdcDebugPrint("image header repeated = yes"); }else{ input->REPEAT = MDC_NO; prev->HDRREP = MDC_NO; MdcDebugPrint("image header repeated = no"); } /* swap pixel bytes */ if (GTK_TOGGLE_BUTTON(raw->PixSwap)->active) { MDC_FILE_ENDIAN = !MDC_HOST_ENDIAN; prev->PSWAP = MDC_YES; MdcDebugPrint("swap pixels = yes"); }else{ MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; prev->PSWAP = MDC_NO; MdcDebugPrint("swap pixels = no"); } /* identical images */ if (GTK_TOGGLE_BUTTON(raw->ImgSame)->active) { input->DIFF = MDC_NO; prev->DIFF = MDC_NO; MdcDebugPrint("identical images = yes"); raw->ImgCounter = my.fi->number; }else{ input->DIFF = MDC_YES; prev->DIFF = MDC_YES; MdcDebugPrint("identical images = no"); raw->ImgCounter = 1; } XMdcGetImageInfo(); } void XMdcGetHeaderInfo(void) { GtkWidget *window=NULL; GtkWidget *box1; GtkWidget *box2; GtkWidget *box3; GtkWidget *frame; GtkWidget *table; GtkWidget *label; GtkWidget *button; GtkWidget *entry; GtkWidget *separator; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_signal_connect(GTK_OBJECT(window),"destroy", GTK_SIGNAL_FUNC(XMdcWidgetCallbackDestroy),NULL); gtk_window_set_title(GTK_WINDOW(window),"Input Header Info"); raw->HdrInfoWindow = window; gtk_container_set_border_width(GTK_CONTAINER(window), 0); box1 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(window),box1); gtk_container_set_border_width(GTK_CONTAINER(box1),0); gtk_widget_show(box1); box2 = gtk_hbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(box1),box2); gtk_container_set_border_width(GTK_CONTAINER(box2),5); gtk_widget_show(box2); frame = gtk_frame_new("File Info"); gtk_box_pack_start(GTK_BOX(box2),frame,TRUE,TRUE,5); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); table = gtk_table_new(4,2,FALSE); gtk_container_add(GTK_CONTAINER(box3),table); gtk_widget_show(table); label = gtk_label_new(" Total number of images "); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name (label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,0,1); gtk_widget_show(label); entry = gtk_entry_new_with_max_length(10); sprintf(xmdcstr,"%u",prev->NRIMGS); gtk_entry_set_text(GTK_ENTRY(entry),xmdcstr); gtk_editable_select_region(GTK_EDITABLE(entry),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,0,1); gtk_widget_show(entry); raw->NrImages = entry; label = gtk_label_new(" General header offset (bytes) "); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name (label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,1,2); gtk_widget_show(label); entry = gtk_entry_new_with_max_length(10); sprintf(xmdcstr,"%u",prev->GENHDR); gtk_entry_set_text(GTK_ENTRY(entry),xmdcstr); gtk_editable_select_region(GTK_EDITABLE(entry),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,1,2); gtk_widget_show(entry); raw->GenOffset = entry; label = gtk_label_new(" Image header offset (bytes) "); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name (label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,2,3); gtk_widget_show(label); entry = gtk_entry_new_with_max_length(10); sprintf(xmdcstr,"%u",prev->IMGHDR); gtk_entry_set_text(GTK_ENTRY(entry),xmdcstr); gtk_editable_select_region(GTK_EDITABLE(entry),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,2,3); gtk_widget_show(entry); raw->ImgOffset = entry; frame = gtk_frame_new("Data Info"); gtk_box_pack_start(GTK_BOX(box2),frame,TRUE,TRUE,5); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button = gtk_check_button_new_with_label("Repeated image header"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (prev->HDRREP == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); gtk_widget_show(button); raw->IhdrRep = button; button = gtk_check_button_new_with_label("Swap pixel bytes"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (prev->PSWAP == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); gtk_widget_show(button); raw->PixSwap = button; button = gtk_check_button_new_with_label("Identical images"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (prev->DIFF == MDC_NO) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); gtk_widget_show(button); raw->ImgSame = button; separator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(box1),separator,FALSE,FALSE,0); gtk_widget_show(separator); box2 = gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(box1),box2,TRUE,TRUE,2); gtk_widget_show(box2); button = gtk_button_new_with_label("Continue"); gtk_box_pack_start(GTK_BOX(box2),button,TRUE,TRUE,2); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcGetHeaderInfoCallbackApply),NULL); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(window)); gtk_widget_show(button); button = gtk_button_new_with_label("Cancel"); gtk_box_pack_start(GTK_BOX(box2),button,TRUE,TRUE,2); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(window)); gtk_widget_show(button); XMdcShowWidget(window); } xmedcon-0.14.1/source/xvifi.c0000644000175000017510000006353712636253503012770 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xvifi.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : edit FILEINFO structure * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcEditFileInfoCallbackApply - Apply FILEINFO changes * * XMdcEditFileInfo() - Edit FILEINFO struct * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xvifi.c,v 1.37 2015/12/22 13:59:31 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "xmedcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcEditFileInfoCallbackApply(GtkWidget *widget, gpointer data) { IMG_DATA *id; DYNAMIC_DATA *dd; const char *entry; char *msg; float pixel_size, slice_width, slice_spacing, frame_duration; Uint32 i, planes, frames, gates, beds, windows, number; if (XMdcNoFileOpened()) return; /* Orientation */ for (i=0; i < MDC_MAX_ORIENT; i++) { if (GTK_TOGGLE_BUTTON(sEditFI.PatSliceOrient[i])->active) { my.fi->pat_slice_orient = (Int8)i; break; } } strcpy(my.fi->pat_pos,MdcGetStrPatPos(my.fi->pat_slice_orient)); strcpy(my.fi->pat_orient,MdcGetStrPatOrient(my.fi->pat_slice_orient)); /* Sizes/Time */ entry = gtk_entry_get_text(GTK_ENTRY(sEditFI.PixelSize)); pixel_size = (float)atof(entry); entry = gtk_entry_get_text(GTK_ENTRY(sEditFI.SliceWidth)); slice_width = (float)atof(entry); entry = gtk_entry_get_text(GTK_ENTRY(sEditFI.SliceSpacing)); slice_spacing = (float)atof(entry); entry = gtk_entry_get_text(GTK_ENTRY(sEditFI.FrameDuration)); frame_duration = (float)atof(entry); /* Dimensions */ entry = gtk_entry_get_text(GTK_ENTRY(sEditFI.NrDimPlanes)); planes = (Uint32)atoi(entry); entry = gtk_entry_get_text(GTK_ENTRY(sEditFI.NrDimFrames)); frames = (Uint32)atoi(entry); entry = gtk_entry_get_text(GTK_ENTRY(sEditFI.NrDimGates)); gates = (Uint32)atoi(entry); entry = gtk_entry_get_text(GTK_ENTRY(sEditFI.NrDimBeds)); beds = (Uint32)atoi(entry); entry = gtk_entry_get_text(GTK_ENTRY(sEditFI.NrDimWindows)); windows = (Uint32)atoi(entry); number = planes * frames * gates * beds * windows; if (number == my.fi->number) { my.fi->dim[3] = planes; my.fi->dim[4] = frames; my.fi->dim[5] = gates; my.fi->dim[6] = beds; my.fi->dim[7] = windows; }else{ XMdcDisplayWarn("Incorrect dimensions not applied"); } /* set proper dim[0] */ for (i=7; i>=3; i--) { if (my.fi->dim[i] > 1) { my.fi->dim[0] = (Int16) i; i=1; /* last found, so leave */ } } /* Study Parameters */ if (GTK_TOGGLE_BUTTON(sEditFI.Reconstructed)->active) { my.fi->reconstructed = MDC_YES; }else{ my.fi->reconstructed = MDC_NO; } if (GTK_TOGGLE_BUTTON(sEditFI.Planar)->active) { my.fi->planar = MDC_YES; }else{ my.fi->planar = MDC_NO; } if (GTK_TOGGLE_BUTTON(sEditFI.ModalityNM)->active) { sEditFI.CurModality = M_NM; }else if (GTK_TOGGLE_BUTTON(sEditFI.ModalityPT)->active) { sEditFI.CurModality = M_PT; }else if (GTK_TOGGLE_BUTTON(sEditFI.ModalityCT)->active) { sEditFI.CurModality = M_CT; }else if (GTK_TOGGLE_BUTTON(sEditFI.ModalityMR)->active) { sEditFI.CurModality = M_MR; } for (i=0; i < MDC_MAX_ACQUISITIONS; i++) { if (GTK_TOGGLE_BUTTON(sEditFI.AcquisitionType[i])->active) { my.fi->acquisition_type = (Int16) i; break; } } /* reset other data structs */ msg = MdcResetODs(my.fi); if (msg != NULL) { XMdcDisplayFatalErr(MDC_BAD_CODE,msg); return; } /* fill in FI struct */ my.fi->modality = sEditFI.CurModality; if (my.fi->pixdim[0] < 4) my.fi->pixdim[0] = 4; /* at least */ my.fi->pixdim[1] = pixel_size; my.fi->pixdim[2] = pixel_size; my.fi->pixdim[3] = slice_width; my.fi->pixdim[4] = frame_duration; /* fill in IMG_DATA structs */ for (i=0; inumber; i++) { id = &my.fi->image[i]; id->pixel_xsize = pixel_size; id->pixel_ysize = pixel_size; id->slice_width = slice_width; id->slice_spacing = slice_spacing; MdcFillImgPos(my.fi,i,i%my.fi->dim[3],0.0); MdcFillImgOrient(my.fi,i); } /* fill DYNAMIC_DATA structs */ for (i=0; idynnr; i++) { dd = &my.fi->dyndata[i]; dd->nr_of_slices = my.fi->dim[3]; dd->time_frame_duration = frame_duration; } /* some final completions */ msg = MdcImagesPixelFiddle(my.fi); if (msg != NULL) { XMdcDisplayFatalErr(MDC_BAD_CODE,msg); return; } /* reframe images */ XMdcProgressBar(MDC_PROGRESS_BEGIN,0.,"Reframe images:"); XMdcViewerHide(); XMdcViewerEnableAutoShrink(); XMdcViewerReset(); XMdcDisplayImages(); XMdcProgressBar(MDC_PROGRESS_END,0.,NULL); XMDC_FILE_TYPE = XMDC_EDITFI; } void XMdcEditFileInfo(void) { GtkWidget *window=NULL; GtkWidget *box1; GtkWidget *box2; GtkWidget *box3; GtkWidget *box4; GtkWidget *frame; GtkWidget *top, *left, *right; GtkWidget *label; GtkWidget *table; GtkWidget *tablabel; GtkWidget *entry; GtkWidget *button; GtkWidget *separator; GtkWidget *notebook; GSList *group; EditFileInfoStruct *vifi = &sEditFI; int i; if (XMdcNoFileOpened()) return; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_signal_connect(GTK_OBJECT(window),"destroy", GTK_SIGNAL_FUNC(gtk_widget_destroy),NULL); gtk_window_set_title(GTK_WINDOW(window),"Edit FileInfo"); gtk_container_set_border_width(GTK_CONTAINER(window),0); box1 = gtk_vbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(window),box1); gtk_container_set_border_width(GTK_CONTAINER(box1),5); gtk_widget_show(box1); label=gtk_label_new("* any changes can seriously damage study integrity *"); gtk_misc_set_alignment(GTK_MISC(label),0.5,0.5); gtk_box_pack_start(GTK_BOX(box1),label,TRUE,TRUE,0); gtk_widget_show(label); notebook = gtk_notebook_new(); gtk_container_add(GTK_CONTAINER(box1),notebook); gtk_container_set_border_width(GTK_CONTAINER(notebook), 10); gtk_notebook_set_tab_border(GTK_NOTEBOOK(notebook), 5); gtk_notebook_set_homogeneous_tabs(GTK_NOTEBOOK(notebook), TRUE); gtk_widget_show(notebook); /* tab page Patient Slice Orientation */ box2 = gtk_hbox_new(FALSE, 10); gtk_widget_show(box2); tablabel = gtk_label_new("Orientation"); gtk_widget_show(tablabel); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), box2, tablabel); box3 = gtk_vbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(box2),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); table = gtk_table_new(2,2,FALSE); gtk_container_add(GTK_CONTAINER(box3),table); gtk_widget_show(table); top = gtk_vbox_new(FALSE,5); gtk_table_attach_defaults(GTK_TABLE(table),top,0,1,0,1); gtk_widget_show(top); left = gtk_vbox_new(FALSE,5); gtk_table_attach_defaults(GTK_TABLE(table),left,0,1,1,2); gtk_widget_show(left); right = gtk_vbox_new(FALSE,5); gtk_table_attach_defaults(GTK_TABLE(table),right,1,2,1,2); gtk_widget_show(right); button = NULL; group = NULL; for (i=0; i < MDC_MAX_ORIENT; i++) { if (i == 0) { button = gtk_radio_button_new_with_label(NULL,MdcGetStrPatSlOrient(i)); }else{ group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,MdcGetStrPatSlOrient(i)); } if (i == 0) { /* unknown singled on top */ gtk_box_pack_start(GTK_BOX(top),button,TRUE,TRUE,0); }else if (i <= MDC_MAX_ORIENT/2) { /* all supine left */ gtk_box_pack_start(GTK_BOX(left),button,TRUE,TRUE,0); }else{ /* all prone right */ gtk_box_pack_start(GTK_BOX(right),button,TRUE,TRUE,0); } if (my.fi->pat_slice_orient == i) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); }else{ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE); } gtk_widget_show(button); vifi->PatSliceOrient[i] = button; } /* tab page Sizes */ box2 = gtk_vbox_new(FALSE, 10); gtk_widget_show(box2); tablabel = gtk_label_new("Sizes / Time"); gtk_widget_show(tablabel); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), box2, tablabel); label = gtk_label_new("Note: Following entries require float values\n\ Examples: 10.0 1.0e+1"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT); gtk_widget_set_name (label, "FixedLabel"); gtk_box_pack_start(GTK_BOX(box2),label,TRUE,TRUE,5); gtk_widget_show(label); box3 = gtk_vbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(box2),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); table = gtk_table_new(4,3, FALSE); gtk_container_add(GTK_CONTAINER(box3),table); gtk_widget_show(table); label = gtk_label_new("Pixel Size"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,0,1); gtk_widget_show(label); entry = gtk_entry_new_with_max_length(15); sprintf(mdcbufr,"%e",my.fi->image[0].pixel_xsize); gtk_entry_set_text(GTK_ENTRY(entry),mdcbufr); gtk_editable_select_region(GTK_EDITABLE(entry),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,0,1); #ifdef GTKONE gtk_widget_draw_default(entry); #endif gtk_widget_show(entry); vifi->PixelSize = entry; label = gtk_label_new("[mm]"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,2,3,0,1); gtk_widget_show(label); label = gtk_label_new("Slice Width"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,1,2); gtk_widget_show(label); entry = gtk_entry_new_with_max_length(15); sprintf(mdcbufr,"%e",my.fi->image[0].slice_width); gtk_entry_set_text(GTK_ENTRY(entry),mdcbufr); gtk_editable_select_region(GTK_EDITABLE(entry),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,1,2); #ifdef GTKONE gtk_widget_draw_default(entry); #endif gtk_widget_show(entry); vifi->SliceWidth = entry; label = gtk_label_new("[mm]"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,2,3,1,2); gtk_widget_show(label); label = gtk_label_new("Slice Separation"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,2,3); gtk_widget_show(label); entry = gtk_entry_new_with_max_length(15); sprintf(mdcbufr,"%e",my.fi->image[0].slice_spacing); gtk_entry_set_text(GTK_ENTRY(entry),mdcbufr); gtk_editable_select_region(GTK_EDITABLE(entry),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,2,3); #ifdef GTKONE gtk_widget_draw_default(entry); #endif gtk_widget_show(entry); vifi->SliceSpacing = entry; label = gtk_label_new("[mm]"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,2,3,2,3); gtk_widget_show(label); label = gtk_label_new("Frame Duration"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,3,4); gtk_widget_show(label); entry = gtk_entry_new_with_max_length(15); if ((my.fi->dynnr > 0) && (my.fi->dyndata != NULL)) { sprintf(mdcbufr,"%e",my.fi->dyndata[0].time_frame_duration); }else{ sprintf(mdcbufr,"%e",0.); } gtk_entry_set_text(GTK_ENTRY(entry),mdcbufr); gtk_editable_select_region(GTK_EDITABLE(entry),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,3,4); #ifdef GTKONE gtk_widget_draw_default(entry); #endif gtk_widget_show(entry); vifi->FrameDuration = entry; label = gtk_label_new("[ms]"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,2,3,3,4); gtk_widget_show(label); /* tab page Dimensions */ box2 = gtk_vbox_new(FALSE, 10); gtk_widget_show(box2); tablabel = gtk_label_new("Dimensions"); gtk_widget_show(tablabel); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), box2, tablabel); sprintf(mdcbufr,"Note: Each entry must be a 1-based integer and the\n\ product of dim[]-values = total number of images (%u)",my.fi->number); label = gtk_label_new(mdcbufr); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT); gtk_widget_set_name (label, "FixedLabel"); gtk_box_pack_start(GTK_BOX(box2),label,TRUE,TRUE,5); gtk_widget_show(label); box3 = gtk_vbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(box2),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); table = gtk_table_new(5,3, FALSE); gtk_container_add(GTK_CONTAINER(box3),table); gtk_widget_show(table); label = gtk_label_new("dim[3] = "); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,0,1); gtk_widget_show(label); entry = gtk_entry_new_with_max_length(15); sprintf(mdcbufr,"%u",my.fi->dim[3]); gtk_entry_set_text(GTK_ENTRY(entry),mdcbufr); gtk_editable_select_region(GTK_EDITABLE(entry),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,0,1); #ifdef GTKONE gtk_widget_draw_default(entry); #endif gtk_widget_show(entry); vifi->NrDimPlanes = entry; label = gtk_label_new("(planes | (time) slices)"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,2,3,0,1); gtk_widget_show(label); label = gtk_label_new("dim[4] = "); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,1,2); gtk_widget_show(label); entry = gtk_entry_new_with_max_length(15); sprintf(mdcbufr,"%u",my.fi->dim[4]); gtk_entry_set_text(GTK_ENTRY(entry),mdcbufr); gtk_editable_select_region(GTK_EDITABLE(entry),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,1,2); #ifdef GTKONE gtk_widget_draw_default(entry); #endif gtk_widget_show(entry); vifi->NrDimFrames = entry; label = gtk_label_new(" (frames | time slots | phases)"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,2,3,1,2); gtk_widget_show(label); label = gtk_label_new("dim[5] = "); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,2,3); gtk_widget_show(label); entry = gtk_entry_new_with_max_length(15); sprintf(mdcbufr,"%u",my.fi->dim[5]); gtk_entry_set_text(GTK_ENTRY(entry),mdcbufr); gtk_editable_select_region(GTK_EDITABLE(entry),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,2,3); #ifdef GTKONE gtk_widget_draw_default(entry); #endif gtk_widget_show(entry); vifi->NrDimGates = entry; label = gtk_label_new("(gates | R-R intervals)"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,2,3,2,3); gtk_widget_show(label); label = gtk_label_new("dim[6] = "); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,3,4); gtk_widget_show(label); entry = gtk_entry_new_with_max_length(15); sprintf(mdcbufr,"%u",my.fi->dim[6]); gtk_entry_set_text(GTK_ENTRY(entry),mdcbufr); gtk_editable_select_region(GTK_EDITABLE(entry),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,3,4); #ifdef GTKONE gtk_widget_draw_default(entry); #endif gtk_widget_show(entry); vifi->NrDimBeds = entry; label = gtk_label_new("(beds | detector heads)"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,2,3,3,4); gtk_widget_show(label); label = gtk_label_new("dim[7] = "); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,4,5); gtk_widget_show(label); entry = gtk_entry_new_with_max_length(15); sprintf(mdcbufr,"%u",my.fi->dim[7]); gtk_entry_set_text(GTK_ENTRY(entry),mdcbufr); gtk_editable_select_region(GTK_EDITABLE(entry),0,-1); gtk_table_attach_defaults(GTK_TABLE(table),entry,1,2,4,5); #ifdef GTKONE gtk_widget_draw_default(entry); #endif gtk_widget_show(entry); vifi->NrDimWindows = entry; label = gtk_label_new("(energy windows)"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,2,3,4,5); gtk_widget_show(label); /* tab page Study Parameters */ box2 = gtk_vbox_new(FALSE, 10); gtk_widget_show(box2); tablabel = gtk_label_new("Study Parameters"); gtk_widget_show(tablabel); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), box2, tablabel); box3 = gtk_hbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(box2),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); frame = gtk_frame_new("Reconstructed"); gtk_container_add(GTK_CONTAINER(box3),frame); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_widget_show(frame); box4 = gtk_hbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(frame),box4); gtk_container_set_border_width(GTK_CONTAINER(box4),0); gtk_widget_show(box4); button = gtk_radio_button_new_with_label(NULL,"Yes"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); /* MARK: only save the Yes option */ if (my.fi->reconstructed == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); vifi->Reconstructed = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"No"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); if (my.fi->reconstructed == MDC_NO) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); /* MARK: no need to preserve, only two supported */ frame = gtk_frame_new("Planar"); gtk_container_add(GTK_CONTAINER(box3),frame); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_widget_show(frame); box4 = gtk_hbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(frame),box4); gtk_container_set_border_width(GTK_CONTAINER(box4),0); gtk_widget_show(box4); button = gtk_radio_button_new_with_label(NULL,"Yes"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); /* MARK: only save the Yes option */ if (my.fi->planar == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); vifi->Planar = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"No"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); if (my.fi->planar == MDC_NO) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); /* MARK: no need to preserve, only two supported */ box3 = gtk_hbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(box2),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); frame = gtk_frame_new("Acquisition Type"); gtk_container_add(GTK_CONTAINER(box3),frame); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_widget_show(frame); box4 = gtk_vbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(frame),box4); gtk_container_set_border_width(GTK_CONTAINER(box4),0); gtk_widget_show(box4); for (i=0; i < MDC_MAX_ACQUISITIONS; i++) { if (i == 0) { button = gtk_radio_button_new_with_label(NULL,MdcGetStrAcquisition(i)); }else{ group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,MdcGetStrAcquisition(i)); } gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); if (my.fi->acquisition_type == i) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); }else{ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE); } gtk_widget_show(button); vifi->AcquisitionType[i] = button; } frame = gtk_frame_new("Modality"); gtk_container_add(GTK_CONTAINER(box3),frame); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_widget_show(frame); box4 = gtk_vbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(frame),box4); gtk_container_set_border_width(GTK_CONTAINER(box4),0); gtk_widget_show(box4); vifi->CurModality = my.fi->modality; button = gtk_radio_button_new_with_label(NULL,"NM"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); /*if (vifi->CurModality == M_NM) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); }*/ gtk_widget_show(button); vifi->ModalityNM = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"PT"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); /*if (vifi->CurModality == M_PT) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); }*/ gtk_widget_show(button); vifi->ModalityPT = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"CT"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); /*if (vifi->CurModality == M_CT) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); }*/ gtk_widget_show(button); vifi->ModalityCT = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"MR"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); /*if (vifi->CurModality == M_MR) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); }*/ gtk_widget_show(button); vifi->ModalityMR = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"keep current"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); vifi->ModalityCurrent = button; /* create horizontal separator */ separator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(box1),separator,FALSE,FALSE,0); gtk_widget_show(separator); /* create bottom buttons */ box2 = gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(box1),box2,TRUE,TRUE,2); gtk_widget_show(box2); button = gtk_button_new_with_label("Apply"); gtk_box_pack_start(GTK_BOX(box2),button,TRUE,TRUE,2); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(window)); gtk_signal_connect(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(XMdcEditFileInfoCallbackApply), NULL); gtk_signal_connect_object(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(window)); gtk_widget_show(button); button = gtk_button_new_with_label("Cancel"); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 2); gtk_signal_connect_object(GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(window)); gtk_widget_show(button); XMdcShowWidget(window); } xmedcon-0.14.1/source/medcon.c0000644000175000017510000001306512636253502013076 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: medcon.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : main routines * * * * project : (X)MedCon by Erik Nolf * * * * Functions : main() - The hart of the project * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: medcon.c,v 1.38 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include #include "medcon.h" /**************************************************************************** M A I N ****************************************************************************/ int main(int argc, char *argv[]) { FILEINFO fi; int *total = mdc_arg_total; /* total arguments of files & conversions */ int *convs = mdc_arg_convs; /* counter for each conversion format */ char **files = mdc_arg_files; /* array of pointers to input filenames */ int f, c; /* some counters */ int t=0; /* counter for the output name prefix */ int convert, error; /* some variables */ char *msg=NULL; XMDC_GUI = MDC_NO; /* program is CLI, command-line interface */ /* init library */ MdcInit(); if (argc == 1) { MdcPrintShortInfo(); return(MDC_BAD_CODE); } /* parse the command line arguments */ if (MdcHandleArgs(&fi,argc,argv,MDC_MAX_FILES) != MDC_OK) MdcPrintUsage(NULL); /* initialize raw read input */ if (MDC_INTERACTIVE) MdcInitRawPrevInput(); /* stack slices or frames */ if (MDC_FILE_STACK != MDC_NO) { msg = MdcStackFiles(MDC_FILE_STACK); if (msg != NULL) MdcPrntErr(MDC_BAD_CODE,msg); return(MDC_OK); /* leave program */ } /* do the stuff for each input file */ for (f=0; f 0 ) { /* go through all the formats */ for (c=1; c 0) { switch (MDC_FILE_SPLIT) { case MDC_SPLIT_PER_SLICE: msg = MdcSplitSlices(&fi,c,MdcGetPrefixNr(&fi,t++)); if (msg != NULL) { MdcCleanUpFI(&fi); MdcPrntErr(MDC_BAD_CODE,"Failed Split - %s",msg); } break; case MDC_SPLIT_PER_FRAME: msg = MdcSplitFrames(&fi,c,MdcGetPrefixNr(&fi,t++)); if (msg != NULL) { MdcCleanUpFI(&fi); MdcPrntErr(MDC_BAD_CODE,"Failed Split - %s",msg); } break; default: error = MdcWriteFile(&fi,c,MdcGetPrefixNr(&fi,t++),NULL); if (error != MDC_OK) { MdcCleanUpFI(&fi); return(error); } } } } } /* clean up FILEINFO struct */ MdcCleanUpFI(&fi); } /* finish library */ MdcFinish(); /* bye */ return(MDC_OK); } xmedcon-0.14.1/source/medcon.h0000644000175000017510000000576412636253502013112 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: medcon.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : project header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: medcon.h,v 1.40 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __MEDCON_H__ #define __MEDCON_H__ /**************************************************************************** H E A D E R S ****************************************************************************/ #ifdef __cplusplus extern "C" { #endif /* define _WIN32 in case of cygwin/mingw compilation */ #ifndef _WIN32 # ifdef __MINGW32__ # define _WIN32 # elif defined __CYGWIN32__ # define _WIN32 # endif #endif #include #include "m-defs.h" #include "m-structs.h" #include "m-error.h" #include "m-files.h" #include "m-debug.h" #include "m-fancy.h" #include "m-getopt.h" #include "m-algori.h" #include "m-color.h" #include "m-global.h" #include "m-pixels.h" #include "m-xtract.h" #include "m-init.h" #include "m-vifi.h" #include "m-rslice.h" #include "m-transf.h" #include "m-qmedian.h" #include "m-split.h" #include "m-stack.h" #include "m-progress.h" #include "m-raw.h" #if MDC_INCLUDE_GIF # include "m-gif.h" #endif #if MDC_INCLUDE_ACR # include "m-acr.h" #endif #if MDC_INCLUDE_INW # include "m-inw.h" #endif #if MDC_INCLUDE_INTF # include "m-intf.h" #endif #if MDC_INCLUDE_CONC # include "m-conc.h" #endif #if MDC_INCLUDE_ECAT # include "m-ecat64.h" # include "m-ecat72.h" #endif #if MDC_INCLUDE_ANLZ # include "m-anlz.h" #endif #if MDC_INCLUDE_DICM # include "m-dicm.h" #endif #if MDC_INCLUDE_PNG # include "m-png.h" #endif #if MDC_INCLUDE_NIFTI # include "m-nifti.h" #endif #ifdef __cplusplus } #endif #endif xmedcon-0.14.1/source/ximages.c0000644000175000017510000002375112636253502013271 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: ximages.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : image routines * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcRemovePreviousImages() - Remove old X images * * XMdcImagesSetCursor() - Set cursor over X images * * XMdcImagesCallbackExpose() - Images Expose callback * * XMdcImagesCallbackClicked() - Images Clicked callback * * XMdcBuildCurrentImages() - Build images for display * * XMdcDisplayImages() - Display the images * * XMdcImagesView() - Show the images (viewer) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: ximages.c,v 1.32 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include #include "xmedcon.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ #ifdef MDC_USE_SIGNAL_BLOCKER /* * MARK: dirty fix of bad button-press-event behaviour in _WIN32 * * The button-press-events of our image's drawing areas seems to be * "propagated" over all our widgets ... We got for example zoom or info * windows by clicking on places we wouldn't expect this to happen. * * So we 're blocking this button-press-event whenever we leave the * corresponding drawing area (and ofcourse, reallowing when entering) * * However, the gtk_signal_handler_block() function increments a number * instead of using a simple boolean. Whenever the "enter_notify_event" * is missed ... this number will never drop to zero again. And it does * happen when widgets come in front of our drawing areas which are rebuild * because of a color correction or colormap change. * * Our SignalBlocker struct should prevent the gtk_signal_handler_block() * function being called several times ... * * Actual struct defined in xdefs.h: typedef struct SignalBlocker_t{ guint id; gboolean blocked; }SignalBlocker; * */ static gboolean XMdcSignalBlock(GtkWidget *widget, gpointer data) { SignalBlocker *signal; signal = (SignalBlocker *)gtk_object_get_data(GTK_OBJECT(widget),"signal"); if (!signal->blocked) { gtk_signal_handler_block(GTK_OBJECT(widget),signal->id); signal->blocked = TRUE; } return(TRUE); } static gboolean XMdcSignalUnblock(GtkWidget *widget, gpointer data) { SignalBlocker *signal; signal = (SignalBlocker *)gtk_object_get_data(GTK_OBJECT(widget),"signal"); if (signal->blocked) { gtk_signal_handler_unblock(GTK_OBJECT(widget),signal->id); signal->blocked = FALSE; } return(TRUE); } #endif void XMdcRemovePreviousImages(void) { Uint32 i; for (i=0; iwindow != NULL) gdk_window_set_cursor (widget->window, handcursor); } gboolean XMdcImagesCallbackExpose(GtkWidget *widget, GdkEventExpose *event, Uint32 *nr) { GdkGC *gc = widget->style->white_gc; Uint32 i = (Uint32)(*nr); gint ex, ey, ew, eh, iw, ih, rw, rh; if ( my.im[i] == NULL ) return(TRUE); /* repaint the polluted drawable */ iw = gdk_pixbuf_get_width(my.im[i]); ih = gdk_pixbuf_get_height(my.im[i]); ex = event->area.x; ey = event->area.y; ew = event->area.width; eh = event->area.height; if ((ex < iw) && (ey < ih)) { rw = iw - ex; rh = ih - ey; gdk_pixbuf_render_to_drawable(my.im[i], widget->window, gc, ex, ey, ex, ey, rw, rh, sRenderSelection.Dither, 0, 0); } if ((ex + ew) > iw) { rw = (ex + ew) - iw; rh = eh; gdk_window_clear_area(widget->window, iw, ey, rw, rh); } if ((ey + eh) > ih) { rh = (ey + eh) - ih; rw = ew; gdk_window_clear_area(widget->window, ex, ih, rw, rh); } if (sLabelSelection.CurState == MDC_YES) { XMdcPrintImageLabelIndex(widget,i); XMdcPrintImageLabelTimes(widget,i); } return(TRUE); } gboolean XMdcImagesCallbackClicked(GtkWidget *widget, GdkEventButton *button, Uint32 *nr) { if (button->button == 1) { /* zoom the image */ XMdcImagesZoom(widget,(Uint32)(*nr)); } if (button->button == 2) { /* print image info */ XMdcImagesInfo(widget,(Uint32)(*nr)); } if (button->button == 3) { /* color correction */ XMdcColGbcCorrectSel(widget,(Uint32)(*nr)); } return(TRUE); } void XMdcBuildCurrentImages(void) { Uint32 i, r, c, ri; Uint32 real_images; float progress; MdcDebugPrint("Building current images ..."); real_images = XMdcPagesGetNrImages(); /* get real_images_per_page and number of the beginning image */ if (real_images < my.images_per_page) { /* always lesser images on page */ my.real_images_on_page = real_images; my.startimage = my.curpage * real_images; }else{ if (my.curpage == my.number_of_pages - 1) { /* last page, probably less images on it */ my.real_images_on_page = my.fi->number - (my.curpage*my.images_per_page); my.startimage = my.curpage * my.images_per_page; }else{ /* other pages completely filled out */ my.real_images_on_page = my.images_per_page; my.startimage = my.curpage * my.images_per_page; } } progress = 1./(float)(my.real_images_on_page + 1); /* build the images */ i = my.startimage; ri=0; for (r=0; rmwidth) + XMDC_IMAGE_BORDER) ,(gint)(XMdcScaleH(my.fi->mheight) + XMDC_IMAGE_BORDER)); gtk_widget_set_events (my.image[ri], GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK #ifdef MDC_USE_SIGNAL_BLOCKER | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK #endif ); gtk_table_attach(GTK_TABLE(my.imgstable),my.image[ri],c,c+1,r,r+1, GTK_FILL,GTK_FILL, 0, 0); #ifdef MDC_USE_SIGNAL_BLOCKER signal->id = #endif gtk_signal_connect (GTK_OBJECT(my.image[ri]), "button_press_event", GTK_SIGNAL_FUNC(XMdcImagesCallbackClicked), (Uint32 *)&my.imagenumber[ri]); gtk_signal_connect (GTK_OBJECT(my.image[ri]),"expose_event", GTK_SIGNAL_FUNC(XMdcImagesCallbackExpose), (Uint32 *)&my.imagenumber[ri]); #ifdef MDC_USE_SIGNAL_BLOCKER gtk_signal_connect (GTK_OBJECT(my.image[ri]),"enter_notify_event", GTK_SIGNAL_FUNC(XMdcSignalUnblock), NULL); gtk_signal_connect (GTK_OBJECT(my.image[ri]),"leave_notify_event", GTK_SIGNAL_FUNC(XMdcSignalBlock), NULL); gtk_object_set_data(GTK_OBJECT(my.image[ri]),"signal",signal); XMdcSignalBlock(my.image[ri],NULL); #endif XMdcImagesSetCursor(my.image[ri],NULL); } gtk_widget_show(my.image[ri]); if (GTK_WIDGET_VISIBLE(my.viewwindow)) { if (my.images_horizontal < 10) { /* update after each two rows */ if (((ri+1)%(my.images_horizontal*2)) == 0) XMdcProgressBar(MDC_PROGRESS_SET,progress,NULL); }else{ /* update after each five rows */ if (((ri+1)%(my.images_horizontal*5)) == 0) XMdcProgressBar(MDC_PROGRESS_SET,progress,NULL); } }else{ /* update after each image */ XMdcProgressBar(MDC_PROGRESS_SET,progress,NULL); } } } void XMdcDisplayImages(void) { XMdcProgressBar(MDC_PROGRESS_BEGIN,0.,"Preparing Viewer:"); XMdcSetImageScales(); XMdcGetBoardDimensions(); XMdcHandleBoardDimensions(); XMdcBuildViewerWindow(); XMdcBuildColorMap(); XMdcBuildCurrentImages(); XMdcResizeNeeded(); gtk_container_foreach(GTK_CONTAINER(my.imgstable), (GtkCallback)XMdcImagesSetCursor,NULL); } void XMdcImagesView(GtkWidget *widget, gpointer data) { if (XMdcNoFileOpened()) return; XMdcViewerShow(); } xmedcon-0.14.1/source/m-global.c0000644000175000017510000002630112636253502013320 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-global.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : define global variables * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-global.c,v 1.85 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include #include "m-defs.h" /**************************************************************************** D E F I N E S ****************************************************************************/ /* all our version constants */ const char *MDC_MAJOR = XMEDCON_MAJOR; const char *MDC_MINOR = XMEDCON_MINOR; const char *MDC_MICRO = XMEDCON_MICRO; const char *MDC_PRGR = XMEDCON_PRGR; const char *MDC_DATE = XMEDCON_DATE; const char *MDC_VERSION = XMEDCON_VERSION; const char *MDC_LIBVERS = XMEDCON_LIBVERS; /* fill in host endian and default write endian */ #if MDC_WORDS_BIGENDIAN Int8 MDC_HOST_ENDIAN = MDC_BIG_ENDIAN; Int8 MDC_WRITE_ENDIAN= MDC_BIG_ENDIAN; #else Int8 MDC_HOST_ENDIAN = MDC_LITTLE_ENDIAN; Int8 MDC_WRITE_ENDIAN= MDC_LITTLE_ENDIAN; #endif Int8 MDC_FILE_ENDIAN = -1; Int8 MDC_BLOCK_MESSAGES = MDC_NO; /* globally available variables */ char prefix[MDC_MAX_PREFIX + 1]="eNlf-"; /* 15 + '\O' */ char *mdcbasename=NULL; /* new base */ /* global arrays for argument handling */ char *mdc_arg_files[MDC_MAX_FILES]; /* pointers to filenames */ int mdc_arg_convs[MDC_MAX_FRMTS]; /* counter for each conversion */ int mdc_arg_total[2]; /* totals for files & conversion */ /* format support compiled in */ Int8 FrmtSupported[MDC_MAX_FRMTS] = { 0, /* MDC_FRMT_NONE */ 1, /* MDC_FRMT_RAW */ 1, /* MDC_FRMT_ASCII */ MDC_INCLUDE_GIF, /* MDC_FRMT_GIF */ MDC_INCLUDE_ACR, /* MDC_FRMT_ACR */ MDC_INCLUDE_INW, /* MDC_FRMT_INW */ MDC_INCLUDE_ECAT, /* MDC_FRMT_ECAT6 */ MDC_INCLUDE_ECAT, /* MDC_FRMT_ECAT7 */ MDC_INCLUDE_INTF, /* MDC_FRMT_INTF */ MDC_INCLUDE_ANLZ, /* MDC_FRMT_ANLZ */ MDC_INCLUDE_DICM, /* MDC_FRMT_DICM */ MDC_INCLUDE_PNG, /* MDC_FRMT_PNG */ MDC_INCLUDE_CONC, /* MDC_FRMT_CONC */ MDC_INCLUDE_NIFTI /* MDC_FRMT_NIFTI */ /*................. */ }; /* format name */ char FrmtString[MDC_MAX_FRMTS][15]= { "Unknown ", /* MDC_FRMT_NONE */ "Raw Binary ", /* MDC_FRMT_RAW */ "Raw Ascii ", /* MDC_FRMT_ASCII */ "Gif89a ", /* MDC_FRMT_GIF */ "Acr/Nema ", /* MDC_FRMT_ACR */ "INW (RUG) ", /* MDC_FRMT_INW */ "CTI ECAT 6 ", /* MDC_FRMT_ECAT6 */ "CTI ECAT 7 ", /* MDC_FRMT_ECAT7 */ "InterFile ", /* MDC_FRMT_INTF */ "Analyze ", /* MDC_FRMT_ANLZ */ "DICOM ", /* MDC_FRMT_DICM */ "PNG ", /* MDC_FRMT_PNG */ "Concorde/uPET", /* MDC_FRMT_CONC */ "NIfTI " /* MDC_FRMT_NIFTI */ /*"............." */ }; /* format extension */ char FrmtExt[MDC_MAX_FRMTS][8] = { "???", /* MDC_FRMT_NONE */ "bin", /* MDC_FRMT_RAW */ "asc", /* MDC_FRMT_ASCII */ "gif", /* MDC_FRMT_GIF */ "ima", /* MDC_FRMT_ACR */ "im", /* MDC_FRMT_INW */ "img", /* MDC_FRMT_ECAT6 */ "v", /* MDC_FRMT_ECAT7 */ "h33", /* MDC_FRMT_INTF */ "hdr", /* MDC_FRMT_ANLZ */ "dcm", /* MDC_FRMT_DICM */ "png", /* MDC_FRMT_PNG */ "img.hdr",/* MDC_FRMT_CONC */ "nii" /* MDC_FRMT_NIFTI */ /*"..." */ }; char mdcbufr[MDC_2KB_OFFSET+1]; /* 2KB global buffer */ char errmsg[MDC_1KB_OFFSET+1]; /* 1KB error buffer */ /* user specified slope/intercept */ float mdc_si_slope = 1.; float mdc_si_intercept = 0.; /* user specified window center/width */ float mdc_cw_centre = 0.; float mdc_cw_width = 0.; /* predefined mosaic stamps layout */ Uint32 mdc_mosaic_width = 0; Uint32 mdc_mosaic_height= 0; Uint32 mdc_mosaic_number= 0; Int8 mdc_mosaic_interlaced = MDC_NO; /* crop settings */ Uint32 mdc_crop_xoffset = 0; Uint32 mdc_crop_yoffset = 0; Uint32 mdc_crop_width = 0; Uint32 mdc_crop_height = 0; /* flags & options */ char MDC_INSTITUTION[MDC_MAXSTR]="NucMed"; /* name of institution */ Int8 MDC_COLOR_MODE= MDC_COLOR_RGB; /* default color mode */ Int8 MDC_COLOR_MAP = MDC_MAP_GRAY; /* gray color palette selected */ Int8 MDC_PADDING_MODE= MDC_PAD_BOTTOM_RIGHT; /* resized image padding mode */ Int8 MDC_ANLZ_SPM = MDC_NO; /* Analyze/SPM with scaling factor */ Int8 MDC_ANLZ_OPTIONS = MDC_NO; /* Analyze/SPM request parameters */ Int8 MDC_DICOM_MOSAIC_ENABLED = MDC_NO; /* DICOM: mosaic support enabled */ Int8 MDC_DICOM_MOSAIC_FORCED = MDC_NO; /* DICOM: mosaic preset forced */ Int8 MDC_DICOM_MOSAIC_DO_INTERL = MDC_NO; /* DICOM: mosaic forced interlaced */ Int8 MDC_DICOM_MOSAIC_FIX_VOXEL = MDC_NO; /* DICOM: mosaic fix voxel sizes */ Int8 MDC_DICOM_WRITE_IMPLICIT = MDC_NO; /* DICOM: write little implicit */ Int8 MDC_DICOM_WRITE_NOMETA = MDC_NO; /* DICOM: write without meta header*/ Int8 MDC_FORCE_RESCALE = MDC_NO; /* user specified slope/intercept */ Int8 MDC_FORCE_CONTRAST= MDC_NO; /* user specified center/width */ Int8 MDC_INFO = MDC_YES; /* default print header info */ Int8 MDC_INTERACTIVE = MDC_NO; /* interactive read of raw file */ Int8 MDC_CONVERT = MDC_NO; /* image conversion requested */ Int8 MDC_EXTRACT = MDC_NO; /* extract images */ Int8 MDC_RENAME = MDC_NO; /* rename base filename */ Int8 MDC_ECHO_ALIAS = MDC_NO; /* echo alias name based on ID's */ Int8 MDC_EDIT_FI = MDC_NO; /* edit FILEINFO struct */ Int8 MDC_PIXELS = MDC_NO; /* print specified pix values */ Int8 MDC_PIXELS_PRINT_ALL = MDC_NO; /* print all pix values */ Int8 MDC_NEGATIVE = MDC_NO; /* allow negative pixel values */ Int8 MDC_QUANTIFY = MDC_NO; /* quantitation with one factor */ Int8 MDC_CALIBRATE = MDC_NO; /* quantitation with two factors */ Int8 MDC_CONTRAST_REMAP = MDC_NO; /* apply contrast remapping */ Int8 MDC_DEBUG = MDC_NO; /* give debug info */ Int8 MDC_VERBOSE = MDC_NO; /* run in verbose mode */ Int8 MDC_GIF_OPTIONS = MDC_NO; /* request for extra GIF options */ Int8 MDC_MAKE_GRAY = MDC_NO; /* forced remap color to gray scale */ Int8 MDC_DITHER_COLOR = MDC_NO; /* apply dither on color reduction */ Int8 MDC_NORM_OVER_FRAMES = MDC_NO; /* normalize over images in a frame */ /* instead of all images */ Int8 MDC_SKIP_PREVIEW = MDC_NO; /* skip the first (preview) slice */ Int8 MDC_IGNORE_PATH = MDC_NO; /* ignore path in INTF data fname */ Int8 MDC_SINGLE_FILE = MDC_NO; /* write INTF as single file */ Int8 MDC_FORCE_INT = MDC_NO; /* force integer pixels */ Int8 MDC_INT16_BITS_USED = 16; /* bits to use for Int16 type */ Int8 MDC_TRUE_GAP = MDC_NO; /* spacing = true gap/overlap */ Int8 MDC_ALIAS_NAME = MDC_NO; /* use alias name based on ID's */ Int8 MDC_PREFIX_DISABLED = MDC_NO; /* prevent the prefix in names */ Int8 MDC_PREFIX_ACQ = MDC_NO; /* use acquisition number as prefix */ Int8 MDC_PREFIX_SER = MDC_NO; /* use series number as prefix */ Int8 MDC_PATIENT_ANON = MDC_NO; /* make patient anonymous */ Int8 MDC_PATIENT_IDENT = MDC_NO; /* give patient identification */ Int8 MDC_FILE_OVERWRITE = MDC_NO; /* allow file overwriting */ Int8 MDC_FILE_STDIN = MDC_NO; /* input from stdin stream */ Int8 MDC_FILE_STDOUT = MDC_NO; /* output to stdout stream */ Int8 MDC_FILE_SPLIT = MDC_NO; /* split up file in parts */ Int8 MDC_FILE_STACK = MDC_NO; /* stack up files */ Int8 MDC_FLIP_HORIZONTAL = MDC_NO; /* flip horizontal (x) */ Int8 MDC_FLIP_VERTICAL = MDC_NO; /* flip vertical (y) */ Int8 MDC_SORT_REVERSE = MDC_NO; /* reverse sorting */ Int8 MDC_SORT_CINE_APPLY = MDC_NO; /* cine apply sorting */ Int8 MDC_SORT_CINE_UNDO = MDC_NO; /* cine undo sorting */ Int8 MDC_MAKE_SQUARE = MDC_NO; /* make square image */ Int8 MDC_CROP_IMAGES = MDC_NO; /* crop image dimensions */ Int8 MDC_RESLICE = MDC_NO; /* reslice images (tra, sag, cor) */ Int8 MDC_FRMT_INPUT = MDC_FRMT_NONE; /* format used for stdin */ Int8 MDC_ECAT6_SORT = MDC_ANATOMICAL; /* ECAT sort order */ #if MDC_INCLUDE_DICM /* fallback read format */ Int8 MDC_FALLBACK_FRMT = MDC_FRMT_DICM; #elif MDC_INCLUDE_ECAT Int8 MDC_FALLBACK_FRMT = MDC_FRMT_ECAT6; #elif MDC_INCLUDE_ANLZ Int8 MDC_FALLBACK_FRMT = MDC_FRMT_ANLZ; #elif MDC_INCLUDE_CONC Int8 MDC_FALLBACK_FRMT = MDC_FRMT_CONC; #else Int8 MDC_FALLBACK_FRMT = MDC_FRMT_NONE; #endif /* undocumented options, for debugging purposes only */ Int8 MDC_MY_DEBUG=MDC_NO; /* give even more debug info */ Int8 MDC_INFO_DB=MDC_NO; /* just print short database info */ Int8 MDC_HACK_ACR=MDC_NO; /* try to find acrnema tags */ /* XMedCon - GUI*/ Int8 XMDC_GUI=MDC_NO; /* is program the GUI part? */ Int8 XMDC_WRITE_FRMT = MDC_FRMT_RAW; /* default format to save */ xmedcon-0.14.1/source/xtransf.h0000644000175000017510000000354412636253503013325 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xtransf.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xtransf.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xtransf.h,v 1.15 2015/12/22 13:59:31 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XTRANSF_H__ #define __XTRANSF_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcTransformImages(GtkWidget *widget, guint transformation); #endif xmedcon-0.14.1/source/m-ecat64.c0000644000175000017510000014533012636253502013152 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-ecat64.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : Read and Write ECAT 6.4 files * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcCheckECAT6() - Check for ECAT 6.4 format * * MdcReadECAT6() - Read ECAT 6.4 file * * MdcWriteECAT6() - Write ECAT 6.4 file * * MdcGetSliceLocation() - Get slice location * * MdcGetFilterCode() - Get code number of filter * * MdcFillMainHeader() - Fill in Main Header * * MdcFillImageSubHeader() - Fill in Image SubHeader * * MdcPrintEcatInfoDB() - Print ECAT database info * * * * * * Notes : source needs m-matrix.h & m-matrix.c * * * * Credits : - CTI coders - for creating the basic code * * - Johan Keppens - getting it to work initially * * - Sakari Alenius - reading using a matrix list * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-ecat64.c,v 1.92 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "medcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_NUM_BEDS_TWEAK MDC_YES /* check on zero/one based num_beds */ #ifdef _WIN32 #define MDC_ECAT6_RESTRICT_DIMS MDC_YES /* only square dim and max 256 (safe) */ #else #define MDC_ECAT6_RESTRICT_DIMS MDC_NO /* no square dim and no max (danger) */ #endif static Uint32 saved_mwidth; static Uint32 saved_mheight; static char MdcEcatDataTypes [MDC_MAX_ECATDATATYPES][MDC_MAX_ECATDATATYPES_SIZE]= {"Unknown","ByteData","VAX Int16","VAX Int32", "VAX float","IEEE float","SUN Int16","SUN Int32"}; static char MdcEcatFileTypes [MDC_MAX_ECATFILETYPES][MDC_MAX_ECATFILETYPES_SIZE]= {"Unknown","Sinogram","PetImage","Attenuation", "Normalization","Smooth File"}; static char MdcEcatAcquisitionTypes [MDC_MAX_ECATACQTYPES][MDC_MAX_ECATACQTYPES_SIZE]= {"Undefined","Blank","Transmission", "Static Emission","Dynamic Emission","Gated Emission", "Transmission Rectilinear","Emission Rectilinear", "Whole Body Transmission","Whole Body Static"}; static char MdcEcatFilterTypes [MDC_MAX_ECATFLTRTYPES][MDC_MAX_ECATFLTRTYPES_SIZE]= {"None","Ramp","Butter","Hann", "Hamm","Parzen","Shepp","Unknown"}; static char MdcEcatQuantificationUnits [MDC_MAX_ECATQUANTTYPES][MDC_MAX_ECATQUANTTYPES_SIZE]= {"Total Counts","Undefined", "ECAT counts/second/pixel","uCi/ml [1uCi = 37Bq]", "LMRGlu","LMRGlu umol/min/100g","LMRGlu mg/min/100g", "nCi/ml","Well counts","Becquerels","ml/min/100g", "ml/min/g"}; static Int16 MdcEcatSystemTypes[MDC_MAX_ECATSYSTEMTYPES]= {831, 911, 931, 933, 951, 953}; /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcCheckECAT6(FILEINFO *fi) { Mdc_Main_header mh; int i; if (mdc_mat_read_main_header(fi->ifp,&mh)) return MDC_BAD_READ; if (mh.system_type == MDC_ECAT6_SYST_TYPE) return MDC_FRMT_ECAT6; for (i=0; i < MDC_MAX_ECATSYSTEMTYPES; i++) { if (mh.system_type == MdcEcatSystemTypes[i]) return MDC_FRMT_ECAT6; } return MDC_FRMT_NONE; } const char *MdcReadECAT6(FILEINFO *fi) { FILE *fp = fi->ifp; IMG_DATA *id=NULL; DYNAMIC_DATA *dd=NULL; int i, error; const char *err; char *str; Uint32 bytes, img=0, found=0, number; Mdc_Main_header mh; Mdc_Image_subheader ish; Mdc_Scan_subheader ssh; Mdc_Attn_subheader ash; Mdc_Norm_subheader nsh; struct Mdc_MatDir entry, matrix_list[MDC_ECAT6_MAX_MATRICES]; struct Mdc_Matval matval; Int16 data_type=BIT16_S; int bed,gate,frame,plane,data=0,nb,ng,nf,np,nd; int matnum, startblk, endblk, num_matrices; float slice_position; if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Reading ECAT6:"); if (MDC_VERBOSE) MdcPrntMesg("ECAT6 Reading <%s> ...",fi->ifname); /* put some defaults we use */ fi->endian=MDC_FILE_ENDIAN=MDC_LITTLE_ENDIAN; fi->modality = M_PT; /* read the main header */ error = mdc_mat_read_main_header(fp, &mh); if (error) return("ECAT6 Bad read main header"); /* if (MDC_INFO_DB) { MdcPrintEcatInfoDB(&mh); return NULL; } */ if (MDC_INFO || MDC_INFO_DB) { MdcPrntScrn("Main Header (%d bytes)\n",MH_64_SIZE); MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("Original Filename : "); MdcPrintStr(mh.original_file_name); MdcPrntScrn("Software Version : %d\n",mh.sw_version); MdcPrntScrn("Data Type : %d ",mh.data_type); if ((mh.data_type > -1) && (mh.data_type < 8)) MdcPrntScrn("(= %s)\n",MdcEcatDataTypes[mh.data_type]); else MdcPrntScrn("(= Unknown)\n"); MdcPrntScrn("System Type : %d\n",mh.system_type); MdcPrntScrn("File Type : %d ",mh.file_type); if ((mh.file_type > -1) && (mh.file_type < 5)) MdcPrntScrn("(= %s)\n",MdcEcatFileTypes[mh.file_type]); else MdcPrntScrn("(= Unknown)\n"); MdcPrntScrn("Node Id : "); MdcPrintStr(mh.node_id); MdcPrntScrn("Scan Date - Day : %d\n",mh.scan_start_day); MdcPrntScrn(" - Month : %d\n",mh.scan_start_month); MdcPrntScrn(" - Year : %d\n",mh.scan_start_year); MdcPrntScrn(" - Hour : %d\n",mh.scan_start_hour); MdcPrntScrn(" - Minute : %d\n",mh.scan_start_minute); MdcPrntScrn(" - Second : %d\n",mh.scan_start_second); MdcPrntScrn("Isotope Code : "); MdcPrintStr(mh.isotope_code); MdcPrntScrn("Isotope Halflife : %f [sec]\n",mh.isotope_halflife); MdcPrntScrn("Radiopharmaceutical : "); MdcPrintStr(mh.radiopharmaceutical); MdcPrntScrn("Gantry Tilt : %f [degrees]\n",mh.gantry_tilt); MdcPrntScrn("Gantry Rotation : %f [degrees]\n" ,mh.gantry_rotation); MdcPrntScrn("Bed Elevation : %f [cm]\n",mh.bed_elevation); MdcPrntScrn("Rotating Source Speed : %d [revolutions/minute]\n" ,mh.rot_source_speed); MdcPrntScrn("Wobble Control Speed : %d [revolutions/minute]\n" ,mh.wobble_speed); MdcPrntScrn("Transmission Source : %d\n",mh.transm_source_type); MdcPrntScrn("Axial Field of View : %f [cm]\n",mh.axial_fov); MdcPrntScrn("Transaxial Field of View : %f [cm]\n",mh.transaxial_fov); MdcPrntScrn("Transaxial Sampling Mode : %d\n",mh.transaxial_samp_mode); MdcPrntScrn("Coincidence Sampling Mode: %d\n",mh.coin_samp_mode); MdcPrntScrn("Axial Sampling Mode : %d\n",mh.axial_samp_mode); MdcPrntScrn("Calibration Factor : %f\n",mh.calibration_factor); MdcPrntScrn("Calibration Units : %d ",mh.calibration_units); if ((mh.calibration_units > -1) && (mh.calibration_units < 12)) MdcPrntScrn("(= %s)\n" ,MdcEcatQuantificationUnits[mh.calibration_units]); else MdcPrntScrn("(= Unknown)\n"); MdcPrntScrn("Compression Code : %d\n",mh.compression_code); MdcPrntScrn("Study Name : "); MdcPrintStr(mh.study_name); MdcPrntScrn("Patient Id : "); MdcPrintStr(mh.patient_id); MdcPrntScrn("Patient Name : "); MdcPrintStr(mh.patient_name); MdcPrntScrn("Patient Sex : "); MdcPrintChar(mh.patient_sex); MdcPrntScrn("\n"); MdcPrntScrn("Patient Age : "); MdcPrintStr(mh.patient_age); MdcPrntScrn("Patient Height : "); MdcPrintStr(mh.patient_height); MdcPrntScrn("Patient Weight : "); MdcPrintStr(mh.patient_weight); MdcPrntScrn("Patient Dexterity : "); MdcPrintChar(mh.patient_dexterity); MdcPrntScrn("\n"); MdcPrntScrn("Physician Name : "); MdcPrintStr(mh.physician_name); MdcPrntScrn("Operator Name : "); MdcPrintStr(mh.operator_name); MdcPrntScrn("Study Description : "); MdcPrintStr(mh.study_description); MdcPrntScrn("Acquisition Type : %d ",mh.acquisition_type); if ((mh.acquisition_type > -1) && (mh.acquisition_type <= 9)) MdcPrntScrn("(= %s)\n",MdcEcatAcquisitionTypes[mh.acquisition_type]); else MdcPrntScrn("(= Unknown)\n"); MdcPrntScrn("Bed Type : %d\n",mh.bed_type); MdcPrntScrn("Septa Type : %d\n",mh.septa_type); MdcPrntScrn("Facility Name : "); MdcPrintStr(mh.facility_name); MdcPrntScrn("Number of Planes : %d\n",mh.num_planes); MdcPrntScrn("Number of Frames : %d\n",mh.num_frames); MdcPrntScrn("Number of Gates : %d\n",mh.num_gates); MdcPrntScrn("Number of Bed Positions : %d\n",mh.num_bed_pos); MdcPrntScrn("Initial Bed Position : %f [cm]\n",mh.init_bed_position); for (i=0; i<15; i++) MdcPrntScrn("Bed Offset[%02d] : %f [cm]\n",i+1 ,mh.bed_offset[i]); MdcPrntScrn("Plane Separation : %f [cm]\n",mh.plane_separation); MdcPrntScrn("Lower Scatter Treshold : %d [KeV]\n",mh.lwr_sctr_thres); MdcPrntScrn("Lower True Treshold : %d [KeV]\n",mh.lwr_true_thres); MdcPrntScrn("Upper True Treshold : %d [KeV]\n",mh.upr_true_thres); MdcPrntScrn("Collimator : %6.0f\n",mh.collimator); MdcPrntScrn("User Process Code : "); MdcPrintStr(mh.user_process_code); MdcPrntScrn("Acquisition Mode : %d\n",mh.acquisition_mode); } if (MDC_INFO_DB) return(NULL); /* just needed db info */ if ((mh.file_type!=MDC_ECAT6_SCAN_FILE) && (mh.file_type!=MDC_ECAT6_IMAGE_FILE) && (mh.file_type!=MDC_ECAT6_ATTN_FILE) && (mh.file_type!=MDC_ECAT6_NORM_FILE) ) return("ECAT6 Unsupported file type"); if (mh.num_frames <= 0 ) mh.num_frames = 1; if (mh.num_gates <= 0 ) mh.num_gates = 1; if (mh.num_bed_pos < 0 ) mh.num_bed_pos = 0; /* fill in global FILEINFO data */ fi->dim[0]= 6; fi->dim[3]= mh.num_planes; fi->dim[4]= mh.num_frames; fi->dim[5]= mh.num_gates; fi->dim[6]= mh.num_bed_pos + 1; /* must be 1-based */ #if MDC_NUM_BEDS_TWEAK /* double check num_bed_pos value due to */ /* inconsistent use as zero or one based */ bed = mh.num_bed_pos; while (!mdc_mat_lookup(fp,mdc_mat_numcod(1,1,1,0,bed),&entry) && (bed > 0)) { bed--; } fi->dim[6] = bed + 1; #endif /* check for unsupported bed overlap */ if (fi->dim[6] > 1) { float axial_width, bed_offset=mh.bed_offset[0]; if (bed_offset < 0) bed_offset = -bed_offset; axial_width = mh.plane_separation * (float)fi->dim[3]; if ((axial_width - bed_offset) >= 1.0) { MdcPrntWarn("ECAT6 Bed overlaps unsupported"); } } for (i=3, number=1; i<=6; i++) number*=fi->dim[i]; if (number == 0) return("ECAT6 No valid images specified"); /* fill in orientation information */ fi->pat_slice_orient = MDC_SUPINE_HEADFIRST_TRANSAXIAL; /* default! */ str = MdcGetStrPatPos(fi->pat_slice_orient); MdcStringCopy(fi->pat_pos,str,strlen(str)); if ( (strncmp(mh.user_process_code,"COR",10)==0) || (strncmp(mh.user_process_code,"SAG",10)==0)) { /* CORONAL SLICES or SAGITTAL SLICES The images Ecat 6.4 software writes are useless: 128x128 images with the small coronal/sagittal slice in it ... This means their pixel_xsize & pixel_ysize doesn't quite fit the real world dimensions any more !! Therefore we don't even try to attempt writing the proper orientation information. */ }else{ /* "TRA" or nothing TRANSAXIAL SLICES (Transverse) Writing the proper orientation information See man-page `m-acr.4' for more info (!) */ str = MdcGetStrPatOrient(fi->pat_slice_orient); MdcStringCopy(fi->pat_orient,str,strlen(str)); } /* fill in patient study related information */ fi->patient_sex[0] = mh.patient_sex; fi->patient_sex[1]='\0'; MdcStringCopy(fi->patient_name,mh.patient_name,32); MdcStringCopy(fi->patient_id,mh.patient_id,16); fi->patient_weight = (float)atof(mh.patient_weight); fi->patient_height = (float)atof(mh.patient_height); fi->study_date_day = mh.scan_start_day; fi->study_date_month = mh.scan_start_month; fi->study_date_year = mh.scan_start_year; fi->study_time_hour = mh.scan_start_hour; fi->study_time_minute= mh.scan_start_minute; fi->study_time_second= mh.scan_start_second; if ((mh.file_type==MDC_ECAT6_SCAN_FILE) || (mh.file_type==MDC_ECAT6_IMAGE_FILE)) { switch (mh.acquisition_type) { case MDC_ECAT6_ACQTYPE_UNKNOWN : fi->acquisition_type = MDC_ACQUISITION_UNKNOWN; break; case MDC_ECAT6_ACQTYPE_BLANK : fi->acquisition_type = MDC_ACQUISITION_UNKNOWN; break; case MDC_ECAT6_ACQTYPE_TRANSMISSION : fi->acquisition_type = MDC_ACQUISITION_TOMO; break; case MDC_ECAT6_ACQTYPE_STATIC_EMISSION : fi->acquisition_type = MDC_ACQUISITION_TOMO; break; case MDC_ECAT6_ACQTYPE_DYNAMIC_EMISSION : fi->acquisition_type = MDC_ACQUISITION_DYNAMIC; break; case MDC_ECAT6_ACQTYPE_GATED_EMISSION : fi->acquisition_type = MDC_ACQUISITION_GSPECT; break; case MDC_ECAT6_ACQTYPE_TRANSMISSION_RECT : fi->acquisition_type = MDC_ACQUISITION_UNKNOWN; break; case MDC_ECAT6_ACQTYPE_EMISSION_RECT : fi->acquisition_type = MDC_ACQUISITION_UNKNOWN; break; case MDC_ECAT6_ACQTYPE_WHOLE_BODY_TRANSM : fi->acquisition_type = MDC_ACQUISITION_UNKNOWN; break; case MDC_ECAT6_ACQTYPE_WHOLE_BODY_STATIC : fi->acquisition_type = MDC_ACQUISITION_TOMO; break; default: fi->acquisition_type = MDC_ACQUISITION_UNKNOWN; } }else{ fi->acquisition_type = MDC_ACQUISITION_UNKNOWN; } sprintf(mdcbufr,"ECAT%hd",mh.system_type); MdcStringCopy(fi->manufacturer,mdcbufr,strlen(mdcbufr)); MdcStringCopy(fi->operator_name,mh.operator_name,32); MdcStringCopy(fi->study_descr,mh.study_description,32); MdcStringCopy(fi->study_id,mh.study_name,12); MdcStringCopy(fi->institution,mh.facility_name,20); MdcStringCopy(fi->radiopharma,mh.radiopharmaceutical,32); MdcStringCopy(fi->isotope_code,mh.isotope_code,8); fi->isotope_halflife = mh.isotope_halflife; fi->gantry_tilt = mh.gantry_tilt; if (MDC_ECHO_ALIAS == MDC_YES) { MdcEchoAliasName(fi); return(NULL); } if (!MdcGetStructID(fi,number)) return("ECAT6 Bad malloc IMG_DATA structs"); /* always malloc dyndata structs */ if (!MdcGetStructDD(fi,(Uint32)fi->dim[4]*fi->dim[5]*fi->dim[6])) return("ECAT6 Couldn't malloc DYNAMIC_DATA structs"); /* always malloc beddata structs */ if (!MdcGetStructBD(fi,(unsigned)fi->dim[6])) return("ECAT6 Couldn't malloc BED_DATA structs"); /* fill in BED_DATA struct */ fi->beddata[0].hoffset = mh.init_bed_position * 10.; /* mm */ fi->beddata[0].voffset = mh.bed_elevation * 10.; /* mm */ for (i=1; ibednr; i++) { fi->beddata[i].hoffset = mh.init_bed_position + mh.bed_offset[i-1]; fi->beddata[i].hoffset *= 10.; /* mm */ fi->beddata[i].voffset = mh.bed_elevation * 10.; /* mm */ } /* ECAT6: matrices for each slice */ num_matrices = mdc_mat_list(fp, matrix_list, MDC_ECAT6_MAX_MATRICES); if (num_matrices == 0) return("ECAT6 No matrices found"); if ((Uint32)num_matrices > fi->number) return("ECAT6 Too many matrices found"); /* sort matrices */ if ( num_matrices > 1) { switch (MDC_ECAT6_SORT) { case MDC_ANATOMICAL: /* anatomical */ bed = fi->dim[6]; /* one based */ if (fi->dim[4] > 1) { mdc_plane_sort(matrix_list, num_matrices); }else{ mdc_anatomical_sort(matrix_list, num_matrices, &mh, bed); } break; case MDC_BYFRAME : /* by frame */ mdc_matnum_sort(matrix_list, num_matrices); break; } } for (bed=0; beddim[6]; bed++) for (gate=1; gate<=fi->dim[5]; gate++) for (frame=1; frame<=fi->dim[4]; frame++) for (plane=1; plane<=fi->dim[3]; plane++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); if (img == (Uint32)num_matrices) break; if (fi->dynnr > 0) dd = &fi->dyndata[(fi->dim[4]*bed) + (frame-1)]; mdc_mat_numdoc(matrix_list[img].matnum,&matval); nf = matval.frame; np = matval.plane; ng = matval.gate; nb = matval.bed; nd = matval.data; matnum = mdc_mat_numcod(nf,np,ng,nd,nb); if (!mdc_mat_lookup(fp, matnum, &entry)) continue; startblk = entry.strtblk + 1; endblk = entry.endblk - entry.strtblk; switch (mh.file_type) { case MDC_ECAT6_SCAN_FILE: error = mdc_mat_read_scan_subheader(fp, startblk-1, &ssh); if (error) return("ECAT6 Bad read scan subheader"); if (MDC_INFO) { MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("SINOGRAM SUBHEADER %05d: ",img+1); MdcPrntScrn("Frame: %d Plane: %d Gate: %d Data: %d Bed: %d\n" ,frame,plane,gate,data,bed); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Data Type : %d ",ssh.data_type); if ((ssh.data_type > -1) && (ssh.data_type < 8)) MdcPrntScrn("(= %s)\n",MdcEcatDataTypes[ssh.data_type]); else MdcPrntScrn("(= Unknown)\n"); MdcPrntScrn("Number of Elements : %d (width)\n",ssh.dimension_1); MdcPrntScrn("Number of Views : %d (height)\n",ssh.dimension_2); MdcPrntScrn("Smoothing : %d ",ssh.smoothing); switch (ssh.smoothing) { case 0: MdcPrntScrn("(= Not Smoothed)\n"); break; case 1: MdcPrntScrn("(= 9x9 Smoothing)\n"); break; default: MdcPrntScrn("(= Unknown)\n"); } MdcPrntScrn("Processing Code : %d\n",ssh.processing_code); MdcPrntScrn("Sample Distance : %f [cm]\n",ssh.sample_distance); MdcPrntScrn("Isotope Halflife : %f [sec]\n",ssh.isotope_halflife); MdcPrntScrn("Frame Duration (sec): %d [sec]\n" ,ssh.frame_duration_sec); MdcPrntScrn("Gate Duration : %d [ms]\n",ssh.gate_duration); MdcPrntScrn("R-Wave Offset : %d [ms]\n",ssh.r_wave_offset); MdcPrntScrn("Scale factor : %f\n",ssh.scale_factor); MdcPrntScrn("Minimum Scan Value : %d\n",ssh.scan_min); MdcPrntScrn("Maximum Scan Value : %d\n",ssh.scan_max); MdcPrntScrn("Total Prompts : %d\n",ssh.prompts); MdcPrntScrn("Total Delayed Events: %d\n",ssh.delayed); MdcPrntScrn("Total Multiples : %d\n",ssh.multiples); MdcPrntScrn("Total Net Trues : %d (Prompts - Random)\n" ,ssh.net_trues); for (i=0; i<16; i++) MdcPrntScrn("Corrected Singles [%2d] : %f\n",i+1 ,ssh.cor_singles[i]); for (i=0; i<16; i++) MdcPrntScrn("Uncorrected Singles [%2d] : %f\n",i+1 ,ssh.uncor_singles[i]); MdcPrntScrn("Total Average Corrected Singles: %f\n" ,ssh.tot_avg_cor); MdcPrntScrn("Total Average Uncorrected Singles: %f\n" ,ssh.tot_avg_uncor); MdcPrntScrn("Total Coincidence Rage : %d (from IPCP)\n" ,ssh.total_coin_rate); MdcPrntScrn("Frame Start Time : %d [ms]\n" ,ssh.frame_start_time); MdcPrntScrn("Frame Duration : %d [ms]\n" ,ssh.frame_duration); MdcPrntScrn("Loss Correction Factor : %f\n" ,ssh.loss_correction_fctr); for (i=0; i<8; i++) MdcPrntScrn("Phy_Planes [%d] : %d\n",i+1 ,ssh.phy_planes[i]); } /* fill in DYNAMIC_DATA struct */ if ((dd != NULL) && (plane == (fi->dim[3]/2))) { /* take values from a plane halfway */ dd->nr_of_slices = fi->dim[3]; dd->time_frame_start = (float)ssh.frame_start_time; dd->time_frame_duration = (float)ssh.frame_duration; } /* fill in IMG_DATA struct */ id = &fi->image[img]; id->width = (Uint32)ssh.dimension_1; id->height = (Uint32)ssh.dimension_2; id->quant_units = 1; id->quant_scale = 1; id->calibr_units= 1; id->calibr_fctr = 1; id->quant_scale = ssh.scale_factor; id->pixel_xsize = id->pixel_ysize = ssh.sample_distance * 10.;/* mm */ data_type = ssh.data_type; switch( data_type ) { case BYTE_TYPE: id->bits = 8; id->type = BIT8_U; break; case M68K_I2 : /* case SUN_I2 : */ case VAX_I2 : id->bits =16; id->type = BIT16_S; break; case M68K_I4 : /* case SUN_I4 : */ case VAX_I4 : id->bits =32; id->type = BIT32_S; break; case IEEE_R4 : /* case SUN_R4 : */ case VAX_R4 : id->bits =32; id->type = FLT32; break; } break; case MDC_ECAT6_IMAGE_FILE: error = mdc_mat_read_image_subheader(fp, startblk-1, &ish); if (error) return("ECAT6 Bad read image subheader"); if (MDC_INFO) { MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("IMAGE SUBHEADER %05d: ",img+1); MdcPrntScrn("Frame: %d Plane: %d Gate: %d Data: %d Bed: %d\n" ,frame,plane,gate,data,bed); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Data Type : %d ",ish.data_type); if ((ish.data_type > -1) && (ish.data_type < 8)) MdcPrntScrn("(= %s)\n",MdcEcatDataTypes[ish.data_type]); else MdcPrntScrn("(= Unknown)\n"); MdcPrntScrn("Number of Dimensions : %d\n",ish.num_dimensions); MdcPrntScrn("X Dimension : %d\n",ish.dimension_1); MdcPrntScrn("Y Dimension : %d\n",ish.dimension_2); MdcPrntScrn("X Offset : %f [cm]\n",ish.x_origin); MdcPrntScrn("Y Offset : %f [cm]\n",ish.y_origin); MdcPrntScrn("Recon Magnification Factor : %f\n",ish.recon_scale); MdcPrntScrn("Quantification Scale Factor : %e\n",ish.quant_scale); MdcPrntScrn("Image Minimum Pixel Value : %d\n",ish.image_min); MdcPrntScrn("Image Maximum Pixel Value : %d\n",ish.image_max); MdcPrntScrn("Pixel Size : %f [cm]\n",ish.pixel_size); MdcPrntScrn("Slice Width : %f [cm]\n",ish.slice_width); MdcPrntScrn("Frame Duration : %d [ms]\n",ish.frame_duration); MdcPrntScrn("Frame Start Time : %d [ms]\n",ish.frame_start_time); MdcPrntScrn("Slice Location : %d [cm]\n",ish.slice_location); MdcPrntScrn("Recon Start Hour : %d\n",ish.recon_start_hour); MdcPrntScrn("Recon Start Minute : %d\n",ish.recon_start_minute); MdcPrntScrn("Recon Start Second : %d\n",ish.recon_start_sec); MdcPrntScrn("Gate Duration : %d [ms]\n",ish.gate_duration); MdcPrntScrn("Filter code : %d ",ish.filter_code); ish.filter_code = abs(ish.filter_code); if ((ish.filter_code > -1) && (ish.filter_code < 7)) MdcPrntScrn("(= %s)\n",MdcEcatFilterTypes[ish.filter_code]); else MdcPrntScrn("(= Unknown)\n"); MdcPrntScrn("Scan Matrix Number : %d\n",ish.scan_matrix_num); MdcPrntScrn("Normalization Matrix Number : %d\n",ish.norm_matrix_num); MdcPrntScrn("Attenuation Matrix Number : %d\n" ,ish.atten_cor_matrix_num); MdcPrntScrn("Image Rotation : %f [degrees]\n" ,ish.image_rotation); MdcPrntScrn("Plane Efficiency Correction Factor: %f\n" ,ish.plane_eff_corr_fctr); MdcPrntScrn("Decay Correction Factor : %f\n",ish.decay_corr_fctr); MdcPrntScrn("Loss Correction Factor : %f\n",ish.loss_corr_fctr); MdcPrntScrn("Processing Code : %d\n",ish.processing_code); MdcPrntScrn("Quantification Units : %d ",ish.quant_units); if ((ish.quant_units > -1) && (ish.quant_units < 13)) MdcPrntScrn("(= %s)\n",MdcEcatQuantificationUnits[ish.quant_units]); else MdcPrntScrn("(= Unknown)\n"); MdcPrntScrn("Reconstruction Start Day : %d\n",ish.recon_start_day); MdcPrntScrn("Reconstruction Start Month : %d\n" ,ish.recon_start_month); MdcPrntScrn("Reconstruction Start Year : %d\n" ,ish.recon_start_year); MdcPrntScrn("Ecat Calibration Factor : %f\n" ,ish.ecat_calibration_fctr); MdcPrntScrn("Well Counter Calibribration Factor : %f\n" ,ish.well_counter_cal_fctr); MdcPrntScrn("Filter Params - Cutoff Frequency : %f\n" ,ish.filter_params[0]); MdcPrntScrn("Filter Params - DC Component : %f\n" ,ish.filter_params[1]); MdcPrntScrn("Filter Params - Ramp Slope : %f\n" ,ish.filter_params[2]); MdcPrntScrn("Filter Params - (4) : %f\n" ,ish.filter_params[3]); MdcPrntScrn("Filter Params - Scatter Comp 1 : %f\n" ,ish.filter_params[4]); MdcPrntScrn("Filter Params - Scatter Comp 2 : %f\n" ,ish.filter_params[5]); MdcPrntScrn("Annotation : "); MdcPrintStr(ish.annotation); } /* fill in DYNAMIC_DATA struct */ if ((dd != NULL) && (plane == (fi->dim[3]/2))) { /* take values from a plane halfway */ dd->nr_of_slices = fi->dim[3]; dd->time_frame_start = (float)ish.frame_start_time; dd->time_frame_duration = (float)ish.frame_duration; } /* fill in IMG_DATA struct */ id = &fi->image[img]; id->width = (Uint32)ish.dimension_1; id->height = (Uint32)ish.dimension_2; id->recon_scale = ish.recon_scale; id->quant_units = ish.quant_units; id->quant_scale = ish.quant_scale; id->calibr_units= mh.calibration_units; id->calibr_fctr = ish.ecat_calibration_fctr; id->pixel_xsize = id->pixel_ysize = ish.pixel_size * 10.; /* in mm */ id->slice_width = ish.slice_width * 10.; /* in mm */ data_type = ish.data_type; switch( data_type ) { case BYTE_TYPE: id->bits = 8; id->type = BIT8_U; break; case M68K_I2 : /* case SUN_I2 : */ case VAX_I2 : id->bits =16; id->type = BIT16_S; break; case M68K_I4 : /* case SUN_I4 : */ case VAX_I4 : id->bits =32; id->type = BIT32_S; break; case IEEE_R4 : /* case SUN_R4 : */ case VAX_R4 : id->bits =32; id->type = FLT32; break; } id->slice_spacing = mh.plane_separation*10.; /* separation in mm */ if ( (strncmp(mh.user_process_code,"COR",10)==0) || (strncmp(mh.user_process_code,"SAG",10)==0)) { /* CORONAL SLICES or SAGITTAL SLICES The images Ecat 6.4 software writes are useless: 128x128 images with the small coronal/sagittal slice in it ... This means their pixel_xsize & pixel_ysize doesn't quite fit the real world dimensions any more !! Therefore we don't even try to attempt writing the proper Acr/Nema variables ... */ }else{ /* "TRA" or nothing */ /* TRANSAXIAL SLICES (Transverse) */ /* Writing the proper Acr/Nema variables ... */ /* See man-page `m-acr.4' for more info (!) */ /* slice position with bed offset (mm) */ if (bed == 0) { slice_position = mh.init_bed_position; }else{ slice_position = mh.init_bed_position + mh.bed_offset[bed-1]; } slice_position *= 10.; /* mm */ MdcFillImgPos(fi,img,(Uint32)(plane-1),slice_position); MdcFillImgOrient(fi,img); } break; case MDC_ECAT6_ATTN_FILE: error = mdc_mat_read_attn_subheader(fp, startblk-1, &ash); if (error) return("ECAT6 Bad read attenuation subheader"); if (MDC_INFO) { MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("ATTENUATION SUBHEADER %05d: ",img+1); MdcPrntScrn("Frame: %d Plane: %d Gate: %d Data: %d Bed: %d\n" ,frame,plane,gate,data,bed); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Data Type : %d ",ash.data_type); if ((ash.data_type > -1) && (ash.data_type < 8)) MdcPrntScrn("(= %s)\n",MdcEcatDataTypes[ash.data_type]); else MdcPrntScrn("(= Unknown)\n"); MdcPrntScrn("Attenuation Correction Method : %d\n" ,ash.attenuation_type); MdcPrntScrn("Number of Elements : %d (width)\n" ,ash.dimension_1); MdcPrntScrn("Number of Views : %d (height)\n" ,ash.dimension_2); MdcPrntScrn("Attenuation Scale Factor : %f\n",ash.scale_factor); MdcPrntScrn("Ellipse X Offset : %f [cm]\n" ,ash.x_origin); MdcPrntScrn("Ellipse Y Offset : %f [cm]\n" ,ash.y_origin); MdcPrntScrn("Ellipse X Radius : %f [cm]\n" ,ash.x_radius); MdcPrntScrn("Ellipse Y Radius : %f [cm]\n" ,ash.y_radius); MdcPrntScrn("Ellipse Tilt Angle : %f [degrees]\n" ,ash.tilt_angle); MdcPrntScrn("Mu-Absorption Coefficient : %f [1/cm]\n" ,ash.attenuation_coeff); MdcPrntScrn("Sample Distance : %f [cm]\n" ,ash.sample_distance); } /* fill in IMG_DATA struct */ id = &fi->image[img]; id->width = (Uint32)ash.dimension_1; id->height = (Uint32)ash.dimension_2; id->quant_units = 1; id->quant_scale = 1; id->calibr_units= 1; id->calibr_fctr = 1; id->quant_scale = ash.scale_factor; data_type = ash.data_type; switch( data_type ) { case BYTE_TYPE: id->bits = 8; id->type = BIT8_U; break; case M68K_I2 : /* case SUN_I2 : */ case VAX_I2 : id->bits =16; id->type = BIT16_S; break; case M68K_I4 : /* case SUN_I4 : */ case VAX_I4 : id->bits =32; id->type = BIT32_S; break; case IEEE_R4 : /* case SUN_R4 : */ case VAX_R4 : id->bits =32; id->type = FLT32; break; } break; case MDC_ECAT6_NORM_FILE: error = mdc_mat_read_norm_subheader(fp, startblk-1, &nsh); if (error) return("ECAT6 Bad read normalization subheader"); if (MDC_INFO) { MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("NORMALIZATION SUBHEADER %05d: ",img+1); MdcPrntScrn("Frame: %d Plane: %d Gate: %d Data: %d Bed: %d\n" ,frame,plane,gate,data,bed); MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("Data Type : %d ",nsh.data_type); if ((nsh.data_type > -1) && (nsh.data_type < 8)) MdcPrntScrn("(= %s)\n",MdcEcatDataTypes[nsh.data_type]); else MdcPrntScrn("(= Unknown)\n"); MdcPrntScrn("Number of Elements : %d (width)\n",nsh.dimension_1); MdcPrntScrn("Number of Views : %d (height)\n",nsh.dimension_2); MdcPrntScrn("Normalization Scale Factor : %f\n",nsh.scale_factor); MdcPrntScrn("Normalization Start Hour : %d\n",nsh.norm_hour); MdcPrntScrn("Normalization Start Minute : %d\n",nsh.norm_minute); MdcPrntScrn("Normalization Start Second : %d\n",nsh.norm_second); MdcPrntScrn("Normalization Start Day : %d\n",nsh.norm_day); MdcPrntScrn("Normalization Start Month : %d\n",nsh.norm_month); MdcPrntScrn("Normalization Start Year : %d\n",nsh.norm_year); MdcPrntScrn("Field of View Source Width : %f [cm]\n" ,nsh.fov_source_width); MdcPrntScrn("Ecat Calibration Factor : %f\n" ,nsh.ecat_calib_factor); } /* fill in IMG_DATA struct */ id = &fi->image[img]; id->width = (Uint32)nsh.dimension_1; id->height = (Uint32)nsh.dimension_2; id->quant_units = 1; id->quant_scale = nsh.scale_factor; id->calibr_units= mh.calibration_units; id->calibr_fctr = nsh.ecat_calib_factor; data_type = nsh.data_type; switch( data_type ) { case BYTE_TYPE: id->bits = 8; id->type = BIT8_U; break; case M68K_I2 : /* case SUN_I2 : */ case VAX_I2 : id->bits =16; id->type = BIT16_S; break; case M68K_I4 : /* case SUN_I4 : */ case VAX_I4 : id->bits =32; id->type = BIT32_S; break; case IEEE_R4 : /* case SUN_R4 : */ case VAX_R4 : id->bits =32; id->type = FLT32; break; } break; } bytes = id->width*id->height*MdcType2Bytes(id->type); bytes = MdcMatrixBlocks(bytes); id->buf = MdcGetImgBuffer(bytes); if (id->buf == NULL) return("ECAT6 Bad malloc image buffer"); error = mdc_mat_read_matrix_data(fp,startblk,endblk,(Int16 *)id->buf); if (error) { MdcPrntWarn("ECAT6 Bad read matrix data"); err=MdcHandleTruncated(fi,img+1,MDC_YES); if(err != NULL) return(err); } if (fi->truncated) break; img+=1; } /* check the images really found */ if (num_matrices < fi->number) { found = (Uint32)num_matrices; }else if (img < fi->number) { found = img; }else { found = fi->number; } if (found != fi->number) { err=MdcHandleTruncated(fi,found,MDC_YES); if (err != NULL) return(err); } /* fill in other FILEINFO variables */ id = &fi->image[0]; /* first image */ fi->dim[1] = id->width; fi->dim[2] = id->height; fi->bits = id->bits; fi->type = id->type; fi->pixdim[0]=3; fi->pixdim[1]=id->pixel_xsize; fi->pixdim[2]=id->pixel_ysize; fi->pixdim[3]=id->slice_width; if (mh.file_type == MDC_ECAT6_IMAGE_FILE) { MdcStringCopy(fi->filter_type,MdcEcatFilterTypes[abs(ish.filter_code)], MDC_MAX_ECATFLTRTYPES_SIZE); fi->reconstructed = MDC_YES; if (ish.decay_corr_fctr > 1.0 ) fi->decay_corrected = MDC_YES; MdcStringCopy(fi->recon_method,ish.annotation,strlen(ish.annotation)); if (strcmp(fi->recon_method,MDC_ECAT6_RECON_METHOD) == 0 ) { strcpy(fi->recon_method,"Filtered Backprojection"); } }else{ fi->reconstructed = MDC_NO; strcpy(fi->recon_method,"None"); } switch( data_type ) { case BYTE_TYPE: MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; break; /* case SUN_I2 : */ case M68K_I2 : MDC_FILE_ENDIAN = MDC_BIG_ENDIAN; break; case VAX_I2 : MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; break; /* case SUN_I4 : */ case M68K_I4 : MDC_FILE_ENDIAN = MDC_BIG_ENDIAN; break; case VAX_I4 : MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; break; /* case SUN_R4 : */ case IEEE_R4 : MDC_FILE_ENDIAN = MDC_BIG_ENDIAN; break; case VAX_R4 : MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; break; } MdcCloseFile(fi->ifp); if (fi->truncated) return("ECAT6 Truncated image file"); return NULL; } float MdcGetSliceLocation(FILEINFO *fi, Int32 img) { int orient; float locat=0.; orient = MdcGetIntSliceOrient((int)fi->pat_slice_orient); switch (orient) { case MDC_TRANSAXIAL: /* z-coord */ locat = fi->image[img].image_pos_pat[2]; break; case MDC_SAGITTAL : /* x-coord */ locat = fi->image[img].image_pos_pat[0]; break; case MDC_CORONAL : /* y-coord */ locat = fi->image[img].image_pos_pat[1]; break; } if (locat < 0.) locat = -locat; return(locat / 10.); /* cm */ } int MdcGetFilterCode(char *string) { int i = 0; for (i=0; iimage[0]; int i; float init_bed_position=0.; /* memset(mh,0,MH_64_SIZE); */ memset(mh,0,sizeof(Mdc_Main_header)); sprintf(mh->original_file_name,"%.19s",fi->ofname); mh->sw_version = 6; mh->system_type= 951; mh->file_type = 2; mh->data_type = 2; /* ECAT 6 only reads VAX Int16 */ sprintf(mh->isotope_code,"%.7s",fi->isotope_code); mh->isotope_halflife = fi->isotope_halflife; sprintf(mh->radiopharmaceutical,"%.31s",fi->radiopharma); mh->calibration_units = fi->image[0].calibr_units; if (fi->pixdim[0] >= 3.) /* only valid for TRANSVERSE slices */ mh->axial_fov = ((float)fi->dim[3] + 1.) * fi->pixdim[3] / 10.; mh->scan_start_day = fi->study_date_day; mh->scan_start_month = fi->study_date_month; mh->scan_start_year = fi->study_date_year; mh->scan_start_hour = fi->study_time_hour; mh->scan_start_minute= fi->study_time_minute; mh->scan_start_second= fi->study_time_second; mh->plane_separation = fi->image[0].slice_spacing/10.; /* in cm */ sprintf(mh->study_name,"%.11s",fi->study_id); mh->gantry_tilt = fi->gantry_tilt; sprintf(mh->patient_id,"%.15s",fi->patient_id); if (fi->patient_height == 0.) { mh->patient_height[0] = '\0'; }else{ sprintf(mh->patient_height,"%.2f",fi->patient_height); } if (fi->patient_weight == 0.) { mh->patient_weight[0] = '\0'; }else{ sprintf(mh->patient_weight,"%.2f",fi->patient_weight); } sprintf(mh->patient_name,"%.31s",fi->patient_name); mh->patient_sex = fi->patient_sex[0]; sprintf(mh->operator_name,"%.31s",fi->operator_name); sprintf(mh->study_description,"%.31s",fi->study_descr); switch (fi->acquisition_type ) { case MDC_ACQUISITION_STATIC : mh->acquisition_type = MDC_ECAT6_ACQTYPE_STATIC_EMISSION; break; case MDC_ACQUISITION_TOMO : mh->acquisition_type = MDC_ECAT6_ACQTYPE_STATIC_EMISSION; break; case MDC_ACQUISITION_DYNAMIC: mh->acquisition_type = MDC_ECAT6_ACQTYPE_DYNAMIC_EMISSION; break; case MDC_ACQUISITION_GSPECT : mh->acquisition_type = MDC_ECAT6_ACQTYPE_GATED_EMISSION; break; default : mh->acquisition_type = MDC_ECAT6_ACQTYPE_UNKNOWN; } sprintf(mh->facility_name,"%.19s",fi->institution); sprintf(mh->user_process_code,"%.9s",MDC_PRGR); mh->num_planes = mh->num_frames = mh->num_gates = 1; mh->num_bed_pos = 1; for ( i=3; i<=fi->dim[0]; i++) { switch (i) { case 3: mh->num_planes = fi->dim[i]; break; case 4: mh->num_frames = fi->dim[i]; break; case 5: mh->num_gates = fi->dim[i]; break; case 6: mh->num_bed_pos = fi->dim[i]; break; case 7: mh->num_bed_pos*= fi->dim[i]; break; } } mh->num_bed_pos -= 1; /* zero-based */ /* bed positions */ if ((fi->bednr > 0) && (fi->beddata != NULL)) { /* use preserved bed offsets */ mh->init_bed_position = fi->beddata[0].hoffset / 10.; /* cm */ mh->bed_elevation = fi->beddata[0].voffset / 10.; /* cm */ for (i=1; ibednr; i++) { if ( i==16 ) { MdcPrntWarn("ECAT6 Unsupported number of bed positions"); break; } mh->bed_offset[i-1] = fi->beddata[i].hoffset - fi->beddata[0].hoffset; mh->bed_offset[i-1] /= 10.; /* cm */ } }else{ /* guess bad offsets, assume adjacent bed positions */ switch (MdcGetIntSliceOrient(fi->pat_slice_orient)) { case MDC_TRANSAXIAL: init_bed_position = dd0->image_pos_pat[2]; /* x */ break; case MDC_CORONAL : init_bed_position = dd0->image_pos_pat[1]; /* y */ break; case MDC_SAGITTAL : init_bed_position = dd0->image_pos_pat[0]; /* z */ break; } if (init_bed_position < 0.) init_bed_position *= -1.; if (init_bed_position > dd0->slice_width) init_bed_position -= dd0->slice_width; mh->init_bed_position = init_bed_position / 10.; /* cm */ for (i=1; idim[6]; i++) { mh->bed_offset[i-1] = dd0->slice_width * (float)(fi->dim[3] * i / 10); } } } void MdcFillImageSubHeader(FILEINFO *fi,Mdc_Image_subheader *ish ,int type,Int32 img, Int32 matnum, Uint32 NEWSIZE) { IMG_DATA *id = &fi->image[img]; Uint32 fnr; Int32 fstart=0, fduration=0; /* memset(ish,0,ISH_64_SIZE); */ memset(ish,0,sizeof(Mdc_Image_subheader)); fnr = id->frame_number; if ((fi->dynnr > 0) && (fnr > 0)) { fstart = (Int32)fi->dyndata[fnr-1].time_frame_start; fduration = (Int32)fi->dyndata[fnr-1].time_frame_duration; }else{ fstart = 0; fduration = 0; } ish->data_type = 2; /* ECAT 6 only reads VAX Int16 */ ish->num_dimensions = 2; if (fi->diff_size || NEWSIZE) { ish->dimension_1 = fi->mwidth; ish->dimension_2 = fi->mheight; }else{ ish->dimension_1 = id->width; ish->dimension_2 = id->height; } ish->recon_scale = id->recon_scale; if (ish->data_type == 1 || ish->data_type == 2) { if (id->rescaled) { ish->image_min = (Int16) id->rescaled_min; ish->image_max = (Int16) id->rescaled_max; }else{ ish->image_min = (Int16) id->min; ish->image_max = (Int16) id->max; } }else{ /* data types too big for an Int16 */ ish->image_min = 0; ish->image_max = 0; } ish->pixel_size = ((id->pixel_xsize + id->pixel_ysize)/2.) / 10.; ish->slice_width = id->slice_width / 10.; #ifdef MDC_USE_SLICE_SPACING if (fi->number > 1) ish->slice_width = id->slice_spacing / 10.; #endif ish->frame_duration = fduration; ish->frame_start_time = fstart; ish->slice_location = (Int16)MdcGetSliceLocation(fi,img); ish->filter_code = -(MdcGetFilterCode(fi->filter_type)); ish->scan_matrix_num = matnum; ish->norm_matrix_num = matnum; ish->atten_cor_matrix_num = matnum; ish->quant_units = id->quant_units; if (id->rescaled) { ish->quant_scale = id->rescaled_fctr; ish->ecat_calibration_fctr = 1.; }else{ ish->quant_scale = id->quant_scale; ish->ecat_calibration_fctr = id->calibr_fctr; } if (strcmp(fi->recon_method,"Filtered Backprojection") == 0 ) { sprintf(ish->annotation,"%.39s",MDC_ECAT6_RECON_METHOD); }else{ sprintf(ish->annotation,"%.39s",fi->recon_method); } } static void MdcResetSizes(FILEINFO *fi) { fi->mwidth = saved_mwidth; fi->mheight= saved_mheight; } const char *MdcWriteECAT6(FILEINFO *fi) { IMG_DATA *id; Mdc_Main_header mh; Mdc_Image_subheader ish; Uint8 *buf, *maxbuf; Uint16 type, FREE; Int32 matnum, data=0, bed, gate, frame, plane, img=0; Uint32 size, NEWSIZE=0; if (MDC_FILE_STDOUT == MDC_YES) return("ECAT6 Writing to stdout unsupported for this format"); MDC_WRITE_ENDIAN = MDC_LITTLE_ENDIAN; /* always (VAX) */ if (XMDC_GUI == MDC_NO) { MdcDefaultName(fi,MDC_FRMT_ECAT6,fi->ofname,fi->ifname); } if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Writing ECAT6:"); if (MDC_VERBOSE) MdcPrntMesg("ECAT6 Writing <%s> ...",fi->ofname); /* check for colored files */ if (fi->map == MDC_MAP_PRESENT) return("ECAT6 Colored files unsupported"); if (MdcKeepFile(fi->ofname)) { return("ECAT6 File exists!!"); } if (MDC_FORCE_INT != MDC_NO) { if (MDC_FORCE_INT != BIT16_S) { MdcPrntWarn("ECAT6 Only Int16 pixels supported"); } } /* check some integrities */ /* check integrity of planes, frames, gates, beds */ if (fi->dim[3] > MDC_ECAT6_MAX_PLANES) return("ECAT6 number of planes too big (1024)"); if (fi->dim[4] > MDC_ECAT6_MAX_FRAMES) return("ECAT6 number of frames too big (512)"); if (fi->dim[5] > MDC_ECAT6_MAX_GATES) return("ECAT6 number of gates too big (64)"); if ((fi->dim[6]*fi->dim[7]) > MDC_ECAT6_MAX_BEDS) return("ECAT6 number of beds too big (16)"); #if MDC_ECAT6_RESTRICT_DIMS /* check dimensions (ECAT only 64, 128, 256) */ /* we don't do downsaling */ if (fi->mwidth > MDC_ECAT6_MAX_DIMS || fi->mheight > MDC_ECAT6_MAX_DIMS) return("ECAT6 dimensions too big (256)"); #endif /* get maximum dimension */ if (fi->mwidth > fi->mheight) size = fi->mwidth; else size = fi->mheight; #if MDC_ECAT6_RESTRICT_DIMS /* allow only 64, 128, 256 */ if (size <= 64) NEWSIZE=64; else if (size <= 128) NEWSIZE=128; else if (size <= 256) NEWSIZE=256; #endif /* save the original dimensions anyway */ saved_mwidth = fi->mwidth; saved_mheight= fi->mheight; /* change to new dimensions */ if (NEWSIZE) { fi->mwidth = NEWSIZE; fi->mheight= NEWSIZE; } MdcFillMainHeader(fi,&mh); if ( (fi->ofp = mdc_mat_create(fi->ofname,&mh)) == NULL) { MdcResetSizes(fi); return("Couldn't create file"); } for (bed=0; bed <= mh.num_bed_pos; bed++) for (gate=1; gate <= mh.num_gates; gate++) for (frame=1; frame <= mh.num_frames; frame++) for (plane=1; plane <= mh.num_planes; plane++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); id = &fi->image[img]; if ((id->type != BIT16_S) || MDC_QUANTIFY || MDC_CALIBRATE) { buf = MdcGetImgBIT16_S(fi, (Uint32)img); FREE=MDC_YES; type=BIT16_S; }else{ buf = id->buf; FREE=MDC_NO; type=id->type; } matnum = mdc_mat_numcod(frame,plane,gate,data,bed); MdcFillImageSubHeader(fi,&ish,type,img,matnum,NEWSIZE); if (fi->diff_size || NEWSIZE) { size = fi->mwidth * fi->mheight * MdcType2Bytes(type); maxbuf = MdcGetResizedImage(fi, buf, type, (Uint32)img); if (maxbuf == NULL) { MdcResetSizes(fi); return("ECAT6 Bad malloc maxbuf"); } if (FREE) MdcFree(buf); FREE=MDC_YES; }else{ /* NEWSIZE is normally always set */ size = id->width * id->height * MdcType2Bytes(type); maxbuf = buf; } matnum = mdc_mat_numcod(frame,plane,gate,data,bed); if (mdc_mat_write_image(fi->ofp,matnum,&ish,(Uint16 *)maxbuf,(Int32)size)) { MdcResetSizes(fi); return("ECAT6 Bad write image matrix"); } img+=1; if (FREE) MdcFree(maxbuf); } MdcCheckQuantitation(fi); MdcCloseFile(fi->ofp); MdcResetSizes(fi); return NULL; } void MdcPrintEcatInfoDB(Mdc_Main_header *mh) { char Unknown[8]="Unknown"; Uint32 i, patient_strlen, study_strlen; patient_strlen = strlen(mh->patient_name); study_strlen = strlen(mh->study_name); /* remove # from strings, because it is used as field separator! */ for (i=0; ipatient_name[i] == '#' ) { mh->patient_name[i]='$'; } } /* print database info: study_name */ if (study_strlen != 6) { MdcPrntScrn("%s",Unknown); }else{ MdcPrntScrn("%s",mh->study_name); } MdcPrntScrn("# "); /* print database info: patient_name */ if (patient_strlen == 0) { MdcPrntScrn("%-35s",Unknown); }else{ MdcPrntScrn("%-35s",mh->patient_name); } MdcPrntScrn("#"); /* print database info: scan date */ MdcPrntScrn("%02d-",mh->scan_start_day); switch (mh->scan_start_month) { case 1: MdcPrntScrn("Jan"); break; case 2: MdcPrntScrn("Feb"); break; case 3: MdcPrntScrn("Mar"); break; case 4: MdcPrntScrn("Apr"); break; case 5: MdcPrntScrn("May"); break; case 6: MdcPrntScrn("Jun"); break; case 7: MdcPrntScrn("Jul"); break; case 8: MdcPrntScrn("Aug"); break; case 9: MdcPrntScrn("Sep"); break; case 10: MdcPrntScrn("Oct"); break; case 11: MdcPrntScrn("Nov"); break; case 12: MdcPrntScrn("Dec"); break; } MdcPrntScrn("-%4d",mh->scan_start_year); MdcPrntScrn("\n"); } xmedcon-0.14.1/source/xoptions.c0000644000175000017510000017766112636253502013531 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xoptions.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : handle (X)MedCon options routines * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcOptionsMedconCallbackApply() - Options Apply callback* * XMdcOptionsMedconAddTabPixels() - Add Pixels tab * * XMdcOptionsMedconAddTabFiles() - Add Files tab * * XMdcOptionsMedconAddTabSlices() - Add Slices tab * * XMdcOptionsMedconAddTabFormats() - Add Formats tab * * XMdcOptionsMedconAddTabMosaic() - Add Mosaic tab * * XMdcOptionsMedconSel() - Options Medcon select * * XMdcOptionsRenderSel() - Options Render select * * XMdcOptionsResizeSel() - Options Resize select * * XMdcOptionsColorMapSel() - Options Map select * * XMdcOptionsLabelSel() - Options Label select * * XMdcOptionsPagesSel() - Options Pages select * * XMdcOptionsMapPlaceSel() - Options Place select * * XMdcSensitiveBitsUsed12() - Sensitive button * * XMdcUnsensitveBitsUsed12() - Unsensitive button * * XMdcToggleSensitivityMosaic() - Toggle mosaic * * XMdcToggleSensitivityForced() - Toggle mosaic forced * * XMdcInitMosaicFrame() - Init mosaic frame * * XMdcToggleSensitivityCine() - Toggle cine * * XMdcInitCineButtons() - Init cine buttons * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xoptions.c,v 1.77 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include #include "xmedcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ static GtkWidget *woption=NULL; static GtkWidget *wmosaic=NULL; static GtkWidget *wforced=NULL; static GtkWidget *wlabel=NULL; /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcOptionsMedconCallbackApply(GtkWidget *widget, gpointer data) { GtkSpinButton *spin; /* Pixel Sign */ if (GTK_TOGGLE_BUTTON(sOptionsMedCon.PixPositives)->active) { MDC_NEGATIVE=MDC_NO; }else if (GTK_TOGGLE_BUTTON(sOptionsMedCon.PixNegatives)->active) { MDC_NEGATIVE=MDC_YES; } /* Pixel Value */ MDC_QUANTIFY = MDC_NO; MDC_CALIBRATE = MDC_NO; if (GTK_TOGGLE_BUTTON(sOptionsMedCon.PixNoQuant)->active) { MDC_QUANTIFY = MDC_NO; MDC_CALIBRATE = MDC_NO; }else if (GTK_TOGGLE_BUTTON(sOptionsMedCon.PixQuantify)->active) { MDC_QUANTIFY=MDC_YES; }else if (GTK_TOGGLE_BUTTON(sOptionsMedCon.PixCalibrate)->active) { MDC_CALIBRATE=MDC_YES; } /* Pixel Types */ if (GTK_TOGGLE_BUTTON(sOptionsMedCon.PixTypeNONE)->active) { MDC_FORCE_INT=MDC_NO; }else if (GTK_TOGGLE_BUTTON(sOptionsMedCon.PixTypeBIT8_U)->active) { MDC_FORCE_INT=BIT8_U; }else if (GTK_TOGGLE_BUTTON(sOptionsMedCon.PixTypeBIT16_S)->active) { MDC_FORCE_INT=BIT16_S; } if (GTK_TOGGLE_BUTTON(sOptionsMedCon.BitsUsed12)->active) { MDC_INT16_BITS_USED = 12; }else{ MDC_INT16_BITS_USED = 16; } if (MDC_FORCE_INT != MDC_NO) { if (MDC_QUANTIFY || MDC_CALIBRATE) XMdcDisplayWarn("Quantified values could get lost (integer pixel write)"); } /* File Endian Type */ if (GTK_TOGGLE_BUTTON(sOptionsMedCon.FileTypeLITTLE)->active) { MDC_WRITE_ENDIAN = MDC_LITTLE_ENDIAN; }else if (GTK_TOGGLE_BUTTON(sOptionsMedCon.FileTypeBIG)->active) { MDC_WRITE_ENDIAN = MDC_BIG_ENDIAN; } /* Flipping - Sorting*/ if (GTK_TOGGLE_BUTTON(sOptionsMedCon.FlipHoriz)->active) { MDC_FLIP_HORIZONTAL = MDC_YES; }else{ MDC_FLIP_HORIZONTAL = MDC_NO; } if (GTK_TOGGLE_BUTTON(sOptionsMedCon.FlipVert)->active) { MDC_FLIP_VERTICAL = MDC_YES; }else{ MDC_FLIP_VERTICAL = MDC_NO; } if (GTK_TOGGLE_BUTTON(sOptionsMedCon.SortReverse)->active) { MDC_SORT_REVERSE = MDC_YES; }else{ MDC_SORT_REVERSE = MDC_NO; } if (GTK_TOGGLE_BUTTON(sOptionsMedCon.SortCine)->active) { if (GTK_TOGGLE_BUTTON(sOptionsMedCon.SortCineApply)->active) { MDC_SORT_CINE_APPLY = MDC_YES; }else{ MDC_SORT_CINE_APPLY = MDC_NO; } if (GTK_TOGGLE_BUTTON(sOptionsMedCon.SortCineUndo)->active) { MDC_SORT_CINE_UNDO = MDC_YES; }else{ MDC_SORT_CINE_UNDO = MDC_NO; } }else{ MDC_SORT_CINE_APPLY = MDC_NO; MDC_SORT_CINE_UNDO = MDC_NO; } /* Matrix */ /* Image Flipping */ if (GTK_TOGGLE_BUTTON(sOptionsMedCon.MakeSqrNo)->active) { MDC_MAKE_SQUARE = MDC_NO; }else if (GTK_TOGGLE_BUTTON(sOptionsMedCon.MakeSqr1)->active) { MDC_MAKE_SQUARE = MDC_TRANSF_SQR1; }else if (GTK_TOGGLE_BUTTON(sOptionsMedCon.MakeSqr2)->active) { MDC_MAKE_SQUARE = MDC_TRANSF_SQR2; } /* Normalization */ if (GTK_TOGGLE_BUTTON(sOptionsMedCon.NormOverFrames)->active) { MDC_NORM_OVER_FRAMES=MDC_YES; }else if (GTK_TOGGLE_BUTTON(sOptionsMedCon.NormOverAll)->active) { MDC_NORM_OVER_FRAMES=MDC_NO; } /* Fallback Read Format */ if (GTK_TOGGLE_BUTTON(sOptionsMedCon.FallbackNONE)->active) { MDC_FALLBACK_FRMT=MDC_FRMT_NONE; }else if (GTK_TOGGLE_BUTTON(sOptionsMedCon.FallbackANLZ)->active) { MDC_FALLBACK_FRMT=MDC_FRMT_ANLZ; }else if (GTK_TOGGLE_BUTTON(sOptionsMedCon.FallbackDICM)->active) { MDC_FALLBACK_FRMT=MDC_FRMT_DICM; }else if (GTK_TOGGLE_BUTTON(sOptionsMedCon.FallbackCONC)->active) { MDC_FALLBACK_FRMT=MDC_FRMT_CONC; }else if (GTK_TOGGLE_BUTTON(sOptionsMedCon.FallbackECAT)->active) { MDC_FALLBACK_FRMT=MDC_FRMT_ECAT6; } /* Split Output*/ if (GTK_TOGGLE_BUTTON(sOptionsMedCon.SplitNone)->active) { MDC_FILE_SPLIT=MDC_SPLIT_NONE; }else if (GTK_TOGGLE_BUTTON(sOptionsMedCon.SplitFrames)->active) { MDC_FILE_SPLIT=MDC_SPLIT_PER_FRAME; }else if (GTK_TOGGLE_BUTTON(sOptionsMedCon.SplitSlices)->active) { MDC_FILE_SPLIT=MDC_SPLIT_PER_SLICE; } /* Color */ if (GTK_TOGGLE_BUTTON(sOptionsMedCon.ColorModeIndexed)->active) { MDC_COLOR_MODE = MDC_COLOR_INDEXED; }else{ MDC_COLOR_MODE = MDC_COLOR_RGB; } if (GTK_TOGGLE_BUTTON(sOptionsMedCon.ColorMakeGray)->active) { MDC_MAKE_GRAY=MDC_YES; }else{ MDC_MAKE_GRAY=MDC_NO; } if (GTK_TOGGLE_BUTTON(sOptionsMedCon.ColorDither)->active) { MDC_DITHER_COLOR=MDC_YES; }else{ MDC_DITHER_COLOR=MDC_NO; } /* Padding */ if (GTK_TOGGLE_BUTTON(sOptionsMedCon.PadAround)->active) { MDC_PADDING_MODE = MDC_PAD_AROUND; } if (GTK_TOGGLE_BUTTON(sOptionsMedCon.PadTopLeft)->active) { MDC_PADDING_MODE = MDC_PAD_TOP_LEFT; } if (GTK_TOGGLE_BUTTON(sOptionsMedCon.PadBottomRight)->active) { MDC_PADDING_MODE = MDC_PAD_BOTTOM_RIGHT; } /* File Names */ if (GTK_TOGGLE_BUTTON(sOptionsMedCon.NameAlias)->active) { MDC_ALIAS_NAME=MDC_YES; }else{ MDC_ALIAS_NAME=MDC_NO; } if (GTK_TOGGLE_BUTTON(sOptionsMedCon.NameNoPrefix)->active) { MDC_PREFIX_DISABLED=MDC_YES; }else{ MDC_PREFIX_DISABLED=MDC_NO; } /* DICOM */ if (GTK_TOGGLE_BUTTON(sOptionsMedCon.DicmContrast)->active) { MDC_CONTRAST_REMAP=MDC_YES; }else{ MDC_CONTRAST_REMAP=MDC_NO; } if (GTK_TOGGLE_BUTTON(sOptionsMedCon.DicmTrueGap)->active) { MDC_TRUE_GAP=MDC_YES; }else{ MDC_TRUE_GAP=MDC_NO; } if (GTK_TOGGLE_BUTTON(sOptionsMedCon.DicmWriteImplicit)->active) { MDC_DICOM_WRITE_IMPLICIT = MDC_YES; }else{ MDC_DICOM_WRITE_IMPLICIT = MDC_NO; } if (GTK_TOGGLE_BUTTON(sOptionsMedCon.DicmWriteNoMeta)->active) { MDC_DICOM_WRITE_NOMETA = MDC_YES; }else{ MDC_DICOM_WRITE_NOMETA = MDC_NO; } /* Siemens - MOSAIC */ if (GTK_TOGGLE_BUTTON(sOptionsMedCon.DicmMosaicEnabled)->active) { MDC_DICOM_MOSAIC_ENABLED = MDC_YES; }else{ MDC_DICOM_MOSAIC_ENABLED = MDC_NO; } if (GTK_TOGGLE_BUTTON(sOptionsMedCon.DicmMosaicForced)->active) { MDC_DICOM_MOSAIC_FORCED = MDC_YES; }else{ MDC_DICOM_MOSAIC_FORCED = MDC_NO; } spin = GTK_SPIN_BUTTON(sOptionsMedCon.DicmMosaicWidth); mdc_mosaic_width = (Uint32)gtk_spin_button_get_value_as_int(spin); spin = GTK_SPIN_BUTTON(sOptionsMedCon.DicmMosaicHeight); mdc_mosaic_height= (Uint32)gtk_spin_button_get_value_as_int(spin); spin = GTK_SPIN_BUTTON(sOptionsMedCon.DicmMosaicNumber); mdc_mosaic_number= (Uint32)gtk_spin_button_get_value_as_int(spin); if (GTK_TOGGLE_BUTTON(sOptionsMedCon.DicmMosaicDoInterl)->active) { MDC_DICOM_MOSAIC_DO_INTERL=MDC_YES; }else{ MDC_DICOM_MOSAIC_DO_INTERL=MDC_NO; } mdc_mosaic_interlaced = MDC_DICOM_MOSAIC_DO_INTERL; if (GTK_TOGGLE_BUTTON(sOptionsMedCon.DicmMosaicFixVoxel)->active) { MDC_DICOM_MOSAIC_FIX_VOXEL=MDC_YES; }else{ MDC_DICOM_MOSAIC_FIX_VOXEL=MDC_NO; } XMdcInitMosaicFrame(); /* Analyze (SPM) */ if (GTK_TOGGLE_BUTTON(sOptionsMedCon.AnlzSPM)->active) { MDC_ANLZ_SPM=MDC_YES; if ((MDC_CALIBRATE == MDC_NO) && (MDC_QUANTIFY == MDC_NO)) XMdcDisplayWarn("For SPM scaling you should select a quantitation"); }else{ MDC_ANLZ_SPM=MDC_NO; } /* InterFile */ if (GTK_TOGGLE_BUTTON(sOptionsMedCon.IntfSkip1)->active) { MDC_SKIP_PREVIEW=MDC_YES; }else{ MDC_SKIP_PREVIEW=MDC_NO; } if (GTK_TOGGLE_BUTTON(sOptionsMedCon.IntfNoPath)->active) { MDC_IGNORE_PATH=MDC_YES; }else{ MDC_IGNORE_PATH=MDC_NO; } if (GTK_TOGGLE_BUTTON(sOptionsMedCon.IntfSingleFile)->active) { MDC_SINGLE_FILE=MDC_YES; }else{ MDC_SINGLE_FILE=MDC_NO; } /* Concorde microPET */ /* ECAT 6 */ if (GTK_TOGGLE_BUTTON(sOptionsMedCon.EcatSortAnatom)->active) { MDC_ECAT6_SORT = MDC_ANATOMICAL; }else if (GTK_TOGGLE_BUTTON(sOptionsMedCon.EcatSortByFrame)->active) { MDC_ECAT6_SORT = MDC_BYFRAME; } if ((XMDC_FILE_OPEN == MDC_YES) && (XMDC_FILE_TYPE == XMDC_NORMAL)) XMdcAskYesNo(GTK_SIGNAL_FUNC(XMdcRereadFile),GTK_SIGNAL_FUNC(NULL) ,"Reread current file?"); } void XMdcOptionsMedconAddTabPixels(GtkWidget *notebook) { GtkWidget *box2; GtkWidget *box3; GtkWidget *box4; GtkWidget *table; GtkWidget *frame; GtkWidget *button; GtkWidget *tablabel; GSList *group; /* tab page Pixels */ box2 = gtk_hbox_new(FALSE, 10); gtk_widget_show(box2); tablabel = gtk_label_new("Pixels"); gtk_widget_show(tablabel); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), box2, tablabel); table = gtk_table_new(2,2,FALSE); gtk_container_add(GTK_CONTAINER(box2), table); gtk_table_set_row_spacings(GTK_TABLE(table), 2); gtk_table_set_col_spacings(GTK_TABLE(table), 2); gtk_widget_show(table); /* Pixel Value */ frame = gtk_frame_new("Value"); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_table_attach_defaults(GTK_TABLE(table),frame,0,1,0,1); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button = gtk_radio_button_new_with_label(NULL, "[rw] without quantitation"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_QUANTIFY == MDC_NO && MDC_CALIBRATE == MDC_NO) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.PixNoQuant = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group, "[rw] quantified (floats)"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_QUANTIFY == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.PixQuantify = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group, "[rw] quantified & calibrated (floats)"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_CALIBRATE == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.PixCalibrate = button; /* Pixel Sign */ frame = gtk_frame_new("Sign"); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_table_attach_defaults(GTK_TABLE(table),frame,0,1,1,2); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button = gtk_radio_button_new_with_label(NULL,"[rw] positives only"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_NEGATIVE == MDC_NO) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.PixPositives = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"[rw] positives & negatives"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_NEGATIVE == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.PixNegatives = button; /* Pixel Types */ frame = gtk_frame_new("Types"); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_table_attach_defaults(GTK_TABLE(table),frame,1,2,0,1); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button = gtk_radio_button_new_with_label(NULL,"[w] writing default pixels"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_FORCE_INT == MDC_NO) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); #ifdef GTKONE gtk_signal_connect(GTK_OBJECT(button),"button-release-event", GTK_SIGNAL_FUNC(XMdcUnsensitiveBitsUsed12),NULL); #else gtk_signal_connect(GTK_OBJECT(button),"toggled", GTK_SIGNAL_FUNC(XMdcUnsensitiveBitsUsed12),NULL); #endif gtk_widget_show(button); sOptionsMedCon.PixTypeNONE = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"[w] writing Uint8 pixels"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_FORCE_INT == BIT8_U) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); #ifdef GTKONE gtk_signal_connect(GTK_OBJECT(button),"button-release-event", GTK_SIGNAL_FUNC(XMdcUnsensitiveBitsUsed12),NULL); #else gtk_signal_connect(GTK_OBJECT(button),"toggled", GTK_SIGNAL_FUNC(XMdcUnsensitiveBitsUsed12),NULL); #endif gtk_widget_show(button); sOptionsMedCon.PixTypeBIT8_U = button; box4 = gtk_hbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(box3),box4); gtk_container_set_border_width(GTK_CONTAINER(box4),0); gtk_widget_show(box4); group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"[w] writing Int16 pixels"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); if (MDC_FORCE_INT == BIT16_S) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); #ifdef GTKONE gtk_signal_connect(GTK_OBJECT(button),"button-release-event", GTK_SIGNAL_FUNC(XMdcSensitiveBitsUsed12),NULL); #else gtk_signal_connect(GTK_OBJECT(button),"toggled", GTK_SIGNAL_FUNC(XMdcSensitiveBitsUsed12),NULL); #endif gtk_widget_show(button); sOptionsMedCon.PixTypeBIT16_S = button; button = gtk_check_button_new_with_label("12 bits used"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); if (MDC_INT16_BITS_USED == 12) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); gtk_widget_show(button); sOptionsMedCon.BitsUsed12 = button; if (MDC_FORCE_INT == BIT16_S) { XMdcSensitiveBitsUsed12(NULL,NULL); }else{ XMdcUnsensitiveBitsUsed12(NULL,NULL); } /* Normalization */ frame = gtk_frame_new("Normalization"); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_table_attach_defaults(GTK_TABLE(table),frame,1,2,1,2); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button = gtk_radio_button_new_with_label(NULL, "[r] over images in frame"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_NORM_OVER_FRAMES == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.NormOverFrames = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"[r] over all images"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_NORM_OVER_FRAMES == MDC_NO) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.NormOverAll = button; } void XMdcOptionsMedconAddTabFiles(GtkWidget *notebook) { GtkWidget *box2; GtkWidget *box3; GtkWidget *table; GtkWidget *frame; GtkWidget *button; GtkWidget *tablabel; GSList *group; /* tab page Files */ box2 = gtk_hbox_new(FALSE, 10); gtk_widget_show(box2); tablabel = gtk_label_new("Files"); gtk_widget_show(tablabel); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), box2, tablabel); table = gtk_table_new(2,2,FALSE); gtk_container_add(GTK_CONTAINER(box2), table); gtk_table_set_row_spacings(GTK_TABLE(table), 2); gtk_table_set_col_spacings(GTK_TABLE(table), 2); gtk_widget_show(table); /* File Endian Type */ frame = gtk_frame_new("Endian Type"); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_table_attach_defaults(GTK_TABLE(table),frame,0,1,0,1); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button = gtk_radio_button_new_with_label(NULL, "[w] writing LITTLE endian (MSB last)"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_WRITE_ENDIAN == MDC_LITTLE_ENDIAN) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.FileTypeLITTLE = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group, "[w] writing BIG endian (MSB first)"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_WRITE_ENDIAN == MDC_BIG_ENDIAN) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.FileTypeBIG = button; /* File Names */ frame = gtk_frame_new("File Names"); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_table_attach_defaults(GTK_TABLE(table),frame,1,2,0,1); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button = gtk_check_button_new_with_label("[w] alias with patient/study id"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_ALIAS_NAME == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.NameAlias = button; button = gtk_check_button_new_with_label("[w] disable numbered prefix"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_PREFIX_DISABLED == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.NameNoPrefix = button; /* Fallback Read Format */ frame = gtk_frame_new("Fallback Read Format"); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_table_attach_defaults(GTK_TABLE(table),frame,0,1,1,2); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button = gtk_radio_button_new_with_label(NULL,"[r] without fallback"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_FALLBACK_FRMT == MDC_FRMT_NONE) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); gtk_widget_show(button); sOptionsMedCon.FallbackNONE = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"[r] Analyze (SPM)"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_FALLBACK_FRMT == MDC_FRMT_ANLZ) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); gtk_widget_show(button); sOptionsMedCon.FallbackANLZ = button; #if ! MDC_INCLUDE_ANLZ gtk_widget_set_sensitive(button,FALSE); #endif group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"[r] DICOM 3.0"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_FALLBACK_FRMT == MDC_FRMT_DICM) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); gtk_widget_show(button); sOptionsMedCon.FallbackDICM = button; #if ! MDC_INCLUDE_DICM gtk_widget_set_sensitive(button,FALSE); #endif group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"[r] Concorde/uPET"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_FALLBACK_FRMT == MDC_FRMT_CONC) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); gtk_widget_show(button); sOptionsMedCon.FallbackCONC = button; #if ! MDC_INCLUDE_CONC gtk_widget_set_sensitive(button,FALSE); #endif group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"[r] ECAT 6.4"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_FALLBACK_FRMT == MDC_FRMT_ECAT6) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); gtk_widget_show(button); sOptionsMedCon.FallbackECAT = button; #if ! MDC_INCLUDE_ECAT gtk_widget_set_sensitive(button,FALSE); #endif /* Split Output */ frame = gtk_frame_new("Split Output"); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_table_attach_defaults(GTK_TABLE(table),frame,1,2,1,2); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button = gtk_radio_button_new_with_label(NULL ,"[w] none, keep volume in one file"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_FILE_SPLIT == MDC_SPLIT_NONE) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); gtk_widget_show(button); sOptionsMedCon.SplitNone = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group ,"[w] split over each frame group"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_FILE_SPLIT == MDC_SPLIT_PER_FRAME) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); gtk_widget_show(button); sOptionsMedCon.SplitFrames = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button =gtk_radio_button_new_with_label(group ,"[w] split over each image slice"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_FILE_SPLIT == MDC_SPLIT_PER_SLICE) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); gtk_widget_show(button); sOptionsMedCon.SplitSlices = button; } void XMdcOptionsMedconAddTabSlices(GtkWidget *notebook) { GtkWidget *box2; GtkWidget *box3; GtkWidget *box4; GtkWidget *table; GtkWidget *frame; GtkWidget *button; GtkWidget *tablabel; GSList *group; /* tab page Slices */ box2 = gtk_hbox_new(FALSE, 10); gtk_widget_show(box2); tablabel = gtk_label_new("Slices"); gtk_widget_show(tablabel); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), box2, tablabel); table = gtk_table_new(2,2,FALSE); gtk_container_add(GTK_CONTAINER(box2), table); gtk_table_set_row_spacings(GTK_TABLE(table), 2); gtk_table_set_col_spacings(GTK_TABLE(table), 2); gtk_widget_show(table); /* Image Flipping*/ frame = gtk_frame_new("Flip - Sorting"); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_table_attach_defaults(GTK_TABLE(table),frame,0,1,0,1); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button = gtk_check_button_new_with_label("[r] flip horizontal"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_FLIP_HORIZONTAL == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.FlipHoriz = button; button =gtk_check_button_new_with_label("[r] flip vertical"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_FLIP_VERTICAL == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.FlipVert = button; button =gtk_check_button_new_with_label("[r] reverse slices"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_SORT_REVERSE == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.SortReverse = button; box4 = gtk_hbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(box3),box4); gtk_container_set_border_width(GTK_CONTAINER(box4),0); gtk_widget_show(box4); button = gtk_check_button_new_with_label("[r] cine sorting:"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); #ifdef GTKONE gtk_signal_connect(GTK_OBJECT(button),"button-release-event", GTK_SIGNAL_FUNC(XMdcToggleSensitivityCine),NULL); #else gtk_signal_connect(GTK_OBJECT(button),"toggled", GTK_SIGNAL_FUNC(XMdcToggleSensitivityCine),NULL); #endif gtk_widget_show(button); sOptionsMedCon.SortCine = button; button = gtk_radio_button_new_with_label(NULL,"apply"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); gtk_widget_show(button); sOptionsMedCon.SortCineApply = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"undo"); gtk_box_pack_start(GTK_BOX(box4),button,TRUE,TRUE,0); gtk_widget_show(button); sOptionsMedCon.SortCineUndo = button; XMdcInitCineButtons(); /* Matrix Transform */ frame = gtk_frame_new("Matrix"); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_table_attach_defaults(GTK_TABLE(table),frame,0,1,1,2); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE,5); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button = gtk_radio_button_new_with_label(NULL,"[r] keep dimensions"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_MAKE_SQUARE == MDC_NO) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); gtk_widget_show(button); sOptionsMedCon.MakeSqrNo = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group, "[r] make square (largest dimension)"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_MAKE_SQUARE == MDC_TRANSF_SQR1) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); gtk_widget_show(button); sOptionsMedCon.MakeSqr1 = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group, "[r] make square (nearest power of two)"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_MAKE_SQUARE == MDC_TRANSF_SQR2) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE); gtk_widget_show(button); sOptionsMedCon.MakeSqr2 = button; /* Color */ frame = gtk_frame_new("Color"); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_table_attach_defaults(GTK_TABLE(table),frame,1,2,0,1); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button = gtk_check_button_new_with_label("[r] simply remap to gray scale"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_MAKE_GRAY == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.ColorMakeGray = button; button = gtk_check_button_new_with_label("[r] force indexed colormap (8-bit)"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_COLOR_MODE == MDC_COLOR_INDEXED) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.ColorModeIndexed = button; button = gtk_check_button_new_with_label("[r] reduce color by dithering"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_DITHER_COLOR == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.ColorDither = button; /* Padding */ frame = gtk_frame_new("Padding"); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_table_attach_defaults(GTK_TABLE(table),frame,1,2,1,2); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button = gtk_radio_button_new_with_label(NULL,"[rw] symmetrical around image"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_PADDING_MODE == MDC_PAD_AROUND) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.PadAround = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"[rw] before first row and column"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_PADDING_MODE == MDC_PAD_TOP_LEFT) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.PadTopLeft = button; group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group,"[rw] after last row and column"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_PADDING_MODE == MDC_PAD_BOTTOM_RIGHT) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.PadBottomRight = button; } void XMdcOptionsMedconAddTabFormats(GtkWidget *notebook) { GtkWidget *box2; GtkWidget *box3; GtkWidget *table; GtkWidget *frame; GtkWidget *button; GtkWidget *tablabel; GSList *group; /* tab page Formats */ box2 = gtk_hbox_new(FALSE, 10); gtk_widget_show(box2); tablabel = gtk_label_new("Formats"); gtk_widget_show(tablabel); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), box2, tablabel); table = gtk_table_new(3,2,FALSE); gtk_container_add(GTK_CONTAINER(box2), table); gtk_table_set_row_spacings(GTK_TABLE(table), 2); gtk_table_set_col_spacings(GTK_TABLE(table), 2); gtk_widget_show(table); /* Analyze (SPM) */ frame = gtk_frame_new("Analyze (SPM)"); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_table_attach_defaults(GTK_TABLE(table),frame,0,1,1,2); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button =gtk_check_button_new_with_label("[rw] SPM version with scale & offset"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_ANLZ_SPM == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.AnlzSPM = button; #if ! MDC_INCLUDE_ANLZ gtk_widget_set_sensitive(button,FALSE); #endif /* DICOM 3.0 */ frame = gtk_frame_new("Dicom - Acr/Nema"); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_table_attach_defaults(GTK_TABLE(table),frame,1,2,0,1); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button = gtk_check_button_new_with_label("[r] enable contrast remapping"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_CONTRAST_REMAP == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.DicmContrast = button; #if (! MDC_INCLUDE_DICM) && (! MDC_INCLUDE_ACR) gtk_widget_set_sensitive(button,FALSE); #endif button = gtk_check_button_new_with_label("[r] spacing is true gap/overlap"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_TRUE_GAP == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.DicmTrueGap = button; #if (MDC_INCLUDE_DICM || MDC_INCLUDE_ACR) gtk_widget_set_sensitive(button,TRUE); #else gtk_widget_set_sensitive(button,FALSE); #endif button = gtk_check_button_new_with_label("[w] write implicit VR little"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_DICOM_WRITE_IMPLICIT == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.DicmWriteImplicit = button; #if (MDC_INCLUDE_DICM || MDC_INCLUDE_ACR) gtk_widget_set_sensitive(button,TRUE); #else gtk_widget_set_sensitive(button,FALSE); #endif button = gtk_check_button_new_with_label("[w] write without meta header"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_DICOM_WRITE_NOMETA == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.DicmWriteNoMeta = button; #if (MDC_INCLUDE_DICM || MDC_INCLUDE_ACR) gtk_widget_set_sensitive(button,TRUE); #else gtk_widget_set_sensitive(button,FALSE); #endif /* ECAT 6.4 */ frame = gtk_frame_new("Ecat 6"); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_table_attach_defaults(GTK_TABLE(table),frame,1,2,1,2); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button = gtk_radio_button_new_with_label(NULL, "[r] planes sort order anatomical"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_ECAT6_SORT == MDC_ANATOMICAL) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.EcatSortAnatom = button; #if ! MDC_INCLUDE_ECAT gtk_widget_set_sensitive(button,FALSE); #endif group = gtk_radio_button_group(GTK_RADIO_BUTTON(button)); button = gtk_radio_button_new_with_label(group, "[r] planes sort order by frame"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_ECAT6_SORT == MDC_BYFRAME) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.EcatSortByFrame = button; #if ! MDC_INCLUDE_ECAT gtk_widget_set_sensitive(button,FALSE); #endif /* InterFile */ frame = gtk_frame_new("InterFile"); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_table_attach_defaults(GTK_TABLE(table),frame,0,1,0,1); gtk_widget_show(frame); box3 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button = gtk_check_button_new_with_label("[r] skip first preview slice"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_SKIP_PREVIEW == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.IntfSkip1 = button; #if ! MDC_INCLUDE_INTF gtk_widget_set_sensitive(button,FALSE); #endif button = gtk_check_button_new_with_label("[r] ignore path in \'name of data file\' key"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_IGNORE_PATH == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.IntfNoPath = button; #if ! MDC_INCLUDE_INTF gtk_widget_set_sensitive(button,FALSE); #endif button = gtk_check_button_new_with_label("[w] write into a single file"); gtk_box_pack_start(GTK_BOX(box3),button,TRUE,TRUE,0); if (MDC_SINGLE_FILE == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.IntfSingleFile = button; #if ! MDC_INCLUDE_INTF gtk_widget_set_sensitive(button,FALSE); #endif } void XMdcOptionsMedconAddTabMosaic(GtkWidget *notebook) { GtkWidget *box2; GtkWidget *box3; GtkWidget *box4; GtkWidget *table; GtkWidget *table2; GtkWidget *frame; GtkWidget *button; GtkWidget *label, *tablabel; GtkWidget *spinner; GtkAdjustment *adj; /* tab page Mosaic */ box2 = gtk_hbox_new(FALSE, 10); gtk_widget_show(box2); tablabel = gtk_label_new("Mosaic"); gtk_widget_show(tablabel); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), box2, tablabel); table = gtk_table_new(2,2,FALSE); gtk_container_add(GTK_CONTAINER(box2), table); gtk_table_set_row_spacings(GTK_TABLE(table), 2); gtk_table_set_col_spacings(GTK_TABLE(table), 2); gtk_widget_show(table); /* Siemens - MOSAIC */ label = gtk_label_new("\ * * * * * * * * * * * *\n\n\ see also DICOM options\n\n\ in the tab Formats\n\n\ * * * * * * * * * * * *"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_CENTER); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table),label,1,2,0,1); gtk_widget_show(label); frame = gtk_frame_new("Siemens - Mosaic"); gtk_container_set_border_width(GTK_CONTAINER(frame),5); gtk_table_attach_defaults(GTK_TABLE(table),frame,0,1,0,1); gtk_widget_show(frame); #if (! MDC_INCLUDE_DICM) && (! MDC_INCLUDE_ACR) gtk_widget_set_sensitive(frame,FALSE); #endif box3 = gtk_vbox_new(FALSE,0); gtk_container_add(GTK_CONTAINER(frame),box3); gtk_container_set_border_width(GTK_CONTAINER(box3),5); gtk_widget_show(box3); button = gtk_check_button_new_with_label("[r] enable mosaic support"); gtk_box_pack_start(GTK_BOX(box3),button,FALSE,FALSE,0); #ifdef GTKONE gtk_signal_connect(GTK_OBJECT(button),"button-release-event", GTK_SIGNAL_FUNC(XMdcToggleSensitivityMosaic),NULL); #else gtk_signal_connect(GTK_OBJECT(button),"toggled", GTK_SIGNAL_FUNC(XMdcToggleSensitivityMosaic),NULL); #endif if (MDC_DICOM_MOSAIC_ENABLED == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.DicmMosaicEnabled = button; box4 = gtk_vbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(box3),box4,FALSE,FALSE,5); gtk_widget_show(box4); wmosaic = box4; button = gtk_check_button_new_with_label("[r] force specified stamps layout"); gtk_box_pack_start(GTK_BOX(box4),button,FALSE,FALSE,5); #ifdef GTKONE gtk_signal_connect(GTK_OBJECT(button),"button-release-event", GTK_SIGNAL_FUNC(XMdcToggleSensitivityForced),NULL); #else gtk_signal_connect(GTK_OBJECT(button),"toggled", GTK_SIGNAL_FUNC(XMdcToggleSensitivityForced),NULL); #endif if (MDC_DICOM_MOSAIC_FORCED == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.DicmMosaicForced = button; table2 = gtk_table_new(5,3,TRUE); gtk_box_pack_start(GTK_BOX(box4),table2,TRUE,TRUE,5); gtk_table_set_row_spacings(GTK_TABLE(table2), 2); gtk_table_set_col_spacings(GTK_TABLE(table2), 2); gtk_widget_show(table2); wforced = table2; label = gtk_label_new("width (X)"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table2),label,0,1,0,1); gtk_widget_show(label); adj=(GtkAdjustment *)gtk_adjustment_new(0., 0., 9999., 1., 4., 0.); spinner = gtk_spin_button_new(adj, 0.0, 0); gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(spinner), TRUE); #ifdef GTKONE gtk_spin_button_set_shadow_type(GTK_SPIN_BUTTON(spinner), GTK_SHADOW_ETCHED_IN); #endif gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(spinner), TRUE); gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON(spinner), TRUE); gtk_table_attach_defaults(GTK_TABLE(table2),spinner,1,2,0,1); gtk_widget_show(spinner); sOptionsMedCon.DicmMosaicWidth=spinner; gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinner),(gfloat)mdc_mosaic_width); label = gtk_label_new("[pixels]"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table2),label,2,3,0,1); gtk_widget_show(label); label = gtk_label_new("height (Y)"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table2),label,0,1,1,2); gtk_widget_show(label); adj=(GtkAdjustment *)gtk_adjustment_new(0., 0., 9999., 1., 4., 0.); spinner = gtk_spin_button_new(adj, 0.0, 0); gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(spinner), TRUE); #ifdef GTKONE gtk_spin_button_set_shadow_type(GTK_SPIN_BUTTON(spinner), GTK_SHADOW_ETCHED_IN); #endif gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(spinner), TRUE); gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON(spinner), TRUE); gtk_table_attach_defaults(GTK_TABLE(table2),spinner,1,2,1,2); gtk_widget_show(spinner); sOptionsMedCon.DicmMosaicHeight=spinner; gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinner),(gfloat)mdc_mosaic_height); label = gtk_label_new("[pixels]"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table2),label,2,3,1,2); gtk_widget_show(label); label = gtk_label_new("number (Z)"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table2),label,0,1,2,3); gtk_widget_show(label); adj=(GtkAdjustment *)gtk_adjustment_new(0., 0., 9999., 1., 4., 0.); spinner = gtk_spin_button_new(adj, 0.0, 0); gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(spinner), TRUE); #ifdef GTKONE gtk_spin_button_set_shadow_type(GTK_SPIN_BUTTON(spinner), GTK_SHADOW_ETCHED_IN); #endif gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(spinner), TRUE); gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON(spinner), TRUE); gtk_table_attach_defaults(GTK_TABLE(table2),spinner,1,2,2,3); gtk_widget_show(spinner); sOptionsMedCon.DicmMosaicNumber=spinner; gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinner),(gfloat)mdc_mosaic_number); label = gtk_label_new("[slices]"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table2),label,2,3,2,3); gtk_widget_show(label); label = gtk_label_new("interlaced slices"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table2),label,0,1,3,4); gtk_widget_show(label); button = gtk_check_button_new(); gtk_table_attach_defaults(GTK_TABLE(table2),button,1,2,3,4); if (MDC_DICOM_MOSAIC_DO_INTERL == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.DicmMosaicDoInterl = button; label = gtk_label_new("fix voxel sizes"); gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_RIGHT); gtk_widget_set_name(label, "FixedLabel"); gtk_table_attach_defaults(GTK_TABLE(table2),label,0,1,4,5); gtk_widget_show(label); button = gtk_check_button_new(); gtk_table_attach_defaults(GTK_TABLE(table2),button,1,2,4,5); if (MDC_DICOM_MOSAIC_FIX_VOXEL == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sOptionsMedCon.DicmMosaicFixVoxel = button; XMdcInitMosaicFrame(); } void XMdcOptionsMedconSel(GtkWidget *widget, gpointer data) { GtkWidget *box1; GtkWidget *box2; GtkWidget *button; GtkWidget *separator; GtkWidget *notebook; if (woption == NULL) { woption = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_signal_connect(GTK_OBJECT(woption), "destroy", GTK_SIGNAL_FUNC(XMdcMedconQuit),NULL); gtk_signal_connect(GTK_OBJECT(woption), "delete_event", GTK_SIGNAL_FUNC(XMdcHandlerToHide), NULL); gtk_window_set_title(GTK_WINDOW(woption),"MedCon Options"); gtk_container_set_border_width(GTK_CONTAINER(woption),0); box1 = gtk_vbox_new(FALSE, 0); gtk_widget_show(box1); gtk_container_add(GTK_CONTAINER(woption),box1); wlabel = gtk_label_new("* Reread file for applying [r] or [rw] changes *"); gtk_misc_set_alignment(GTK_MISC(wlabel),0.5,0.5); gtk_box_pack_start(GTK_BOX(box1),wlabel,TRUE,TRUE,0); if (XMDC_FILE_OPEN == MDC_YES) { gtk_widget_show(wlabel); }else { gtk_widget_hide(wlabel); } notebook = gtk_notebook_new(); gtk_container_add(GTK_CONTAINER(box1),notebook); gtk_container_set_border_width(GTK_CONTAINER(notebook), 10); gtk_notebook_set_tab_border(GTK_NOTEBOOK(notebook), 5); gtk_notebook_set_homogeneous_tabs(GTK_NOTEBOOK(notebook), TRUE); gtk_widget_show(notebook); XMdcOptionsMedconAddTabPixels(notebook); XMdcOptionsMedconAddTabFiles(notebook); XMdcOptionsMedconAddTabSlices(notebook); XMdcOptionsMedconAddTabFormats(notebook); XMdcOptionsMedconAddTabMosaic(notebook); /* separator */ separator = gtk_hseparator_new(); gtk_box_pack_start(GTK_BOX(box1),separator,FALSE,FALSE,0); gtk_widget_show(separator); /* create bottom button box */ box2 = gtk_hbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(box1),box2,TRUE,TRUE,2); gtk_widget_show(box2); button = gtk_button_new_with_label("Apply"); gtk_box_pack_start(GTK_BOX(box2),button,TRUE,TRUE,2); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(woption)); gtk_signal_connect(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(XMdcOptionsMedconCallbackApply), NULL); gtk_widget_show(button); button = gtk_button_new_with_label("Cancel"); gtk_box_pack_start(GTK_BOX(box2),button,TRUE,TRUE,2); gtk_signal_connect_object(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(gtk_widget_hide),GTK_OBJECT(woption)); gtk_widget_show(button); }else{ /* set buttons to appropriate state */ GtkWidget *b1, *b2, *b3, *b4, *e1; /* show or hide warn label */ if (XMDC_FILE_OPEN == MDC_YES) { gtk_widget_show(wlabel); }else { gtk_widget_hide(wlabel); } gtk_widget_hide(woption); b1 = sOptionsMedCon.PixNoQuant; b2 = sOptionsMedCon.PixQuantify; b3 = sOptionsMedCon.PixCalibrate; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3), FALSE); if (MDC_QUANTIFY == MDC_NO && MDC_CALIBRATE == MDC_NO) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); }else if (MDC_QUANTIFY == MDC_YES) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), TRUE); }else if (MDC_CALIBRATE == MDC_YES) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3), TRUE); } b1 = sOptionsMedCon.PixNegatives; b2 = sOptionsMedCon.PixPositives; if (MDC_NEGATIVE == MDC_YES) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); }else{ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), TRUE); } b1 = sOptionsMedCon.NormOverFrames; b2 = sOptionsMedCon.NormOverAll; if (MDC_NORM_OVER_FRAMES == MDC_YES) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), FALSE); }else{ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), TRUE); } b1 = sOptionsMedCon.FallbackNONE; b2 = sOptionsMedCon.FallbackANLZ; b3 = sOptionsMedCon.FallbackDICM; b4 = sOptionsMedCon.FallbackECAT; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b4), FALSE); switch (MDC_FALLBACK_FRMT) { case MDC_FRMT_NONE: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); break; case MDC_FRMT_ANLZ: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), TRUE); break; case MDC_FRMT_DICM: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3), TRUE); break; case MDC_FRMT_ECAT6: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b4), TRUE); break; } /* Split Output */ b1 = sOptionsMedCon.SplitNone; b2 = sOptionsMedCon.SplitFrames; b3 = sOptionsMedCon.SplitSlices; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3), FALSE); switch (MDC_FILE_SPLIT) { case MDC_SPLIT_NONE: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); break; case MDC_SPLIT_PER_FRAME: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), TRUE); break; case MDC_SPLIT_PER_SLICE: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3), TRUE); break; } /* Color */ b1 = sOptionsMedCon.ColorModeIndexed; if (MDC_COLOR_MODE == MDC_COLOR_INDEXED) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); b1 = sOptionsMedCon.ColorDither; if (MDC_DITHER_COLOR == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); b1 = sOptionsMedCon.ColorMakeGray; if (MDC_MAKE_GRAY == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); /* Padding */ b1 = sOptionsMedCon.PadAround; b2 = sOptionsMedCon.PadTopLeft; b3 = sOptionsMedCon.PadBottomRight; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3), FALSE); switch (MDC_PADDING_MODE) { case MDC_PAD_AROUND: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); break; case MDC_PAD_TOP_LEFT: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), TRUE); break; case MDC_PAD_BOTTOM_RIGHT: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3), TRUE); break; } /* Output File Names */ b1 = sOptionsMedCon.NameAlias; if (MDC_ALIAS_NAME == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); b1 = sOptionsMedCon.NameNoPrefix; if (MDC_PREFIX_DISABLED == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); /* DICOM */ b1 = sOptionsMedCon.DicmContrast; if (MDC_CONTRAST_REMAP == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); b1 = sOptionsMedCon.DicmTrueGap; if (MDC_TRUE_GAP == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); b1 = sOptionsMedCon.DicmWriteImplicit; if (MDC_DICOM_WRITE_IMPLICIT == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); b1 = sOptionsMedCon.DicmWriteNoMeta; if (MDC_DICOM_WRITE_NOMETA == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); /* Siemens - MOSAIC */ b1 = sOptionsMedCon.DicmMosaicEnabled; if (MDC_DICOM_MOSAIC_ENABLED == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); b1 = sOptionsMedCon.DicmMosaicForced; if (MDC_DICOM_MOSAIC_FORCED == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); e1 = sOptionsMedCon.DicmMosaicWidth; gtk_spin_button_set_value(GTK_SPIN_BUTTON(e1),(gfloat)mdc_mosaic_width); e1 = sOptionsMedCon.DicmMosaicHeight; gtk_spin_button_set_value(GTK_SPIN_BUTTON(e1),(gfloat)mdc_mosaic_height); e1 = sOptionsMedCon.DicmMosaicNumber; gtk_spin_button_set_value(GTK_SPIN_BUTTON(e1),(gfloat)mdc_mosaic_number); b1 = sOptionsMedCon.DicmMosaicDoInterl; if (MDC_DICOM_MOSAIC_DO_INTERL == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); b1 = sOptionsMedCon.DicmMosaicFixVoxel; if (MDC_DICOM_MOSAIC_FIX_VOXEL == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); XMdcInitMosaicFrame(); /* Pixel Types */ b1 = sOptionsMedCon.PixTypeNONE; b2 = sOptionsMedCon.PixTypeBIT8_U; b3 = sOptionsMedCon.PixTypeBIT16_S; b4 = sOptionsMedCon.BitsUsed12; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b4), FALSE); switch (MDC_FORCE_INT) { case MDC_NO: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); XMdcUnsensitiveBitsUsed12(NULL,NULL); break; case BIT8_U: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), TRUE); XMdcUnsensitiveBitsUsed12(NULL,NULL); break; case BIT16_S: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3), TRUE); XMdcSensitiveBitsUsed12(NULL,NULL); break; } if (MDC_INT16_BITS_USED == 12) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b4), TRUE); /* File Endian Type */ b1 = sOptionsMedCon.FileTypeLITTLE; b2 = sOptionsMedCon.FileTypeBIG; if (MDC_WRITE_ENDIAN == MDC_LITTLE_ENDIAN) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), FALSE); }else{ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), TRUE); } /* Flipping - Sorting */ b1 = sOptionsMedCon.FlipHoriz; if (MDC_FLIP_HORIZONTAL == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); b1 = sOptionsMedCon.FlipVert; if (MDC_FLIP_VERTICAL == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); b1 = sOptionsMedCon.SortReverse; if (MDC_SORT_REVERSE== MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); XMdcInitCineButtons(); /* Matrix */ b1 = sOptionsMedCon.MakeSqrNo; b2 = sOptionsMedCon.MakeSqr1; b3 = sOptionsMedCon.MakeSqr2; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3), FALSE); switch (MDC_MAKE_SQUARE) { case MDC_NO: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); break; case MDC_TRANSF_SQR1: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), TRUE); break; case MDC_TRANSF_SQR2: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3), TRUE); break; default: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); } /* Analyze */ b1 = sOptionsMedCon.AnlzSPM; if (MDC_ANLZ_SPM == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); /* InterFile */ b1 = sOptionsMedCon.IntfSkip1; if (MDC_SKIP_PREVIEW == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); b1 = sOptionsMedCon.IntfNoPath; if (MDC_IGNORE_PATH == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); b1 = sOptionsMedCon.IntfSingleFile; if (MDC_SINGLE_FILE == MDC_YES) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); /* ECAT 6 */ b1 = sOptionsMedCon.EcatSortAnatom; b2 = sOptionsMedCon.EcatSortByFrame; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), FALSE); switch (MDC_ECAT6_SORT) { case MDC_ANATOMICAL: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); break; case MDC_BYFRAME : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), TRUE); break; } } XMdcShowWidget(woption); } void XMdcOptionsRenderSel(GtkWidget *widget, gpointer data) { XMdcRenderingSel(); } void XMdcOptionsResizeSel(GtkWidget *widget, gpointer data) { XMdcResizeSel(); } void XMdcOptionsColorMapSel(GtkWidget *widget, gpointer data) { XMdcColorMapSel(); } void XMdcOptionsLabelSel(GtkWidget *widget, gpointer data) { XMdcLabelSel(); } void XMdcOptionsPagesSel(GtkWidget *widget, gpointer data) { XMdcPagesSel(); } void XMdcOptionsMapPlaceSel(GtkWidget *widget, gpointer data) { XMdcMapPlaceSel(); } void XMdcSensitiveBitsUsed12(GtkWidget *widget, gpointer data) { gtk_widget_set_sensitive(GTK_WIDGET(sOptionsMedCon.BitsUsed12),TRUE); } void XMdcUnsensitiveBitsUsed12(GtkWidget *widget, gpointer data) { gtk_widget_set_sensitive(GTK_WIDGET(sOptionsMedCon.BitsUsed12),FALSE); } void XMdcToggleSensitivityMosaic(GtkWidget *widget, gpointer data) { #ifdef GTKONE if (GTK_TOGGLE_BUTTON(sOptionsMedCon.DicmMosaicEnabled)->active) { gtk_widget_set_sensitive(GTK_WIDGET(wmosaic),FALSE); }else{ gtk_widget_set_sensitive(GTK_WIDGET(wmosaic),TRUE); } #else gtk_widget_set_sensitive(GTK_WIDGET(wmosaic), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); #endif } void XMdcToggleSensitivityForced(GtkWidget *widget, gpointer data) { #ifdef GTKONE if (GTK_TOGGLE_BUTTON(sOptionsMedCon.DicmMosaicForced)->active) { gtk_widget_set_sensitive(GTK_WIDGET(wforced),FALSE); }else{ gtk_widget_set_sensitive(GTK_WIDGET(wforced),TRUE); } #else gtk_widget_set_sensitive(GTK_WIDGET(wforced), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); #endif } void XMdcInitMosaicFrame(void) { GtkWidget *b1; /* active status */ b1 = sOptionsMedCon.DicmMosaicEnabled; if (MDC_DICOM_MOSAIC_ENABLED == MDC_YES) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); }else{ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); } b1 = sOptionsMedCon.DicmMosaicDoInterl; if (MDC_DICOM_MOSAIC_DO_INTERL == MDC_YES) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); }else{ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); } /* sensitivity status */ if (MDC_DICOM_MOSAIC_ENABLED == MDC_YES) { gtk_widget_set_sensitive(wmosaic,TRUE); }else{ gtk_widget_set_sensitive(wmosaic,FALSE); } if (MDC_DICOM_MOSAIC_FORCED == MDC_YES) { gtk_widget_set_sensitive(wforced,TRUE); }else{ gtk_widget_set_sensitive(wforced,FALSE); } } void XMdcToggleSensitivityCine(GtkWidget *widget, gpointer data) { #ifdef GTKONE if (GTK_TOGGLE_BUTTON(sOptionsMedCon.SortCine)->active) { gtk_widget_set_sensitive(GTK_WIDGET(sOptionsMedCon.SortCineApply),FALSE); gtk_widget_set_sensitive(GTK_WIDGET(sOptionsMedCon.SortCineUndo),FALSE); }else{ gtk_widget_set_sensitive(GTK_WIDGET(sOptionsMedCon.SortCineApply),TRUE); gtk_widget_set_sensitive(GTK_WIDGET(sOptionsMedCon.SortCineUndo),TRUE); } #else gtk_widget_set_sensitive(GTK_WIDGET(sOptionsMedCon.SortCineApply), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); gtk_widget_set_sensitive(GTK_WIDGET(sOptionsMedCon.SortCineUndo), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))); #endif } void XMdcInitCineButtons(void) { GtkWidget *b1, *b2, *b3; b1 = sOptionsMedCon.SortCine; b2 = sOptionsMedCon.SortCineApply; b3 = sOptionsMedCon.SortCineUndo; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3), FALSE); /* active status */ if (MDC_SORT_CINE_APPLY == MDC_YES) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2), TRUE); }else if (MDC_SORT_CINE_UNDO == MDC_YES) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1), TRUE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3), TRUE); } /* sensitivity status */ if (MDC_SORT_CINE_APPLY == MDC_YES || MDC_SORT_CINE_UNDO == MDC_YES) { gtk_widget_set_sensitive(sOptionsMedCon.SortCineApply,TRUE); gtk_widget_set_sensitive(sOptionsMedCon.SortCineUndo,TRUE); }else{ gtk_widget_set_sensitive(sOptionsMedCon.SortCineApply,FALSE); gtk_widget_set_sensitive(sOptionsMedCon.SortCineUndo,FALSE); } } xmedcon-0.14.1/source/ximages.h0000644000175000017510000000426412636253502013274 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: ximages.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : ximages.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: ximages.h,v 1.17 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XIMAGES_H__ #define __XIMAGES_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcRemovePreviousImages(void); void XMdcImagesSetCursor(GtkWidget *widget, gpointer data); gboolean XMdcImagesCallbackExpose(GtkWidget *widget, GdkEventExpose *event, Uint32 *nr); gboolean XMdcImagesCallbackClicked(GtkWidget *widget, GdkEventButton *button, Uint32 *imagenr); void XMdcBuildCurrentImages(void); void XMdcDisplayImages(void); void XMdcImagesView(GtkWidget *widget, gpointer data); #endif xmedcon-0.14.1/source/m-fancy.c0000644000175000017510000011641712636253502013170 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-fancy.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : Nice output, edit strings & print defaults * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcPrintLine() - Print a full or half line * * MdcPrintChar() - Print a char * * MdcPrintStr() - Print a string * * MdcPrintBoxLine() - Print horizontal line of a box * * MdcPrintYesNo() - Print Yes, No or Unknown * * MdcPrintImageLayout() - Print layout of a raw image * * MdcPrintValue() - Print numeric value * * MdcLowStr() - Make string lower case * * MdcUpStr() - Make string upper case * * MdcKillSpaces() - Remove first/last spaces * * MdcRemoveAllSpaces() - Remove all spaces from string * * MdcRemoveEnter() - Remove from string * * MdcGetStrLine() - Get string skipping comment * * MdcGetStrInput() - Get string from input with '\n'* * MdcGetSubStr() - Get substr between separators * * MdcGetSafeString() - Copy & add terminating char * * MdcPutDefault() - Get (default) answer * * MdcGetRange() - Get a range from the a list * * MdcHandleEcatList() - Get a list in ecat style * * MdcHandleNormList() - Get a list in normal style * * MdcHandlePixelList() - Get a list of pixels * * MdcGetStrAcquisition() - Get string for acquisition type* * MdcGetStrRawConv() - Get string of raw type * * MdcGetStrEndian() - Get string of endian type * * MdcGetStrCompression() - Get string of compression type * * MdcGetStrPixelType() - Get string of pixel type * * MdcGetStrColorMap() - Get string of colormap * * MdcGetStrYesNo() - Get string "yes" or "no" * * MdcGetStrSlProjection() - Get string slice projection * * MdcGetStrPatSlOrient() - Get string patient/slice orient* * MdcGetStrPatPos() - Get string patient position * * MdcGetStrPatOrient() - Get string patient orientation * * MdcGetStrSliceOrient() - Get string slice orientation * * MdcGetStrRotation() - Get string rotation direction * * MdcGetStrMotion() - Get string detector motion * * MdcGetStrModality() - Get string modality * * MdcGetStrGSpectNesting()- Get string GSPECT nesting * * MdcGetStrHHMMSS() - Get string hrs:mins:secs * * MdcGetIntModality() - Get int modality type * * MdcGetIntSliceOrient() - Get int slice orientation * * MdcGetLibLongVersion() - Get string of library version * * MdcGetLibShortVersion() - Get string of short version * * MdcCheckStrSize() - Check if we can add a string * * MdcMakeScanInfoStr() - Make string with scan info * * MdcIsDigit() - Test if char is a digit * * MdcWaitForEnter() - Wait until key press * * MdcGetSelectionType() - Get select type (norm,ecat,...)* * MdcFlushInput() - Flush the input stream * * MdcWhichDecompress() - Give supported decompression * * MdcWhichCompression() - Give compression type of file * * MdcAddCompressionExt() - Add compression extension * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-fancy.c,v 1.70 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "m-fancy.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ void MdcPrintLine(char c, int length) { int i; for (i=0; i"); else if (c==9 || c==13 || c==10) putchar(c); else if (c >= 32) putchar(c); else if (c==EOF) MdcPrntScrn(""); else MdcPrntScrn("<%u>",c); } void MdcPrintStr(char *str) { int t=strlen(str); if ( t == 0 ) MdcPrntScrn(""); else MdcPrntScrn("%s",str); MdcPrntScrn("\n"); } void MdcPrintBoxLine(char c, int t) { int i; MdcPrntScrn("\t\t#"); for (i=-1;i<=t;i++) MdcPrntScrn("%c",c); MdcPrntScrn("#\n"); } void MdcPrintYesNo(int value ) { switch ( value ) { case MDC_NO : MdcPrntScrn("(= No)\n"); break; case MDC_YES: MdcPrntScrn("(= Yes)\n"); break; default : MdcPrntScrn("(= Unknown)\n"); break; } } void MdcPrintImageLayout(FILEINFO *fi, Uint32 gen, Uint32 img, int repeat) { IMG_DATA *id; Uint32 i; MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("\t\t\tSUMMARY OF IMAGE FILE LAYOUT\n"); MdcPrintLine('-',MDC_FULL_LENGTH); if ((gen==0) && (img==0)) MdcPrintBoxLine('-',MDC_BOX_SIZE); if (gen!=0) { MdcPrintBoxLine('-',MDC_BOX_SIZE); MdcPrntScrn("\t\t| General Header | \t(%u)\n",gen); MdcPrintBoxLine('-',MDC_BOX_SIZE); } for (i=0; inumber; i++) { id = &fi->image[i]; if ( ((i==0) && (img>0)) || (repeat) ) { if ( ! ((i==0) && (gen>0)) )MdcPrintBoxLine('-',MDC_BOX_SIZE); MdcPrntScrn("\t\t| Image Header | \t(%u)\n",img); MdcPrintBoxLine('-',MDC_BOX_SIZE); } MdcPrntScrn("\t\t! Image #%-4u ",i+1); if (fi->endian != MDC_HOST_ENDIAN) MdcPrntScrn("swap !"); else MdcPrntScrn(" !"); MdcPrntScrn("\t(%ux%ux%u)",id->width,id->height,MdcType2Bytes(id->type)); if (id->load_location != 0) { MdcPrntScrn("\tOFFSET: %u",(Uint32)id->load_location); } MdcPrntScrn("\n"); } MdcPrintBoxLine('-',MDC_BOX_SIZE); } int MdcPrintValue(FILE *fp, Uint8 *pvalue, Uint16 type) { switch (type) { case BIT8_S: { Int8 *val = (Int8 *) pvalue; fprintf(fp,"%hhd",val[0]); } break; case BIT8_U: { Uint8 *val = (Uint8 *) pvalue; fprintf(fp,"%hhu",val[0]); } break; case BIT16_S: { Int16 *val = (Int16 *) pvalue; fprintf(fp,"%hd",val[0]); } break; case BIT16_U: { Uint16 *val = (Uint16 *) pvalue; fprintf(fp,"%hu",val[0]); } break; case BIT32_S: { Int32 *val = (Int32 *) pvalue; fprintf(fp,"%d",val[0]); } break; case BIT32_U: { Uint32 *val = (Uint32 *) pvalue; fprintf(fp,"%d",val[0]); } break; #ifdef HAVE_8BYTE_INT case BIT64_S: { Int64 *val = (Int64 *) pvalue; fprintf(fp,"%ld",val[0]); } break; case BIT64_U: { Uint64 *val = (Uint64 *) pvalue; fprintf(fp,"%lu",val[0]); } break; #endif case FLT32: { float *val = (float *) pvalue; fprintf(fp,"%+e",val[0]); } break; case FLT64: { double *val = (double *) pvalue; fprintf(fp,"%+e",val[0]); } break; } return(ferror(fp)); } void MdcLowStr(char *str) { char *c; c=str; while(*c) { *c=tolower((int)*c); c++; } } void MdcUpStr(char *str) { char *c; c=str; while(*c) { *c=toupper((int)*c); c++; } } void MdcKillSpaces(char string[]) /* kill first and last spaces */ { int i=0, shift=0, length; length = strlen(string); if (length > 0) { /* kill the first spaces */ while (isspace((int)string[i])) { if (i < length) { i+=1; shift+=1; }else break; } if (shift) for (i=0; i<=length; i++) string[i] = string[i+shift]; /* kill the last spaces */ length = strlen(string); if (length > 0) { i = length - 1; while (isspace((int)string[i])) { if (i > 0 ) { string[i] = '\0'; i-=1; }else break; } } } } void MdcRemoveAllSpaces(char string[]) /* remove all spaces */ { int i=0, j=0, length; length = strlen(string); while (i < length) { if (isspace((int)string[i])) { i+=1; }else{ string[j++] = string[i++]; } } string[j]='\0'; } void MdcRemoveEnter(char string[]) { char *p; p = strchr(string,'\r'); if (p != NULL) p[0] = '\0'; p = strchr(string,'\n'); if (p != NULL) p[0] = '\0'; } void MdcGetStrLine(char string[], int maxchars, FILE *fp) { /* skip comment lines beginning with '#' */ do { if (fgets(string,maxchars,fp) == NULL) return; }while (string[0] == '#'); } void MdcGetStrInput(char string[], int maxchars) { MdcGetStrLine(string,maxchars,stdin); } int MdcGetSubStr(char *dest, char *src, int dmax, char sep, int n) { Uint32 i, b, cnt=1, length, sublength=0; length = strlen(src); if (length == 0) return(MDC_NO); /* get begin substr */ for (b=0; b= dmax)) return(MDC_NO); strncpy(dest,&src[b],sublength); dest[sublength] = '\0'; MdcKillSpaces(dest); return(MDC_YES); } void MdcGetSafeString(char *dest, char *src, Uint32 length, Uint32 maximum) { Uint32 MAX = maximum - 1; /* let's be really safe */ if (length < MAX) { memcpy(dest,src,length); dest[length]='\0'; }else{ memcpy(dest,src,MAX); dest[MAX]='\0'; } } int MdcUseDefault(const char string[]) { /* = default */ if (string[0] == '\n' || string[0] == '\r') return(1); return(0); } /* string[] = MDC_2KB_OFFSET */ int MdcPutDefault(char string[]) /* 1=default or 0=no default */ { MdcGetStrLine(string,MDC_2KB_OFFSET-1,stdin); if (MdcUseDefault(string)) return(1); MdcKillSpaces(string); return(0); } int MdcGetRange(const char *item, Uint32 *from, Uint32 *to, Uint32 *step) { Uint32 a1, a2, t; /* read range values */ if (strchr(item,':') != 0 ) { /* interval */ sscanf(item,"%u:%u:%u",&a1,&t,&a2); }else if ( strstr(item,"...") != 0 ) { /* range v1 */ sscanf(item,"%u...%u",&a1,&a2); t=1; }else if ( strstr(item,"-") != 0 ) { /* range v2 */ sscanf(item,"%u-%u",&a1,&a2); t=1; }else{ /* single */ sscanf(item,"%u",&a1); a2=a1; t=1; } /* some sanity checks */ if (t == 0) t = 1; *from = a1; *to = a2; *step = t; return(MDC_OK); } char *MdcHandleEcatList(char *list, Uint32 **dims, Uint32 max) { int ITEM_FOUND=MDC_NO, REVERSED, HANDLE; Uint32 a1, a2, t, i, l, length; char *p, *item; length = strlen(list); /* default = all */ if (MdcUseDefault(list)) { for (i=1; i<=max; i++) (*dims)[i]=MDC_YES; (*dims)[0]=max; return(NULL); } /* loop through string with entire list */ for (p=list, item=list, l=0; l<=length; l++) { /* separate items: begins at digit, ends at space (or \t, \n, ...) */ if (ITEM_FOUND == MDC_NO) { if (isdigit((int)p[l])) { item=&p[l]; ITEM_FOUND=MDC_YES; } }else if (isspace((int)p[l]) || p[l]=='\0') { p[l]='\0'; if (MdcGetRange(item,&a1,&a2,&t) != MDC_OK) return("Error reading range item"); if (a1 > max) a1 = max; if (a2 > max) a2 = max; if ( (a1==0) || (a2==0) ) { for (i=1; i<=max; i++) (*dims)[i]=MDC_YES; (*dims)[0]=max; break; } /* reversed range ? */ REVERSED = (a1 > a2) ? MDC_YES : MDC_NO; /* initialize and get image numbers */ i = a1; HANDLE = MDC_YES; do { /* include image number */ if ((*dims)[i] == MDC_NO) { (*dims)[i] = MDC_YES; (*dims)[0] += 1; } if ((REVERSED == MDC_YES) && (i < t)) break; /* set next image number in range */ i = (REVERSED == MDC_YES) ? (i-t) : (i+t); /* check end of range */ if (REVERSED == MDC_YES) { if (i < a2) HANDLE = MDC_NO; }else{ if (i > a2) HANDLE = MDC_NO; } }while(HANDLE == MDC_YES); ITEM_FOUND = MDC_NO; } } return(NULL); } char *MdcHandleNormList(char *list,Uint32 **inrs,Uint32 *it ,Uint32 *bt,Uint32 max) { int ITEM_FOUND=MDC_NO, HANDLE, REVERSED; Uint32 a1, a2, t, i, l, length; char *p, *item; length = strlen(list); /* = default: all */ if (MdcUseDefault(list)) { (*inrs)[1] = 0; *it = 2; return(NULL); } /* loop through string with entire list */ for (p=list, item=list, l=0; l<=length; l++) { /* separate items: begins at digit, ends at space (or \t, \n, ...) */ if (ITEM_FOUND == MDC_NO) { if (isdigit((int)p[l])) { item=&p[l]; ITEM_FOUND=MDC_YES; } }else if (isspace((int)p[l]) || p[l]=='\0') { p[l]='\0'; if (MdcGetRange(item,&a1,&a2,&t) != MDC_OK) return("Error reading range item"); if (a1 > max) a1 = max; if (a2 > max) a2 = max; if ( (a1==0) || (a2==0) ) { (*inrs)[1] = 0; *it = 2; return(NULL); } /* reversed range ? */ REVERSED = (a1 > a2) ? MDC_YES : MDC_NO; /* initialize and get image numbers */ i = a1; HANDLE = MDC_YES; do { /* store image number */ (*inrs)[*it] = i; *it += 1; if ( (*it % MDC_BUF_ITMS) == 0 ) { if (((*inrs)=(Uint32 *)MdcRealloc((*inrs), (*bt)*MDC_BUF_ITMS*sizeof(Uint32)))==NULL){ return("Couldn't realloc images number buffer"); } *bt += 1; } if ((REVERSED == MDC_YES) && (i < t)) break; /* set next image number in range */ i = (REVERSED == MDC_YES) ? (i-t) : (i+t); /* check end of range */ if (REVERSED == MDC_YES) { if (i < a2) HANDLE = MDC_NO; }else{ if (i > a2) HANDLE = MDC_NO; } }while (HANDLE == MDC_YES); ITEM_FOUND = MDC_NO; } } return(NULL); } char *MdcHandlePixelList(char *list, Uint32 **cols, Uint32 **rows, Uint32 *it, Uint32 *bt) { int ITEM_FOUND=MDC_NO; Uint32 r_from, r_to, r_step, c_from, c_to, c_step; Uint32 r, c, l, length, tmp; char *col, *row; char *p, *item; length = strlen(list); /* default = all */ if (MdcUseDefault(list)) { (*cols)[*it] = 0; (*rows)[*it] = 0; *it+=1; return(NULL); } /* loop through string with entire list */ for (p=list, item=list, l=0; l<=length; l++) { /* separate items: begins at digit, ends at space (or \t, \n, ...) */ if (ITEM_FOUND == MDC_NO) { if (isdigit((int)p[l])) { item=&p[l]; ITEM_FOUND=MDC_YES; } }else if (isspace((int)p[l]) || p[l]=='\0') { p[l]='\0'; col=item; row=strchr(item,','); if ( row == NULL) return("Wrong input!"); *row = '\0'; row += 1; if (MdcGetRange(col,&c_from,&c_to,&c_step) != MDC_OK) return("Error reading column range"); /* some checks */ if (c_from == 0 || c_to == 0) { c_from = 0; c_to = 0; }else if (c_from > c_to) { tmp = c_from; c_from = c_to; c_to = tmp; } if (MdcGetRange(row,&r_from,&r_to,&r_step) != MDC_OK) return("Error reading row range"); /* some checks */ if (r_from == 0 || r_to == 0) { r_from = 0; r_to = 0; }else if (r_from > r_to) { tmp = r_from; r_from = r_to; r_to = tmp; } for (r=r_from; r<=r_to; r+=r_step) for (c=c_from; c<=c_to; c+=c_step) { (*cols)[*it] = c; (*rows)[*it] = r; *it+=1; if ( (*it % MDC_BUF_ITMS) == 0 ) { if ( ((*cols)=(Uint32 *)MdcRealloc((*cols), (*bt)*MDC_BUF_ITMS*sizeof(Uint32))) == NULL) { return("Couldn't realloc pixels column buffer"); } if (((*rows)=(Uint32 *)MdcRealloc((*rows), (*bt)*MDC_BUF_ITMS*sizeof(Uint32))) == NULL) { return("Couldn't realloc pixels row buffer"); } } *bt+=1; } ITEM_FOUND = MDC_NO; } } return(NULL); } char *MdcGetStrAcquisition(int acq_type) { switch (acq_type) { case MDC_ACQUISITION_STATIC : return("Static"); break; case MDC_ACQUISITION_DYNAMIC: return("Dynamic"); break; case MDC_ACQUISITION_TOMO : return("Tomographic"); break; case MDC_ACQUISITION_GATED : return("Gated"); break; case MDC_ACQUISITION_GSPECT : return("GSPECT"); break; default : return("Unknown"); } } char *MdcGetStrRawConv(int rawconv) { switch (rawconv) { case MDC_NO : return("No"); break; case MDC_FRMT_RAW : return("Binary"); break; case MDC_FRMT_ASCII : return("Ascii"); break; default : return("Unknown"); } } char *MdcGetStrEndian(int endian) { switch (endian) { case MDC_BIG_ENDIAN : return("Big"); break; case MDC_LITTLE_ENDIAN: return("Little"); break; default : return("Unknown"); } } char *MdcGetStrCompression(int compression) { switch (compression) { case MDC_NO : return("None"); break; case MDC_COMPRESS : return("Compress"); break; case MDC_GZIP : return("Gzipped"); break; default : return("Unknown"); } } char *MdcGetStrPixelType(int type) { switch (type) { case BIT1: return("1-bit"); break; case BIT8_S: return("Int8"); break; case BIT8_U: return("Uint8"); break; case BIT16_S: return("Int16"); break; case BIT16_U: return("Uint16"); break; case BIT32_S: return("Int32"); break; case BIT32_U: return("Uint32"); break; case BIT64_S: return("Int64"); break; case BIT64_U: return("Uint64"); break; case FLT32: return("IEEE float"); break; case FLT64: return("IEEE double"); break; case ASCII: return("ASCII"); break; case VAXFL32: return("VAX float"); break; case COLRGB: return("RGB24 triplets"); break; default : return("Unknown"); } } char *MdcGetStrColorMap(int map) { switch (map) { case MDC_MAP_PRESENT : return("present"); break; case MDC_MAP_GRAY : return("gray normal"); break; case MDC_MAP_INVERTED: return("gray invers"); break; case MDC_MAP_RAINBOW : return("rainbow"); break; case MDC_MAP_COMBINED: return("combined"); break; case MDC_MAP_HOTMETAL: return("hotmetal"); break; case MDC_MAP_LOADED : return("loaded LUT"); break; default : return("Unknown"); } } char *MdcGetStrYesNo(int boolean) { switch (boolean) { case MDC_NO : return("No"); break; case MDC_YES: return("Yes"); break; default : return("Unknown"); } } char *MdcGetStrSlProjection(int slice_projection) { switch (slice_projection) { case MDC_TRANSAXIAL: strcpy(mdcbufr,"XY - Transaxial"); break; case MDC_SAGITTAL : strcpy(mdcbufr,"YZ - Sagittal"); break; case MDC_CORONAL : strcpy(mdcbufr,"XZ - Coronal"); break; default: strcpy(mdcbufr,"Unknown"); } return(mdcbufr); } char *MdcGetStrPatSlOrient(int patient_slice_orient) { switch (patient_slice_orient) { case MDC_SUPINE_HEADFIRST_TRANSAXIAL: strcpy(mdcbufr,"Supine;HeadFirst;Transverse"); break; case MDC_SUPINE_HEADFIRST_SAGITTAL : strcpy(mdcbufr,"Supine;HeadFirst;Sagittal"); break; case MDC_SUPINE_HEADFIRST_CORONAL : strcpy(mdcbufr,"Supine;HeadFirst;Coronal"); break; case MDC_SUPINE_FEETFIRST_TRANSAXIAL: strcpy(mdcbufr,"Supine;FeetFirst;Transverse"); break; case MDC_SUPINE_FEETFIRST_SAGITTAL : strcpy(mdcbufr,"Supine;FeetFirst;Sagittal"); break; case MDC_SUPINE_FEETFIRST_CORONAL : strcpy(mdcbufr,"Supine;FeetFirst;Coronal"); break; case MDC_PRONE_HEADFIRST_TRANSAXIAL : strcpy(mdcbufr,"Prone;HeadFirst;Transverse"); break; case MDC_PRONE_HEADFIRST_SAGITTAL : strcpy(mdcbufr,"Prone;HeadFirst;Sagittal"); break; case MDC_PRONE_HEADFIRST_CORONAL : strcpy(mdcbufr,"Prone;HeadFirst;Coronal"); break; case MDC_PRONE_FEETFIRST_TRANSAXIAL : strcpy(mdcbufr,"Prone;FeetFirst;Transverse"); break; case MDC_PRONE_FEETFIRST_SAGITTAL : strcpy(mdcbufr,"Prone;FeetFirst;Sagittal"); break; case MDC_PRONE_FEETFIRST_CORONAL : strcpy(mdcbufr,"Prone;FeetFirst;Coronal"); break; case MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL: strcpy(mdcbufr,"DecubitusRight;HeadFirst;Transverse"); break; case MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL : strcpy(mdcbufr,"DecubitusRight;HeadFirst;Sagittal"); break; case MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL : strcpy(mdcbufr,"DecubitusRight;HeadFirst;Coronal"); break; case MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL: strcpy(mdcbufr,"DecubitusRight;FeetFirst;Transverse"); break; case MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL : strcpy(mdcbufr,"DecubitusRight;FeetFirst;Sagittal"); break; case MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL : strcpy(mdcbufr,"DecubitusRight;FeetFirst;Coronal"); break; case MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL : strcpy(mdcbufr,"DecubitusLeft;HeadFirst;Transverse"); break; case MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL : strcpy(mdcbufr,"DecubitusLeft;HeadFirst;Sagittal"); break; case MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL : strcpy(mdcbufr,"DecubitusLeft;HeadFirst;Coronal"); break; case MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL : strcpy(mdcbufr,"DecubitusLeft;FeetFirst;Transverse"); break; case MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL : strcpy(mdcbufr,"DecubitusLeft;FeetFirst;Sagittal"); break; case MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL : strcpy(mdcbufr,"DecubitusLeft;FeetFirst;Coronal"); break; default : strcpy(mdcbufr,"Unknown"); } return(mdcbufr); } char *MdcGetStrPatPos(int patient_slice_orient) { switch (patient_slice_orient) { case MDC_SUPINE_HEADFIRST_TRANSAXIAL: case MDC_SUPINE_HEADFIRST_SAGITTAL : case MDC_SUPINE_HEADFIRST_CORONAL : strcpy(mdcbufr,"HFS"); break; case MDC_SUPINE_FEETFIRST_TRANSAXIAL: case MDC_SUPINE_FEETFIRST_SAGITTAL : case MDC_SUPINE_FEETFIRST_CORONAL : strcpy(mdcbufr,"FFS"); break; case MDC_PRONE_HEADFIRST_TRANSAXIAL : case MDC_PRONE_HEADFIRST_SAGITTAL : case MDC_PRONE_HEADFIRST_CORONAL : strcpy(mdcbufr,"HFP"); break; case MDC_PRONE_FEETFIRST_TRANSAXIAL : case MDC_PRONE_FEETFIRST_SAGITTAL : case MDC_PRONE_FEETFIRST_CORONAL : strcpy(mdcbufr,"FFP"); break; case MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL: case MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL : strcpy(mdcbufr,"HFDR"); break; case MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL: case MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL : strcpy(mdcbufr,"FFDR"); break; case MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL : case MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL : case MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL : strcpy(mdcbufr,"HFDL"); break; case MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL : case MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL : case MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL : strcpy(mdcbufr,"FFDL"); break; default : strcpy(mdcbufr,"Unknown"); } return(mdcbufr); } char *MdcGetStrPatOrient(int patient_slice_orient) { switch (patient_slice_orient) { case MDC_SUPINE_HEADFIRST_TRANSAXIAL: strcpy(mdcbufr,"L\\P"); break; case MDC_SUPINE_HEADFIRST_SAGITTAL : strcpy(mdcbufr,"P\\F"); break; case MDC_SUPINE_HEADFIRST_CORONAL : strcpy(mdcbufr,"L\\F"); break; case MDC_SUPINE_FEETFIRST_TRANSAXIAL: strcpy(mdcbufr,"R\\P"); break; case MDC_SUPINE_FEETFIRST_SAGITTAL : strcpy(mdcbufr,"P\\H"); break; case MDC_SUPINE_FEETFIRST_CORONAL : strcpy(mdcbufr,"R\\H"); break; case MDC_PRONE_HEADFIRST_TRANSAXIAL : strcpy(mdcbufr,"R\\A"); break; case MDC_PRONE_HEADFIRST_SAGITTAL : strcpy(mdcbufr,"A\\F"); break; case MDC_PRONE_HEADFIRST_CORONAL : strcpy(mdcbufr,"R\\F"); break; case MDC_PRONE_FEETFIRST_TRANSAXIAL : strcpy(mdcbufr,"L\\A"); break; case MDC_PRONE_FEETFIRST_SAGITTAL : strcpy(mdcbufr,"A\\H"); break; case MDC_PRONE_FEETFIRST_CORONAL : strcpy(mdcbufr,"L\\H"); break; case MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL: strcpy(mdcbufr,"P\\R");break; case MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL : strcpy(mdcbufr,"L\\F");break; case MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL : strcpy(mdcbufr,"P\\F");break; case MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL: strcpy(mdcbufr,"A\\R");break; case MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL : strcpy(mdcbufr,"L\\H");break; case MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL : strcpy(mdcbufr,"A\\H");break; case MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL : strcpy(mdcbufr,"A\\L");break; case MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL : strcpy(mdcbufr,"R\\F");break; case MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL : strcpy(mdcbufr,"A\\F");break; case MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL : strcpy(mdcbufr,"P\\L");break; case MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL : strcpy(mdcbufr,"R\\H");break; case MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL : strcpy(mdcbufr,"P\\H");break; default : strcpy(mdcbufr,"Unknown"); } return(mdcbufr); } char *MdcGetStrSliceOrient(int patient_slice_orient) { switch (patient_slice_orient) { case MDC_SUPINE_HEADFIRST_TRANSAXIAL : case MDC_PRONE_HEADFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL: case MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL : case MDC_SUPINE_FEETFIRST_TRANSAXIAL : case MDC_PRONE_FEETFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL: case MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL : strcpy(mdcbufr,"Transverse"); break; case MDC_SUPINE_HEADFIRST_SAGITTAL : case MDC_PRONE_HEADFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL: case MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL : case MDC_SUPINE_FEETFIRST_SAGITTAL : case MDC_PRONE_FEETFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL: case MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL : strcpy(mdcbufr,"Sagittal"); break; case MDC_SUPINE_HEADFIRST_CORONAL : case MDC_PRONE_HEADFIRST_CORONAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL: case MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL : case MDC_SUPINE_FEETFIRST_CORONAL : case MDC_PRONE_FEETFIRST_CORONAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL: case MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL : strcpy(mdcbufr,"Coronal"); break; default : strcpy(mdcbufr,"unknown"); } return(mdcbufr); } char *MdcGetStrRotation(int rotation) { switch (rotation) { case MDC_ROTATION_CW: strcpy(mdcbufr,"clockwise"); break; case MDC_ROTATION_CC: strcpy(mdcbufr,"counter-clockwise"); break; default : strcpy(mdcbufr,"unknown"); } return(mdcbufr); } char *MdcGetStrMotion(int motion) { switch (motion) { case MDC_MOTION_STEP: strcpy(mdcbufr,"step and shoot"); break; case MDC_MOTION_CONT: strcpy(mdcbufr,"continuous"); break; case MDC_MOTION_DRNG: strcpy(mdcbufr,"during step"); break; default : strcpy(mdcbufr,"unknown"); } return(mdcbufr); } char *MdcGetStrModality(int modint) { char *pmod; Uint16 umod16; umod16 = (Uint16)modint; pmod = (char *)&umod16; if (MdcHostBig()) { mdcbufr[0] = pmod[0]; mdcbufr[1] = pmod[1]; }else{ mdcbufr[0] = pmod[1]; mdcbufr[1] = pmod[0]; } mdcbufr[2]='\0'; return(mdcbufr); } char *MdcGetStrGSpectNesting(int nesting) { switch (nesting) { case MDC_GSPECT_NESTING_SPECT: return("SPECT"); case MDC_GSPECT_NESTING_GATED: return("Gated"); default : return("unknown"); } } char *MdcGetStrHHMMSS(float msecs) { unsigned int s, ms, hrs, mins, secs; s = (unsigned int)(msecs / 1000.); ms = (unsigned int)(msecs - (s * 1000.)); hrs = s / 3600; s -= hrs * 3600; mins = s / 60; s -= mins * 60.; secs = s; if (hrs > 0) { sprintf(mdcbufr,"%02uh%02um%02u",hrs,mins,secs); }else if (mins > 0) { sprintf(mdcbufr,"%02um%02u",mins,secs); }else{ sprintf(mdcbufr,"%02us%03u",secs,ms); } return(mdcbufr); } int MdcGetIntModality(char *modstr) { int modint; modint = (modstr[0]<<8)|modstr[1]; return(modint); } int MdcGetIntSliceOrient(int patient_slice_orient) { int slice_orient; switch (patient_slice_orient) { case MDC_SUPINE_HEADFIRST_TRANSAXIAL : case MDC_PRONE_HEADFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL: case MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL : case MDC_SUPINE_FEETFIRST_TRANSAXIAL : case MDC_PRONE_FEETFIRST_TRANSAXIAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL: case MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL : slice_orient = MDC_TRANSAXIAL; break; case MDC_SUPINE_HEADFIRST_SAGITTAL : case MDC_PRONE_HEADFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL: case MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL : case MDC_SUPINE_FEETFIRST_SAGITTAL : case MDC_PRONE_FEETFIRST_SAGITTAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL: case MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL : slice_orient = MDC_SAGITTAL; break; case MDC_SUPINE_HEADFIRST_CORONAL : case MDC_PRONE_HEADFIRST_CORONAL : case MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL: case MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL : case MDC_SUPINE_FEETFIRST_CORONAL : case MDC_PRONE_FEETFIRST_CORONAL : case MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL: case MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL : slice_orient = MDC_CORONAL; break; default : slice_orient = MDC_TRANSAXIAL; } return(slice_orient); } const char *MdcGetLibLongVersion(void) { return(MDC_LIBVERS); } const char *MdcGetLibShortVersion(void) { return(MDC_VERSION); } /* returns the new stringsize value or 0 in case of error to add */ Uint32 MdcCheckStrSize(char *str_to_add, Uint32 current_size, Uint32 max) { Uint32 max_value = MDC_2KB_OFFSET; Uint32 new_size; if (max != 0) max_value = max; new_size = current_size + (Uint32)strlen(str_to_add); if ( new_size >= max_value ) { MdcPrntWarn("Internal Problem -- Information string too small"); return(0); } return(new_size); } /* print to global `mdcbufr' array */ int MdcMakeScanInfoStr(FILEINFO *fi) { char strbuf[100]; Uint32 size=0; sprintf(mdcbufr,"\n\n\ ******************************\n\ Short Patient/Scan Information\n\ ******************************\n"); size = (Uint32)strlen(mdcbufr); sprintf(strbuf,"Patient Name : %s\n",fi->patient_name); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Patient Sex : %s\n",fi->patient_sex); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Patient ID : %s\n",fi->patient_id); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Patient DOB : %s\n",fi->patient_dob); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Patient Weight: %.2f\n",fi->patient_weight); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Study Date : %02d/%02d/%04d\n",fi->study_date_day ,fi->study_date_month ,fi->study_date_year); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Study Time : %02d:%02d:%02d\n",fi->study_time_hour ,fi->study_time_minute ,fi->study_time_second); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Study ID : %s\n",fi->study_id); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Study Descr : %s\n",fi->study_descr); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Acquisition Type : %s\n", MdcGetStrAcquisition(fi->acquisition_type)); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Reconstructed : %s\n", MdcGetStrYesNo(fi->reconstructed)); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; if (fi->reconstructed == MDC_YES) { sprintf(strbuf,"Reconstruction Method: %s\n",fi->recon_method); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Filter Type : %s\n",fi->filter_type); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Decay Corrected : %s\n", MdcGetStrYesNo(fi->decay_corrected)); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Flood Corrected : %s\n", MdcGetStrYesNo(fi->flood_corrected)); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Series Description : %s\n",fi->series_descr); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Radiopharmaceutical : %s\n",fi->radiopharma); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; } sprintf(strbuf,"Isotope Code : %s\n",fi->isotope_code); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Isotope Halflife : %+e [sec]\n", fi->isotope_halflife); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Injected Dose : %+e [MBq]\n", fi->injected_dose); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; sprintf(strbuf,"Gantry Tilt : %+e degrees\n", fi->gantry_tilt); if ((size=MdcCheckStrSize(strbuf,size,0))) strcat(mdcbufr,strbuf); else return MDC_NO; return(MDC_YES); } int MdcIsDigit(char c) { if (c >= '0' && c <= '9') return MDC_YES; return(MDC_NO); } void MdcWaitForEnter(int page) { if (page > 0) { MdcPrntScrn("\t\t*********** Press for page #%d **********",page); } if (page == 0) { MdcPrntScrn("\t\t********** Press for next page **********"); } if (page < 0 ) { MdcPrntScrn("Press to continue ..."); } while ( fgetc(stdin) != '\n' ) { /* wait until key pressed */ } } Int32 MdcGetSelectionType(void) { Int32 type=-1; MdcPrntScrn("\n\tSelection Type:\n"); MdcPrntScrn("\n\ttype %d -> normal",MDC_INPUT_NORM_STYLE); MdcPrntScrn("\n\t %d -> ecat\n",MDC_INPUT_ECAT_STYLE); MdcPrntScrn("\n\tYour choice [%d]? ",MDC_INPUT_NORM_STYLE); MdcGetStrLine(mdcbufr,MDC_2KB_OFFSET-1,stdin); type=(Int32)atol(mdcbufr); if (type != MDC_INPUT_ECAT_STYLE) type = MDC_INPUT_NORM_STYLE; return(type); } void MdcFlushInput(void) { while( fgetc(stdin) != '\n' ) { } } int MdcWhichDecompress(void) { if (strcmp(MDC_DECOMPRESS,"gunzip") == 0) return(MDC_GZIP); if (strcmp(MDC_DECOMPRESS,"uncompress") == 0) return(MDC_COMPRESS); return(MDC_NO); } int MdcWhichCompression(const char *fname) { char *ext=NULL; int compression = MDC_NO; /* get filename extension */ if (fname != NULL) ext = strrchr(fname,'.'); if (ext != NULL) { /* check for supported compression */ switch (MdcWhichDecompress()) { case MDC_COMPRESS: if (strcmp(ext,".Z") == 0 ) /* only .Z files */ compression = MDC_COMPRESS; break; case MDC_GZIP : if (strcmp(ext,".gz") == 0 ) { compression = MDC_GZIP; }else if (strcmp(ext,".Z") == 0 ) { compression = MDC_COMPRESS; } break; } } return(compression); } void MdcAddCompressionExt(int ctype, char *fname) { switch (ctype) { case MDC_COMPRESS: strcat(fname,".Z"); break; case MDC_GZIP : strcat(fname,".gz"); break; } } xmedcon-0.14.1/source/m-structs.c0000644000175000017510000007531612636253502013601 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-structs.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : structs handling functions * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcCheckFI() - Check FILEINFO struct integrity * * MdcGetStructMOD() - Get MOD_INFO structs * * MdcGetStructID() - Get IMG_DATA structs * * MdcGetStructSD() - Get STATIC_DATA structs * * MdcGetStructGD() - Get GATED_DATA structs * * MdcGetStructAD() - Get ACQ_DATA structs * * MdcGetStructDD() - Get DYNAMIC_DATA structs * * MdcGetStructBD() - Get BED_DATA structs * * MdcInitMOD() - Initialize MOD_INFO struct * * MdcInitID() - Initialize IMG_DATA structs * * MdcInitSD() - Initialize STATIC_DATA strucs * * MdcInitGD() - Initialize GATED_DATA structs * * MdcInitAD() - Initialize ACQ_DATA structs * * MdcInitDD() - Initialize DYNAMIC_DATA structs * * MdcInitBD() - Initialize BED_DATA structs * * MdcInitFI() - Initialize FILEINFO struct * * MdcCopyID() - Copy IMG_DATA information * * MdcCopySD() - Copy STATIC_DATA information * * MdcCopyGD() - Copy GATED_DATA information * * MdcCopyAD() - Copy ACQ_DATA information * * MdcCopyDD() - Copy DYNAMIC_DATA information * * MdcCopyBD() - Copy BED_DATA information * * MdcCopyFI() - Copy FILEINFO information * * MdcFreeIDs() - Free IMG_DATA structs * * MdcFreeMODs() - Free MOD_INFO structs * * MdcResetIDs() - Reset IMG_DATA structs * * MdcResetODs() - Reset all others except IMG_DATA * * MdcCleanUpFI() - Clean up FILEINFO struct * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-structs.c,v 1.84 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "medcon.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ char *MdcCheckFI(FILEINFO *fi) { Uint32 i, t; /* check fi->dim[] values */ if (fi->dim[0] <= 2 ) { sprintf(mdcbufr,"Internal ## fi->dim[0]=%d",fi->dim[0]); return(mdcbufr); }else{ for (i=1; i<=fi->dim[0]; i++) { if (fi->dim[i] <= 0 ) { sprintf(mdcbufr,"Internal ## fi->dim[%d]=%d",i,fi->dim[i]); return(mdcbufr); } } } /* all fi->dim[] are 1-based, even unused */ for (i=0; idim[i] <= 0) return("Internal ## Dangerous negative fi->dim values"); /* check fi->number value */ for (i=1, t=3; t <= fi->dim[0]; t++) { i*=fi->dim[t]; } if (fi->number != i) return("Internal ## Improper fi->dim values"); return(NULL); } /* returns 1 on success and 0 on failure */ int MdcGetStructMOD(FILEINFO *fi) { fi->mod = calloc(sizeof(MOD_INFO),1); if (fi->mod == NULL) return(MDC_NO); return(MDC_YES); } /* returns 1 on success and 0 on failure */ int MdcGetStructID(FILEINFO *fi, Uint32 number) { Uint32 i, begin=number; /* bad request */ if (number == 0) return(MDC_NO); /* allocate structs */ if (fi->image == NULL) { /* fresh allocation */ fi->image=(IMG_DATA *)malloc(sizeof(IMG_DATA)*number); begin = 0; }else if (number != fi->number) { /* reallocation */ fi->image=(IMG_DATA *)realloc(fi->image,sizeof(IMG_DATA)*number); begin = number > fi->number ? fi->number : number; } if (fi->image == NULL) { fi->number=0; return(MDC_NO); } /* initialize new structs */ for (i=begin; iimage[i]); /* set new number */ fi->number = number; return(MDC_YES); } /* returns 1 on success and 0 on failure */ int MdcGetStructSD(FILEINFO *fi, Uint32 number) { STATIC_DATA *sdata; Uint32 i; if (number != fi->number) return(MDC_NO); /* always for number of images */ for (i=0; inumber; i++) { sdata = (STATIC_DATA *)malloc(sizeof(STATIC_DATA)); if (sdata == NULL) return(MDC_NO); MdcInitSD(sdata); fi->image[i].sdata = sdata; } return(MDC_YES); } /* returns 1 on success and 0 on failure */ int MdcGetStructGD(FILEINFO *fi, Uint32 number) { Uint32 i, begin=number; if (number == 0) return(MDC_NO); if (fi->gdata == NULL) { /* fresh allocation */ fi->gdata = (GATED_DATA *)malloc(sizeof(GATED_DATA)*number); begin = 0; }else if (number != fi->gatednr) { /* reallocation */ fi->gdata = (GATED_DATA *)realloc(fi->gdata,sizeof(GATED_DATA)*number); begin = number > fi->gatednr ? fi->gatednr : number; } if (fi->gdata == NULL) { fi->gatednr=0; return(MDC_NO); } /* initialize new structs */ for (i=begin; igdata[i]); /* set new number */ fi->gatednr = number; return(MDC_YES); } /* returns 1 on success and 0 on failure */ int MdcGetStructAD(FILEINFO *fi, Uint32 number) { Uint32 i, begin=number; if (number == 0) return(MDC_NO); if (fi->acqdata == NULL) { /* fresh allocation */ fi->acqdata = (ACQ_DATA *)malloc(sizeof(ACQ_DATA)*number); begin = 0; }else if (number != fi->acqnr) { /* reallocation */ fi->acqdata = (ACQ_DATA *)realloc(fi->acqdata,sizeof(ACQ_DATA)*number); begin = number > fi->acqnr ? fi->acqnr : number; } if (fi->acqdata == NULL) { fi->acqnr=0; return(MDC_NO); } /* initialize new structs */ for (i=begin; iacqdata[i]); /* set new number */ fi->acqnr = number; return(MDC_YES); } /* returns 1 on success and 0 on failure */ int MdcGetStructDD(FILEINFO *fi, Uint32 number) { Uint32 i, begin=number; if (number == 0) return(MDC_NO); if (fi->dyndata == NULL) { /* fresh allocation */ fi->dyndata = (DYNAMIC_DATA *)malloc(sizeof(DYNAMIC_DATA)*number); begin = 0; }else if (number != fi->dynnr) { /* reallocation */ fi->dyndata = (DYNAMIC_DATA *)realloc(fi->dyndata,sizeof(DYNAMIC_DATA)*number); begin = number > fi->dynnr ? fi->dynnr : number; } if (fi->dyndata == NULL) { fi->dynnr=0; return(MDC_NO); } /* initialize new structs */ for (i=begin; idyndata[i]); /* set new number */ fi->dynnr = number; return(MDC_YES); } /* returns 1 on success and 0 on failure */ int MdcGetStructBD(FILEINFO *fi, Uint32 number) { Uint32 i, begin=number; if (number == 0) return(MDC_NO); if (fi->beddata == NULL) { /* fresh allocation */ fi->beddata = (BED_DATA *)malloc(sizeof(BED_DATA)*number); begin = 0; }else if (number != fi->bednr) { /* reallocation */ fi->beddata = (BED_DATA *)realloc(fi->beddata,sizeof(BED_DATA)*number); begin = number > fi->bednr ? fi->bednr : number; } if (fi->beddata == NULL) { fi->bednr=0; return(MDC_NO); } /* initialize new structs */ for (i=begin; ibeddata[i]); /* set new number */ fi->bednr = number; return(MDC_YES); } void MdcInitMOD(MOD_INFO *mod) { if (mod == NULL) return; mod->gn_info.study_date[0]='\0'; mod->gn_info.study_time[0]='\0'; mod->gn_info.series_date[0]='\0'; mod->gn_info.series_time[0]='\0'; mod->gn_info.acquisition_date[0]='\0'; mod->gn_info.acquisition_time[0]='\0'; mod->gn_info.image_date[0]='\0'; mod->gn_info.image_time[0]='\0'; mod->mr_info.repetition_time=0.; mod->mr_info.echo_time=0.; mod->mr_info.inversion_time=0.; mod->mr_info.num_averages=0.; mod->mr_info.imaging_freq=0.; mod->mr_info.pixel_bandwidth=0.; mod->mr_info.flip_angle=0.; mod->mr_info.dbdt=0.; mod->mr_info.transducer_freq=0; mod->mr_info.transducer_type[0]='\0'; mod->mr_info.pulse_repetition_freq=0; mod->mr_info.pulse_seq_name[0]='\0'; mod->mr_info.steady_state_pulse_seq[0]='\0'; mod->mr_info.slab_thickness=0.; mod->mr_info.sampling_freq=0.; } void MdcInitID(IMG_DATA *id) { int i; if (id == NULL) return; memset(id,'\0',sizeof(IMG_DATA)); id->rescaled = MDC_NO; id->quant_scale = 1.; id->calibr_fctr = 1.; id->intercept = 0.; id->rescale_slope = 1.; id->rescale_intercept = 0.; id->quant_units = 1; id->calibr_units = 1; id->frame_number = 0; id->slice_start = 0.; id->buf = NULL; id->load_location = -1; id->pixel_xsize = 1.; id->pixel_ysize = 1.; id->slice_width = 1.; for(i=0;i<3;i++) { id->image_pos_dev[i]=0.; id->image_pos_pat[i]=0.; } for(i=0;i<6;i++) { id->image_orient_dev[i]=0.; id->image_orient_pat[i]=0.; } id->slice_spacing = 0.; /* = slice_width; when not found no gap */ id->ct_zoom_fctr = 1.; id->sdata = NULL; id->plugb = NULL; } void MdcInitSD(STATIC_DATA *sd) { strcpy(sd->label,"Unknown"); sd->total_counts = 0.; sd->image_duration = 0.; sd->start_time_hour = 0; sd->start_time_minute = 0; sd->start_time_second = 0; } void MdcInitGD(GATED_DATA *gd) { if (gd == NULL) return; gd->gspect_nesting = MDC_GSPECT_NESTING_GATED; gd->nr_projections = 0.0; gd->extent_rotation = 0.0; gd->study_duration = 0.0; gd->image_duration = 0.0; gd->time_per_proj = 0.0; gd->window_low = 0.0; gd->window_high= 0.0; gd->cycles_observed = 0.0; gd->cycles_acquired = 0.0; } void MdcInitAD(ACQ_DATA *acq) { if (acq == NULL) return; acq->rotation_direction = MDC_ROTATION_CW; acq->detector_motion = MDC_MOTION_STEP; acq->rotation_offset = 0.; acq->radial_position = 0.; acq->angle_start = 0.; acq->angle_step = 0.; acq->scan_arc = 360.; } void MdcInitDD(DYNAMIC_DATA *dd) { if (dd == NULL) return; dd->nr_of_slices = 0; dd->time_frame_start = 0.; dd->time_frame_delay = 0.; dd->time_frame_duration = 0.; dd->delay_slices = 0.; } void MdcInitBD(BED_DATA *bd) { if (bd == NULL) return; bd->hoffset = 0.; bd->voffset = 0.; } void MdcInitFI(FILEINFO *fi, const char *path) { fi->ifp = NULL; fi->ifp_raw = NULL; fi->ofp = NULL; fi->ofp_raw = NULL; fi->idir = NULL; fi->ifname = NULL; fi->odir = NULL; fi->ofname = NULL; fi->image = NULL; fi->iformat = MDC_FRMT_NONE; fi->oformat = MDC_FRMT_NONE; fi->diff_type = MDC_NO; fi->diff_size = MDC_NO; fi->diff_scale = MDC_NO; fi->rawconv = MDC_NO; fi->endian = MDC_UNKNOWN; fi->modality = M_NM; fi->compression = MDC_NO; fi->truncated=MDC_NO; fi->number = 0; fi->mwidth=fi->mheight=0; fi->bits = 8; fi->type = BIT8_U; fi->ifname = fi->ipath; memset(fi->ipath,'\0',MDC_MAX_PATH); strncpy(fi->ipath,path,MDC_MAX_PATH); fi->ofname = fi->opath; memset(fi->opath,'\0',MDC_MAX_PATH); fi->study_date_day = 0; fi->study_date_month = 0; fi->study_date_year = 0; fi->study_time_hour = 0; fi->study_time_minute= 0; fi->study_time_second= 0; fi->dose_time_hour = 0; fi->dose_time_minute = 0; fi->dose_time_second = 0; fi->nr_series = -1; fi->nr_acquisition = -1; fi->nr_instance = -1; fi->decay_corrected = MDC_NO; fi->flood_corrected = MDC_NO; fi->acquisition_type = MDC_ACQUISITION_UNKNOWN; fi->planar = MDC_NO; fi->reconstructed = MDC_YES; fi->contrast_remapped = MDC_NO; fi->window_centre = 0.; fi->window_width = 0.; fi->slice_projection = MDC_UNKNOWN; fi->pat_slice_orient = MDC_UNKNOWN; strcpy(fi->pat_pos,"Unknown"); strcpy(fi->pat_orient,"Unknown"); strcpy(fi->recon_method,"Unknown"); strcpy(fi->patient_name,"Unknown"); strcpy(fi->patient_id,"Unknown"); strcpy(fi->patient_sex,"Unknown"); strcpy(fi->patient_dob,"00000000"); strcpy(fi->operator_name,"Unknown"); strcpy(fi->study_descr,"Unknown"); strcpy(fi->study_id,"Unknown"); strcpy(fi->institution,MDC_INSTITUTION); strcpy(fi->manufacturer,MDC_PRGR); strcpy(fi->series_descr,"Unknown"); strcpy(fi->radiopharma,"Unknown"); strcpy(fi->filter_type,"Unknown"); strcpy(fi->organ_code,"Unknown"); strcpy(fi->isotope_code,"Unknown"); fi->patient_weight = 0.; fi->patient_height = 0.; fi->isotope_halflife = 0.; fi->injected_dose = 0.; fi->gantry_tilt = 0.; fi->dim[0] = 3; fi->dim[1] = 1; fi->dim[2] = 1; fi->dim[3] = 1; fi->dim[4] = 1; fi->dim[5] = 1; fi->dim[6] = 1; fi->dim[7] = 1; fi->pixdim[0] = 3.; fi->pixdim[1] = 1.; fi->pixdim[2] = 1.; fi->pixdim[3] = 1.; fi->pixdim[4] = 1.; fi->pixdim[5] = 1.; fi->pixdim[6] = 1.; fi->pixdim[7] = 1.; fi->map = MDC_MAP_GRAY; MdcGetColorMap((int)fi->map,fi->palette); fi->comment = NULL; fi->comm_length = 0; fi->glmin = fi->glmax = fi->qglmin = fi->qglmax = 0.; fi->gatednr = 0; fi->gdata = NULL; fi->acqnr = 0; fi->acqdata = NULL; fi->dynnr = 0; fi->dyndata = NULL; fi->bednr = 0; fi->beddata = NULL; fi->mod = NULL; fi->pluga = NULL; } char *MdcCopyMOD(MOD_INFO *dest, MOD_INFO *src) { GN_INFO *dgn, *sgn; MR_INFO *dmr, *smr; dgn = &dest->gn_info; sgn = &src->gn_info; strncpy(dgn->study_date , sgn->study_date , MDC_MAXSTR); strncpy(dgn->study_time , sgn->study_time , MDC_MAXSTR); strncpy(dgn->series_date , sgn->series_date , MDC_MAXSTR); strncpy(dgn->series_time , sgn->series_time , MDC_MAXSTR); strncpy(dgn->acquisition_date, sgn->acquisition_date , MDC_MAXSTR); strncpy(dgn->acquisition_time, sgn->acquisition_time , MDC_MAXSTR); strncpy(dgn->image_date , sgn->image_date , MDC_MAXSTR); strncpy(dgn->image_time , sgn->image_time , MDC_MAXSTR); dmr = &dest->mr_info; smr = &src->mr_info; dmr->repetition_time = smr->repetition_time; dmr->echo_time = smr->echo_time; dmr->inversion_time = smr->inversion_time; dmr->num_averages = smr->num_averages; dmr->imaging_freq = smr->imaging_freq; dmr->pixel_bandwidth = smr->pixel_bandwidth; dmr->flip_angle = smr->flip_angle; dmr->dbdt = smr->dbdt; dmr->transducer_freq = smr->transducer_freq; strncpy(dmr->transducer_type,smr->transducer_type, MDC_MAXSTR); dmr->pulse_repetition_freq = smr->pulse_repetition_freq; strncpy(dmr->pulse_seq_name, smr->pulse_seq_name,MDC_MAXSTR); strncpy(dmr->steady_state_pulse_seq,smr->steady_state_pulse_seq, MDC_MAXSTR); dmr->slab_thickness = smr->slab_thickness; dmr->sampling_freq = smr->sampling_freq; return(NULL); } char *MdcCopySD(STATIC_DATA *dest, STATIC_DATA *src) { strncpy(dest->label,src->label,MDC_MAXSTR); dest->total_counts = src->total_counts; dest->image_duration = src->image_duration; dest->start_time_hour = src->start_time_hour; dest->start_time_minute = src->start_time_minute; dest->start_time_second = src->start_time_second; return(NULL); } char *MdcCopyGD(GATED_DATA *dest, GATED_DATA *src) { dest->gspect_nesting = src->gspect_nesting; dest->nr_projections = src->nr_projections; dest->extent_rotation = src->extent_rotation; dest->study_duration = src->study_duration; dest->image_duration = src->image_duration; dest->time_per_proj = src->time_per_proj; dest->window_low = src->window_low; dest->window_high = src->window_high; dest->cycles_observed = src->cycles_observed; dest->cycles_acquired = src->cycles_acquired; return(NULL); } char *MdcCopyAD(ACQ_DATA *dest, ACQ_DATA *src) { dest->rotation_direction = src->rotation_direction; dest->detector_motion = src->detector_motion; dest->rotation_offset = src->rotation_offset; dest->radial_position = src->radial_position; dest->angle_start = src->angle_start; dest->angle_step = src->angle_step; dest->scan_arc = src->scan_arc; return(NULL); } char *MdcCopyDD(DYNAMIC_DATA *dest, DYNAMIC_DATA *src) { dest->nr_of_slices = src->nr_of_slices; dest->time_frame_start = src->time_frame_start; dest->time_frame_delay = src->time_frame_delay; dest->time_frame_duration = src->time_frame_duration; dest->delay_slices = src->delay_slices; return(NULL); } char *MdcCopyBD(BED_DATA *dest, BED_DATA *src) { dest->hoffset = src->hoffset; dest->voffset = src->voffset; return(NULL); } char *MdcCopyID(IMG_DATA *dest, IMG_DATA *src, int COPY_IMAGE) { Uint32 i, w, h, b, size; dest->width = src->width; dest->height = src->height; dest->bits = src->bits; dest->type = src->type; dest->flags = src->flags; dest->min = src->min; dest->max = src->max; dest->qmin = src->qmin; dest->qmax = src->qmax; dest->fmin = src->fmin; dest->fmax = src->fmax; dest->qfmin = src->qfmin; dest->qfmax = src->qfmax; if (COPY_IMAGE == MDC_YES) { dest->rescale_slope = src->rescale_slope; dest->rescale_intercept = src->rescale_intercept; w = dest->width; h = dest->height; b = MdcType2Bytes(dest->type); size = w * h * b; dest->buf = malloc(size); if (dest->buf == NULL) return("Failed to copy image buffer"); memcpy(dest->buf,src->buf,size); dest->load_location = src->load_location; dest->rescaled = src->rescaled; dest->rescaled_min = src->rescaled_min; dest->rescaled_max = src->rescaled_max; dest->rescaled_fctr = src->rescaled_fctr; dest->rescaled_slope= src->rescaled_slope; dest->rescaled_intercept = src->rescaled_intercept; dest->quant_scale = src->quant_scale; dest->calibr_fctr = src->calibr_fctr; dest->intercept = src->intercept; }else{ dest->rescale_slope = 1.; dest->rescale_intercept = 0.; dest->buf = NULL; dest->load_location = -1; dest->rescaled = MDC_NO; dest->rescaled_min = 0.; dest->rescaled_max = 0.; dest->rescaled_fctr = 1.; dest->rescaled_slope= 1.; dest->rescaled_intercept = 0.; dest->quant_scale = 1.; dest->calibr_fctr = 1.; dest->intercept = 0.; } dest->frame_number = src->frame_number; dest->slice_start = src->slice_start; dest->quant_units = src->quant_units; dest->calibr_units = src->calibr_units; dest->pixel_xsize = src->pixel_xsize; dest->pixel_ysize = src->pixel_ysize; dest->slice_width = src->slice_width; dest->recon_scale = src->recon_scale; for (i=0; i<3; i++) dest->image_pos_dev[i] = src->image_pos_dev[i]; for (i=0; i<6; i++) dest->image_orient_dev[i] = src->image_orient_dev[i]; for (i=0; i<3; i++) dest->image_pos_pat[i] = src->image_pos_pat[i]; for (i=0; i<6; i++) dest->image_orient_pat[i] = src->image_orient_pat[i]; dest->slice_spacing = src->slice_spacing; dest->ct_zoom_fctr = src->ct_zoom_fctr; /* static data */ if (src->sdata != NULL) { dest->sdata = (STATIC_DATA *)malloc(sizeof(STATIC_DATA)); if (dest->sdata == NULL) return("Failed to copy static data struct"); MdcCopySD(dest->sdata,src->sdata); }else{ dest->sdata = NULL; } /* no copying here; just initialize plugb */ dest->plugb = NULL; return(NULL); } /* KEEP_FILES = preserve file pointers; src pointers are masked (!) */ char *MdcCopyFI(FILEINFO *dest, FILEINFO *src, int COPY_IMAGES, int KEEP_FILES) { char *msg=NULL; int i; MdcInitFI(dest,src->ifname); if (KEEP_FILES == MDC_YES) { /* copy pointers */ dest->ifp = src->ifp; dest->ifp_raw = src->ifp_raw; dest->ofp = src->ofp; dest->ofp_raw = src->ofp_raw; /* mask src pointers */ src->ifp = NULL; src->ifp_raw = NULL; src->ofp = NULL; src->ofp_raw = NULL; } /* A) src reassemble */ MdcMergePath(src->ipath,src->idir,src->ifname); MdcMergePath(src->opath,src->odir,src->ofname); /* B) src -> dest */ memcpy(dest->ipath,src->ipath,MDC_MAX_PATH); memcpy(dest->opath,src->opath,MDC_MAX_PATH); /* C) dest disassemble */ MdcSplitPath(dest->ipath,dest->idir,dest->ifname); MdcSplitPath(dest->opath,dest->odir,dest->ofname); /* D) src disassemble, undo A) */ MdcSplitPath(src->ipath,src->idir,src->ifname); MdcSplitPath(src->opath,src->odir,src->ofname); dest->iformat = src->iformat; dest->oformat = src->oformat; dest->rawconv = src->rawconv; dest->endian = src->endian; dest->modality = src->modality; dest->compression = src->compression; dest->truncated = src->truncated; dest->diff_type = src->diff_type; dest->diff_size = src->diff_size; dest->diff_scale = src->diff_scale; /*dest->number = src->number;*/ /* just see later */ dest->mwidth = src->mwidth; dest->mheight = src->mheight; dest->bits = src->bits; dest->type = src->type; for (i=0; idim[i] = src->dim[i]; for (i=0; ipixdim[i] = src->pixdim[i]; dest->glmin = src->glmin; dest->glmax = src->glmax; dest->qglmin = src->qglmin; dest->qglmax = src->qglmax; dest->contrast_remapped = src->contrast_remapped; dest->window_centre = src->window_centre; dest->window_width = src->window_width; dest->slice_projection = src->slice_projection; dest->pat_slice_orient = src->pat_slice_orient; strncpy(dest->pat_pos,src->pat_pos,MDC_MAXSTR); strncpy(dest->pat_orient,src->pat_orient,MDC_MAXSTR); strncpy(dest->patient_sex,src->patient_sex,MDC_MAXSTR); strncpy(dest->patient_name,src->patient_name,MDC_MAXSTR); strncpy(dest->patient_id,src->patient_id,MDC_MAXSTR); strncpy(dest->patient_dob,src->patient_dob,MDC_MAXSTR); strncpy(dest->operator_name,src->operator_name,MDC_MAXSTR); strncpy(dest->study_descr,src->study_descr,MDC_MAXSTR); strncpy(dest->study_id,src->study_id,MDC_MAXSTR); dest->study_date_day = src->study_date_day; dest->study_date_month = src->study_date_month; dest->study_date_year = src->study_date_year; dest->study_time_hour = src->study_time_hour; dest->study_time_minute= src->study_time_minute; dest->study_time_second= src->study_time_second; dest->dose_time_hour = src->dose_time_hour; dest->dose_time_minute = src->dose_time_minute; dest->dose_time_second = src->dose_time_second; dest->nr_series = src->nr_series; dest->nr_acquisition = src->nr_acquisition; dest->nr_instance = src->nr_instance; dest->acquisition_type = src->acquisition_type; dest->planar = src->planar; dest->decay_corrected = src->decay_corrected; dest->flood_corrected = src->flood_corrected; dest->reconstructed = src->reconstructed; strncpy(dest->recon_method,src->recon_method,MDC_MAXSTR); strncpy(dest->institution,src->institution,MDC_MAXSTR); strncpy(dest->manufacturer,src->manufacturer,MDC_MAXSTR); strncpy(dest->series_descr,src->series_descr,MDC_MAXSTR); strncpy(dest->radiopharma,src->radiopharma,MDC_MAXSTR); strncpy(dest->filter_type,src->filter_type,MDC_MAXSTR); strncpy(dest->organ_code,src->organ_code,MDC_MAXSTR); strncpy(dest->isotope_code,src->isotope_code,MDC_MAXSTR); dest->patient_weight = src->patient_weight; dest->patient_height = src->patient_height; dest->isotope_halflife = src->isotope_halflife; dest->gantry_tilt = src->gantry_tilt; dest->injected_dose = src->injected_dose; dest->map = src->map; memcpy(dest->palette,src->palette,768); /* copy comment */ if (src->comm_length > 0) { dest->comment = malloc(src->comm_length); if (dest->comment == NULL) { /* bad, but don't fail on some comment */ dest->comm_length = 0; }else{ dest->comm_length = src->comm_length; memcpy(dest->comment,src->comment,dest->comm_length); } }else{ dest->comm_length = 0; dest->comment = NULL; } /* copy ACQ_DATA structs */ if (src->acqnr > 0 && src->acqdata != NULL) { dest->acqnr = src->acqnr; dest->acqdata = (ACQ_DATA *)malloc(dest->acqnr * sizeof(ACQ_DATA)); if (dest->acqdata == NULL) return("Failed to create ACQ_DATA structs"); for (i=0; iacqnr; i++) { msg = MdcCopyAD(&dest->acqdata[i],&src->acqdata[i]); if (msg != NULL) return(msg); } }else{ dest->acqnr = 0; dest->acqdata = NULL; } /* copy GATED_DATA structs */ if (src->gatednr > 0 && src->gdata != NULL) { dest->gatednr = src->gatednr; dest->gdata = (GATED_DATA *)malloc(dest->gatednr * sizeof(GATED_DATA)); if (dest->gdata == NULL) return("Failed to create GATED_DATA structs"); for (i=0; igatednr; i++) { msg = MdcCopyGD(&dest->gdata[i],&src->gdata[i]); if (msg != NULL) return(msg); } }else{ dest->gatednr = 0; dest->gdata = NULL; } /* copy DYNAMIC_DATA structs */ if ((src->dynnr > 0) && (src->dyndata != NULL)) { dest->dynnr = src->dynnr; dest->dyndata = (DYNAMIC_DATA *)malloc(dest->dynnr * sizeof(DYNAMIC_DATA)); if (dest->dyndata == NULL) return("Failed to create DYNAMIC_DATA structs"); for (i=0; idynnr; i++) { msg = MdcCopyDD(&dest->dyndata[i],&src->dyndata[i]); if (msg != NULL) return(msg); } }else{ dest->dynnr = 0; dest->dyndata = NULL; } /* copy BED_DATA structs */ if ((src->bednr > 0) && (src->beddata != NULL)) { dest->bednr = src->bednr; dest->beddata = (BED_DATA *)malloc(dest->bednr * sizeof(BED_DATA)); if (dest->beddata == NULL) return("Failed to create BED_DATA structs"); for (i=0; ibednr; i++) { msg = MdcCopyBD(&dest->beddata[i],&src->beddata[i]); if (msg != NULL) return(msg); } }else{ dest->bednr = 0; dest->beddata = NULL; } /* copy IMG_DATA structs */ if ((COPY_IMAGES == MDC_YES) && (src->number > 0) && (src->image != NULL)) { dest->number = src->number; dest->image = (IMG_DATA *)malloc(dest->number * sizeof(IMG_DATA)); if (dest->image == NULL) return("Failed to create IMG_DATA structs"); for (i=0; inumber; i++) { msg = MdcCopyID(&dest->image[i],&src->image[i],MDC_YES); if (msg != NULL) return(msg); } }else{ dest->number = 0; dest->image = NULL; } /* copy MOD_INFO struct */ if (src->mod != NULL) { dest->mod = (MOD_INFO *)malloc(sizeof(MOD_INFO)); if (dest->mod == NULL) return("Failed to copy MOD_INFO struct"); MdcCopyMOD(dest->mod,src->mod); }else{ dest->mod = NULL; } return(NULL); } void MdcFreeMODs(FILEINFO *fi) { MdcFree(fi->mod); } void MdcFreeIDs(FILEINFO *fi) { IMG_DATA *id=NULL; Uint32 i; if ( fi->image != NULL ) { for ( i=0; inumber; i++) { id = (IMG_DATA *)&fi->image[i]; MdcFree(id->buf); MdcFree(id->sdata); MdcFree(id->plugb); } MdcFree(fi->image); } } void MdcFreeODs(FILEINFO *fi) { Uint32 i; if (fi->acqnr > 0) { MdcFree(fi->acqdata); fi->acqnr = 0; } if (fi->dynnr > 0) { MdcFree(fi->dyndata); fi->dynnr = 0; } if (fi->bednr > 0) { MdcFree(fi->beddata); fi->bednr = 0; } if (fi->gatednr > 0) { MdcFree(fi->gdata); fi->gatednr = 0; } for (i=0; inumber; i++) MdcFree(fi->image[i].sdata); } void MdcResetIDs(FILEINFO *fi) { Uint32 i; for (i=0; inumber; i++) { fi->image[i].rescaled = MDC_NO; fi->image[i].rescaled_max = 0.; fi->image[i].rescaled_min = 0.; fi->image[i].rescaled_fctr = 1.; fi->image[i].rescaled_slope= 1.; fi->image[i].rescaled_intercept = 0.; } } char *MdcResetODs(FILEINFO *fi) { Uint32 i; /* first free other data structs */ MdcFreeODs(fi); /* now get emtpy structs */ if (fi->reconstructed == MDC_NO) { if (!MdcGetStructAD(fi,1)) return("Failure to reset ACQ_DATA structs"); } if ((fi->acquisition_type == MDC_ACQUISITION_GATED || fi->acquisition_type == MDC_ACQUISITION_GSPECT) && (fi->gatednr == 0)) { if (!MdcGetStructGD(fi,1)) return("Failure to reset GATED_DATA structs"); } if ((fi->acquisition_type == MDC_ACQUISITION_DYNAMIC || fi->acquisition_type == MDC_ACQUISITION_TOMO) && (fi->dynnr == 0)) { if (!MdcGetStructDD(fi,(Uint32)fi->dim[4])) return("Failure to reset DYNAMIC_DATA structs"); for (i=0; idynnr; i++) { fi->dyndata[i].nr_of_slices = fi->dim[3]; fi->dyndata[i].time_frame_duration = fi->pixdim[4]; } } if (fi->bednr == 0) { if (!MdcGetStructBD(fi,(Uint32)fi->dim[6])) return("Failure to reset BED_DATA structs"); for (i=0; ibednr; i++) { fi->beddata[i].hoffset = 0.; fi->beddata[i].voffset = 0.; } } if ((fi->acquisition_type == MDC_ACQUISITION_STATIC) && (fi->number > 0)) { if (!MdcGetStructSD(fi,fi->number)) return("Failure to reset STATIC_DATA structs"); } return(NULL); } void MdcCleanUpFI(FILEINFO *fi) { if (fi->dynnr > 0) { MdcFree(fi->dyndata); fi->dynnr = 0; } if (fi->acqnr > 0) { MdcFree(fi->acqdata); fi->acqnr = 0; } if (fi->bednr > 0) { MdcFree(fi->beddata); fi->bednr = 0; } if (fi->gatednr > 0) { MdcFree(fi->gdata); fi->gatednr = 0; } if (fi->comm_length > 0) { MdcFree(fi->comment); fi->comm_length = 0; } MdcFreeIDs(fi); MdcFreeMODs(fi); MdcFree(fi->pluga); MdcCloseFile(fi->ifp); MdcCloseFile(fi->ifp_raw); MdcCloseFile(fi->ofp); MdcCloseFile(fi->ofp_raw); MdcInitFI(fi,""); } xmedcon-0.14.1/source/xprogbar.c0000644000175000017510000001502212636253502013450 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xprogbar.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : progressbar routines * * * * project : (X)MedCon by Erik Nolf * * * * Note : This code gets linked in (X)MedCon library with X-support* * * * Functions : XMdcProgressBar() - Run progress bar * * XMdcUpdateDrawing() - Update queued drawings * * XMdcUpdateProgressBar() - Update progressbar * * XMdcSetProgressBar() - Set progressbar * * XMdcIncrProgressBar() - Increment progressbar * * XMdcCreateProgressBar() - Create progressbar * * XMdcBeginProgressBar() - Begin of progressbar * * XMdcEndProgressBar() - End of progressbar * * XMdcHandleBarLabel() - Handle its label * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xprogbar.c,v 1.20 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "xmedcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ static GtkWidget *pbarwindow=NULL; static GtkWidget *pbar=NULL; static GtkWidget *pbarlabel=NULL; static char barstring[26]; static gfloat pvalue = 0.; Uint8 XMDC_DOBAR = MDC_NO; /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcProgressBar(int type, float value, char *label) { switch (type) { case MDC_PROGRESS_BEGIN: XMdcBeginProgressBar(label); break; case MDC_PROGRESS_SET : XMdcSetProgressBar(value); break; case MDC_PROGRESS_INCR : XMdcIncrProgressBar(value); break; case MDC_PROGRESS_END : XMdcEndProgressBar(); break; } } void XMdcUpdateDrawing(void) { while (gtk_events_pending()) gtk_main_iteration(); } void XMdcUpdateProgressBar(void) { if (XMDC_DOBAR) { if (pvalue > 1.0 ) pvalue = 1.0; gtk_progress_bar_update(GTK_PROGRESS_BAR(pbar), pvalue); } XMdcUpdateDrawing(); } void XMdcSetProgressBar(float set) { if (XMDC_DOBAR) pvalue = (gfloat)set; XMdcUpdateProgressBar(); } void XMdcIncrProgressBar(float incr) { if (XMDC_DOBAR) pvalue += (gfloat)incr; XMdcUpdateProgressBar(); } void XMdcCreateProgressBar(char *labelstring) { GtkWidget *vbox; pvalue = 0.; XMDC_DOBAR = MDC_YES; pbarwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_signal_connect( GTK_OBJECT(pbarwindow), "delete-event", GTK_SIGNAL_FUNC(XMdcPreventDelete), NULL); gtk_signal_connect( GTK_OBJECT(pbarwindow), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroy),NULL); gtk_window_set_title(GTK_WINDOW(pbarwindow),"Progress"); gtk_window_set_position(GTK_WINDOW(pbarwindow),GTK_WIN_POS_CENTER); gtk_container_set_border_width(GTK_CONTAINER(pbarwindow), 0); vbox = gtk_vbox_new(FALSE, 5); gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); gtk_container_add(GTK_CONTAINER(pbarwindow),vbox); gtk_widget_show(vbox); pbarlabel = gtk_label_new(XMdcHandleBarLabel(labelstring)); gtk_widget_set_name(pbarlabel,"BarLabel"); gtk_misc_set_alignment(GTK_MISC (pbarlabel), 0.0, 0.5); gtk_box_pack_start(GTK_BOX(vbox),pbarlabel,TRUE, TRUE, 0); gtk_widget_show(pbarlabel); pbar = gtk_progress_bar_new(); gtk_widget_set_usize(pbar, 200, 20); gtk_box_pack_start(GTK_BOX(vbox), pbar, TRUE, TRUE, 0); gtk_widget_show(pbar); gtk_widget_show(pbarwindow); XMdcUpdateProgressBar(); } void XMdcBeginProgressBar(char *labelstring) { if (XMDC_DOBAR) { pvalue = 0.0; gtk_label_set_text(GTK_LABEL(pbarlabel),XMdcHandleBarLabel(NULL)); XMdcUpdateProgressBar(); gtk_label_set_text(GTK_LABEL(pbarlabel),XMdcHandleBarLabel(labelstring)); XMdcUpdateProgressBar(); }else{ XMdcCreateProgressBar(labelstring); XMdcMainWidgetsInsensitive(); } } void XMdcEndProgressBar(void) { if (XMDC_DOBAR) { gtk_widget_destroy(pbarwindow); pbarwindow = NULL; pbar = NULL; pbarlabel = NULL; XMDC_DOBAR = MDC_NO; XMdcMainWidgetsResensitive(); } } char *XMdcHandleBarLabel(char *labelstring) { Uint8 i; if (labelstring == NULL) { /* clean with spaces */ for (i=0;i<25;i++) barstring[i]=' '; barstring[25]='\0'; }else{ /* fill out new label */ sprintf(barstring,"%-25s",labelstring); if (strlen(labelstring) < 25) { for (i=strlen(labelstring); i < 25 ; i++) barstring[i]=' '; } } barstring[25]='\0'; return(barstring); } xmedcon-0.14.1/source/m-nifti.h0000644000175000017510000000413712636253502013201 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-nifti.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-nifti.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-nifti.h,v 1.11 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_NIFTI_H__ #define __M_NIFTI_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcCheckNIFTI(FILEINFO *fi); const char *MdcReadNIFTI(FILEINFO *fi); const char *MdcWriteNIFTI(FILEINFO *fi); #endif xmedcon-0.14.1/source/m-png.h0000644000175000017510000000415112636253502012650 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-png.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-png.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-png.h,v 1.16 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_PNG_H__ #define __M_PNG_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_PNG_BYTES_TO_CHECK 4 /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcCheckPNG(FILEINFO *fi); char *MdcReadPNG(FILEINFO *fi); char *MdcWritePNG(FILEINFO *fi); #endif xmedcon-0.14.1/source/m-files.h0000644000175000017510000001025112636253502013164 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-files.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-files.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-files.h,v 1.38 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_FILES_H__ #define __M_FILES_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ #define MdcSplitPath(x,y,z) MdcMySplitPath(x,&y,&z) #define MdcMergePath(x,y,z) MdcMyMergePath(x,y,&z) #define MdcCloseFile(fp) { \ if (fp!=NULL && fp!=stderr && \ fp!=stdin && fp!=stdout ) \ fclose(fp); \ fp=NULL; \ } /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcOpenFile(FILEINFO *fi, const char *path); int MdcReadFile(FILEINFO *fi, int filenr, char *(*ReadFunc)()); int MdcWriteFile(FILEINFO *fi, int format, int prefixnr, char *(*WriteFunc)()); int MdcLoadFile(FILEINFO *fi); int MdcSaveFile(FILEINFO *fi, int format, int prefixnr); int MdcLoadPlane(FILEINFO *fi, Uint32 img); int MdcDecompressFile(const char *path); void MdcStringCopy(char *s1, char *s2, Uint32 length); int MdcFileSize(FILE *fp); int MdcFileExists(const char *fname); int MdcKeepFile(const char *fname); int MdcGetFrmt(FILEINFO *fi); Uint8 *MdcGetImgBuffer(Uint32 bytes); char *MdcHandleTruncated(FILEINFO *fi, Uint32 images, int remap); int MdcWriteLine(IMG_DATA *id, Uint8 *buf, int type, FILE *fp); int MdcWriteDoublePixel(double pix, int type, FILE *fp); char *MdcGetFname(char path[]); char *MdcGetLastPathDelim(char *path); void MdcMySplitPath(char path[], char **dir, char **fname); void MdcMyMergePath(char path[], char *dir, char **fname); void MdcSetExt(char path[], char *ext); void MdcNewExt(char dest[], char *src, char *ext); void MdcPrefix(int n); int MdcGetPrefixNr(FILEINFO *fi, int nummer); void MdcNewName(char dest[], char *src, char *ext); char *MdcAliasName(FILEINFO *fi, char alias[]); void MdcEchoAliasName(FILEINFO *fi); void MdcDefaultName(FILEINFO *fi, int format, char dest[], char *src); void MdcRenameFile(char *name); void MdcFillImgPos(FILEINFO *fi, Uint32 nr, Uint32 plane, float translation); void MdcFillImgOrient(FILEINFO *fi, Uint32 nr); int MdcGetOrthogonalInt(float f); Int8 MdcGetPatSliceOrient(FILEINFO *fi, Uint32 i); Int8 MdcTryPatSliceOrient(char *pat_orient); Int8 MdcCheckQuantitation(FILEINFO *fi); float MdcGetHeartRate(GATED_DATA *gd, Int16 type); #endif xmedcon-0.14.1/source/xrender.c0000644000175000017510000002637612636253502013311 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xrender.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : rendering type handling * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcApplyNewRendering() - Apply new rendering * * XMdcRenderingSelCallbackApply() - Rendering Apply * * XMdcRenderingSel() - Rendering selection * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xrender.c,v 1.19 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include #include "xmedcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ static GtkWidget *wrender=NULL; /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcApplyNewRendering(void) { gtk_widget_set_sensitive(my.viewwindow,FALSE); XMdcRemovePreviousColorMap(); XMdcRemovePreviousImages(); XMdcBuildColorMap(); XMdcBuildCurrentImages(); gtk_widget_set_sensitive(my.viewwindow,TRUE); } void XMdcRenderingSelCallbackApply(GtkWidget *widget, gpointer data) { GdkRgbDither dither = sRenderSelection.Dither; GdkInterpType interp = sRenderSelection.Interp; MdcDebugPrint("dither type: "); if (GTK_TOGGLE_BUTTON(sRenderSelection.DitherNone)->active) { dither = GDK_RGB_DITHER_NONE; MdcDebugPrint("\tnone"); }else if (GTK_TOGGLE_BUTTON(sRenderSelection.DitherNormal)->active) { dither = GDK_RGB_DITHER_NORMAL; MdcDebugPrint("\tnormal"); }else if (GTK_TOGGLE_BUTTON(sRenderSelection.DitherMax)->active) { dither = GDK_RGB_DITHER_MAX; MdcDebugPrint("\tmax"); } MdcDebugPrint("interpolation type: "); if (GTK_TOGGLE_BUTTON(sRenderSelection.InterpNearest)->active) { interp = GDK_INTERP_NEAREST; MdcDebugPrint("\tnearest"); }else if (GTK_TOGGLE_BUTTON(sRenderSelection.InterpTiles)->active) { interp = GDK_INTERP_TILES; MdcDebugPrint("\ttiles"); }else if (GTK_TOGGLE_BUTTON(sRenderSelection.InterpBilinear)->active) { interp = GDK_INTERP_BILINEAR; MdcDebugPrint("\tbilinear"); }else if (GTK_TOGGLE_BUTTON(sRenderSelection.InterpHyper)->active) { interp = GDK_INTERP_HYPER; MdcDebugPrint("\thyper"); } if (sRenderSelection.Dither != dither || sRenderSelection.Interp != interp) { sRenderSelection.Dither = dither; sRenderSelection.Interp = interp; if (XMDC_FILE_OPEN == MDC_YES) XMdcApplyNewRendering(); } } void XMdcRenderingSel(void) { GtkWidget *box1; GtkWidget *box2; GtkWidget *box3; GtkWidget *box4; GtkWidget *frame; GtkWidget *button; GtkWidget *separator; GSList *group; if (wrender == NULL) { wrender = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_signal_connect(GTK_OBJECT(wrender),"destroy", GTK_SIGNAL_FUNC(XMdcMedconQuit),NULL); gtk_signal_connect(GTK_OBJECT(wrender),"delete_event", GTK_SIGNAL_FUNC(XMdcHandlerToHide),NULL); gtk_window_set_title(GTK_WINDOW(wrender),"Render Selection"); gtk_container_set_border_width (GTK_CONTAINER (wrender), 0); box1 = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (wrender), box1); gtk_widget_show(box1); box2 = gtk_vbox_new (FALSE, 5); gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER(box2), 5); gtk_widget_show(box2); box3 = gtk_hbox_new (FALSE, 5); gtk_box_pack_start(GTK_BOX(box2), box3, TRUE, TRUE, 0); gtk_widget_show(box3); /* create frame Dither Type */ frame = gtk_frame_new("Dither Type"); gtk_box_pack_start(GTK_BOX (box3), frame, TRUE, TRUE, 0); gtk_widget_show(frame); box4 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), box4); gtk_container_set_border_width(GTK_CONTAINER(box4), 5); gtk_widget_show(box4); button = gtk_radio_button_new_with_label(NULL, "None"); gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0); if (sRenderSelection.Dither == GDK_RGB_DITHER_NONE) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sRenderSelection.DitherNone = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group, "Normal (8 bpp and below)"); gtk_box_pack_start (GTK_BOX(box4), button, TRUE, TRUE, 0); if (sRenderSelection.Dither == GDK_RGB_DITHER_NORMAL) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sRenderSelection.DitherNormal = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group, "Max (16 bpp and below)"); gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0); if (sRenderSelection.Dither == GDK_RGB_DITHER_MAX) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sRenderSelection.DitherMax = button; /* create frame Interpolation Type */ frame = gtk_frame_new("Interpolation Type"); gtk_box_pack_start(GTK_BOX(box3), frame, TRUE, TRUE, 0); gtk_widget_show(frame); box4 = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), box4); gtk_container_set_border_width(GTK_CONTAINER(box4), 10); gtk_widget_show(box4); button = gtk_radio_button_new_with_label(NULL,"Nearest neighbour sampling"); gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0); if (sRenderSelection.Interp == GDK_INTERP_NEAREST) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sRenderSelection.InterpNearest = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group,"Tiles as mix nearest and bilinear"); gtk_box_pack_start (GTK_BOX(box4), button, TRUE, TRUE, 0); if (sRenderSelection.Interp == GDK_INTERP_TILES) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sRenderSelection.InterpTiles = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group,"Bilinear interpolation"); gtk_box_pack_start (GTK_BOX(box4), button, TRUE, TRUE, 0); if (sRenderSelection.Interp == GDK_INTERP_BILINEAR) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sRenderSelection.InterpBilinear = button; group = gtk_radio_button_group (GTK_RADIO_BUTTON (button)); button = gtk_radio_button_new_with_label(group,"Hyperbolic-filter interpolation"); gtk_box_pack_start (GTK_BOX(box4), button, TRUE, TRUE, 0); if (sRenderSelection.Interp == GDK_INTERP_HYPER) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), TRUE); gtk_widget_show(button); sRenderSelection.InterpHyper = button; /* create horizontal separator */ separator = gtk_hseparator_new (); gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, FALSE, 0); gtk_widget_show (separator); /* create bottom button box */ box2 = gtk_hbox_new (FALSE, 0); gtk_box_pack_start(GTK_BOX(box1), box2, TRUE, TRUE, 2); gtk_widget_show(box2); button = gtk_button_new_with_label("Apply"); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 2); gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(wrender)); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(XMdcRenderingSelCallbackApply), NULL); gtk_widget_show(button); button = gtk_button_new_with_label ("Cancel"); gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 2); gtk_signal_connect_object(GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide),GTK_OBJECT(wrender)); gtk_widget_show(button); }else{ /* set buttons to appropriate state */ GtkWidget *b1, *b2, *b3, *b4; gtk_widget_hide(wrender); b1 = sRenderSelection.DitherNone; b2 = sRenderSelection.DitherNormal; b3 = sRenderSelection.DitherMax; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3),FALSE); switch (sRenderSelection.Dither) { case GDK_RGB_DITHER_NONE : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),TRUE); break; case GDK_RGB_DITHER_NORMAL: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),TRUE); break; case GDK_RGB_DITHER_MAX : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3),TRUE); break; } b1 = sRenderSelection.InterpNearest; b2 = sRenderSelection.InterpTiles; b3 = sRenderSelection.InterpBilinear; b4 = sRenderSelection.InterpHyper; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3),FALSE); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b4),FALSE); switch (sRenderSelection.Interp) { case GDK_INTERP_NEAREST : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b1),TRUE); break; case GDK_INTERP_TILES : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b2),TRUE); break; case GDK_INTERP_BILINEAR: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b3),TRUE); break; case GDK_INTERP_HYPER : gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b4),TRUE); break; } } XMdcShowWidget(wrender); } xmedcon-0.14.1/source/xreader.h0000644000175000017510000000430512636253502013265 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xreader.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xreader.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xreader.h,v 1.20 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XREADER_H__ #define __XREADER_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ int XMdcReadFile(const char *fname); void XMdcRawReadFinish(guint otype); void XMdcRawReadInteractive(GtkWidget *fs); void XMdcRawReadPredef(GtkWidget *fs); void XMdcRawReadCancel(guint otype); Int16 XMdcGetImageInfoPixelType(void); void XMdcGetImageInfoCallbackApply(void); void XMdcGetImageInfoCallbackCancel(void); void XMdcGetImageInfo(void); void XMdcGetHeaderInfoCallbackApply(void); void XMdcGetHeaderInfo(void); #endif xmedcon-0.14.1/source/m-error.c0000644000175000017510000000767212636253502013223 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-error.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : Handle warnings and errors * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcPrntStream() - Gives proper output stream * * MdcPrntScrn() - Print to screen * * MdcPrntMesg() - Print a message * * MdcPrntWarn() - Print a warning * * MdcPrntErr() - Print error and leave * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-error.c,v 1.31 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #include #ifdef HAVE_STDLIB_H #include #endif #include "m-defs.h" #include "m-global.h" #include "m-error.h" #if GLIBSUPPORTED #include #endif /**************************************************************************** F U N C T I O N S ****************************************************************************/ static FILE *MdcPrntStream(void) { FILE *stream; if (MDC_FILE_STDOUT == MDC_YES) { stream = stderr; }else{ stream = stdout; } return(stream); } void MdcPrntScrn(char *fmt, ...) { va_list args; va_start(args, fmt); vfprintf(MdcPrntStream(), fmt, args); va_end(args); } void MdcPrntMesg(char *fmt, ...) { va_list args; if (MDC_BLOCK_MESSAGES >= MDC_LEVEL_MESG) return; va_start(args,fmt); #if GLIBSUPPORTED g_logv(MDC_PRGR,G_LOG_LEVEL_MESSAGE, fmt, args); #else MdcPrntScrn("\n%s: Message: ",MDC_PRGR); vfprintf(MdcPrntStream(), fmt, args); fprintf(MdcPrntStream(),"\n\n"); #endif va_end(args); } void MdcPrntWarn(char *fmt, ...) { va_list args; if (MDC_BLOCK_MESSAGES >= MDC_LEVEL_WARN) return; va_start(args, fmt); #if GLIBSUPPORTED g_logv(MDC_PRGR,G_LOG_LEVEL_WARNING, fmt, args); #else MdcPrntScrn("\n%s: Warning: ",MDC_PRGR); vfprintf(MdcPrntStream(), fmt, args); fprintf(MdcPrntStream(),"\n\n"); #endif va_end(args); } void MdcPrntErr(int code, char *fmt, ...) { va_list args; if (MDC_BLOCK_MESSAGES >= MDC_LEVEL_ERR) exit(-code); va_start(args, fmt); #if GLIBSUPPORTED g_logv(MDC_PRGR,G_LOG_LEVEL_ERROR, fmt, args); #else MdcPrntScrn("\n%s: Error : ",MDC_PRGR); vfprintf(MdcPrntStream(), fmt, args); fprintf(MdcPrntStream(),"\n\n"); #endif va_end(args); exit(-code); } xmedcon-0.14.1/source/m-pixels.c0000644000175000017510000003253012636253502013365 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-pixels.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : Ask & display pixel values * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcDisplayPixels() - Display pixel values * * MdcAskPixels() - Ask for pixels * * MdcGetPixels() - Get specified pixels * * MdcGetOnePixel() - Get one pixel value * * MdcPrintPixel() - Print pixel value * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-pixels.c,v 1.41 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "medcon.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ void MdcDisplayPixels(FILEINFO *fi) { Uint32 *images=NULL; Uint32 *cols=NULL; Uint32 *rows=NULL; if (MDC_FILE_STDIN == MDC_YES) return; /* stdin already in use */ if (fi->type == COLRGB) { MdcPrntWarn("Print values of true color files unsupported"); return; } MdcPrintLine('-',MDC_FULL_LENGTH); MdcPrntScrn("\tPIXEL DISPLAY\t\tFILE: %s\n",fi->ifname); MdcPrintLine('-',MDC_FULL_LENGTH); if (MdcAskPixels(fi,&images,&cols,&rows) == MDC_YES) { MdcGetPixels(fi,images,cols,rows); } MdcPrintLine('-',MDC_FULL_LENGTH); MdcFree(images); MdcFree(cols); MdcFree(rows); } int MdcAskPixels(FILEINFO *fi, Uint32 *img[], Uint32 *col[], Uint32 *row[]) { Int32 a1; Uint32 images=1, bt, it, f, p, g, b; Uint32 *frames, *planes, *gates, *beds; Uint32 *itmp, *ctmp, *rtmp; char *msg=NULL; if (MDC_PIXELS_PRINT_ALL == MDC_YES) { itmp = (Uint32 *)malloc(2*sizeof(Uint32)); ctmp = (Uint32 *)malloc(2*sizeof(Uint32)); rtmp = (Uint32 *)malloc(2*sizeof(Uint32)); if ((itmp == NULL) || (ctmp == NULL) || (rtmp == NULL)) { MdcPrntWarn("Failure to malloc index buffers"); MdcFree(itmp); MdcFree(ctmp); MdcFree(rtmp); return(MDC_NO); } /* all images */ itmp[0]=1; itmp[1]=0; /* one pixel coord: 0,0 = all */ ctmp[0]=1; ctmp[1]=0; rtmp[0]=1; rtmp[1]=0; *img = itmp; *col = ctmp; *row = rtmp; return(MDC_YES); } a1 = MdcGetSelectionType(); MdcPrntScrn("\n"); MdcPrntScrn("\n\tInput notes: a) Any number must be one-based (0 = All)"); MdcPrntScrn("\n\t b) Syntax of range : X...Y or X-Y"); MdcPrntScrn("\n\t c) Syntax of interval: X:S:Y (S = step)"); MdcPrntScrn("\n\t d) Just type for the entire range\n"); if ( a1 == MDC_INPUT_ECAT_STYLE ) { /* ecat */ if ( (planes=(Uint32 *)malloc((fi->dim[3]+1)*sizeof(Uint32))) == NULL ){ MdcPrntWarn("Couldn't allocate planes buffer"); return(MDC_NO); } memset(planes,0,(fi->dim[3]+1)*sizeof(Uint32)); if ( (frames=(Uint32 *)malloc((fi->dim[4]+1)*sizeof(Uint32))) == NULL ){ MdcPrntWarn("Couldn't allocate frames buffer"); MdcFree(planes); return(MDC_NO); } memset(frames,0,(fi->dim[4]+1)*sizeof(Uint32)); if ( (gates=(Uint32 *)malloc((fi->dim[5]+1)*sizeof(Uint32))) == NULL ) { MdcPrntWarn("Couldn't allocate gates buffer"); MdcFree(frames); MdcFree(planes); return(MDC_NO); } memset(gates,0,(fi->dim[5]+1)*sizeof(Uint32)); if ( (beds=(Uint32 *)malloc((fi->dim[6]+1)*sizeof(Uint32))) == NULL ) { MdcPrntWarn("Couldn't allocate beds buffer"); MdcFree(frames); MdcFree(planes); MdcFree(gates); return(MDC_NO); } memset(beds,0,(fi->dim[6]+1)*sizeof(Uint32)); MdcPrntScrn("\n\tGive planes list [1...%u]: ",fi->dim[3]); MdcGetStrInput(mdcbufr,MDC_2KB_OFFSET); if ((msg=MdcHandleEcatList(mdcbufr,&planes,(Uint32)fi->dim[3])) != NULL) { MdcPrntWarn(msg); MdcFree(frames); MdcFree(planes); MdcFree(gates); MdcFree(beds); return(MDC_NO); } MdcPrntScrn("\n\tGive frames list [1...%u]: ",fi->dim[4]); MdcGetStrInput(mdcbufr,MDC_2KB_OFFSET); if ((msg=MdcHandleEcatList(mdcbufr,&frames,(Uint32)fi->dim[4])) != NULL) { MdcPrntWarn(msg); MdcFree(frames); MdcFree(planes); MdcFree(gates); MdcFree(beds); return(MDC_NO); } MdcPrntScrn("\n\tGive gates list [1...%u]: ",fi->dim[5]); MdcGetStrInput(mdcbufr,MDC_2KB_OFFSET); if ((msg=MdcHandleEcatList(mdcbufr,&gates,(Uint32)fi->dim[5])) != NULL) { MdcPrntWarn(msg); MdcFree(frames); MdcFree(planes); MdcFree(gates); MdcFree(beds); return(MDC_NO); } MdcPrntScrn("\n\tGive beds list [1...%u]: ",fi->dim[6]); MdcGetStrInput(mdcbufr,MDC_2KB_OFFSET); if ((msg=MdcHandleEcatList(mdcbufr,&beds,(Uint32)fi->dim[6])) != NULL) { MdcPrntWarn(msg); MdcFree(frames); MdcFree(planes); MdcFree(gates); MdcFree(beds); return(MDC_NO); } images*=(planes[0]*frames[0]*gates[0]*beds[0]); if (images == 0 ) { MdcPrntWarn("No valuable images specified!"); MdcFree(frames); MdcFree(planes); MdcFree(gates); MdcFree(beds); return(MDC_NO); } itmp=(Uint32 *)malloc((images+1)*sizeof(Uint32)); if (itmp == NULL) { MdcPrntWarn("Couldn't allocate images number buffer"); MdcFree(frames); MdcFree(planes); MdcFree(gates); MdcFree(beds); return(MDC_NO); } itmp[0]=images; /* get sequential image numbers (like normal selection) */ it = 1; bt = 2; for (b=1; b<=fi->dim[6]; b++) if (beds[b]) for (g=1; g<=fi->dim[5]; g++) if (gates[g]) for (f=1; f<=fi->dim[4]; f++) if (frames[f]) for (p=1; p<=fi->dim[3]; p++) if (planes[p]) { itmp[it++]= p + fi->dim[3]*( (f-1) + fi->dim[4]*( (g-1) + fi->dim[5]*( (b-1) ) ) ); } if ((it-1) != images) { MdcPrntErr(MDC_BAD_CODE,"Internal Error ## Improper list handling"); } MdcFree(planes); MdcFree(frames); MdcFree(gates); MdcFree(beds); }else{ /* normal */ if ( (itmp=(Uint32 *)malloc(MDC_BUF_ITMS*sizeof(Uint32))) == NULL ) { MdcPrntWarn("Couldn't allocate image numbers buffer"); return(MDC_NO); } itmp[0] = 0; MdcPrntScrn("\n\tGive a list of image numbers: ex. 1 7...31 84"); MdcPrntScrn("\n\tYour input [1...%u]: ",fi->number); MdcGetStrInput(mdcbufr,MDC_2KB_OFFSET); it = 1; bt = 2; if ((msg=MdcHandleNormList(mdcbufr,&itmp,&it,&bt,fi->number)) != NULL){ MdcPrntWarn(msg); if (itmp != NULL) MdcFree(itmp); return(MDC_NO); } } if (itmp[1] == 0) { /* all images selected, special case */ itmp[0]=fi->number; it = fi->number; }else{ itmp[0] = it - 1; } if (itmp[0] == 0) { MdcPrntWarn("No images specified!"); MdcFree(itmp); return(MDC_NO); } if ( (ctmp=(Uint32 *)malloc(MDC_BUF_ITMS*sizeof(Uint32))) == NULL ) { MdcPrntWarn("Couldn't allocate pixels column buffer"); MdcFree(itmp); return(MDC_NO); } if ( (rtmp=(Uint32 *)malloc(MDC_BUF_ITMS*sizeof(Uint32))) == NULL ) { MdcPrntWarn("Couldn't allocate pixels row buffer"); MdcFree(itmp); MdcFree(ctmp); return(MDC_NO); } it=1; bt=2; MdcPrntScrn("\n\n\tGive a list of pixels x,y : ex. 1,1 12,0"); MdcPrntScrn("\n\tYour input [%u,%u]: ",fi->mwidth,fi->mheight); MdcGetStrInput(mdcbufr,MDC_2KB_OFFSET); MdcPrntScrn("\n"); if ((msg=MdcHandlePixelList(mdcbufr,&ctmp,&rtmp,&it,&bt)) != NULL) { MdcPrntWarn(msg); MdcFree(itmp); MdcFree(ctmp); MdcFree(rtmp); return(MDC_NO); } ctmp[0] = it - 1; rtmp[0] = it - 1; if ((ctmp[0] == 0) || (rtmp[0] == 0)) { MdcPrntWarn("No valid pixel specified!"); MdcFree(itmp); MdcFree(ctmp); MdcFree(rtmp); return(MDC_NO); } *img = itmp; *col = ctmp; *row = rtmp; return(MDC_YES); } void MdcGetPixels(FILEINFO *fi, Uint32 img[], Uint32 col[], Uint32 row[]) { Uint32 it, pt, ct, rt, number, itotal; IMG_DATA *id; MdcPrintLine('+',MDC_FULL_LENGTH); MdcPrntScrn("\ : image: : slope : : intercept : pixel : value\n"); MdcPrintLine('+',MDC_FULL_LENGTH); if (img[1] == 0) { /* special: just all images selected */ itotal = fi->number; }else{ /* normal : get selected images from first index */ itotal = img[0]; } for (it=1; it <= itotal; it++) { if (img[1] == 0) { /* special: calc next image number */ number = it-1; }else{ /* normal : get image number from next index */ number = img[it] - 1; } id = &fi->image[number]; for (pt=1; pt <= row[0]; pt++) { if (row[pt] == 0) { /* all pixels of the row */ for (rt=0; rt < id->height; rt++) { if (col[pt] == 0) { /* all pixels of the column */ for (ct=0; ct < id->width; ct++) MdcPrintPixel(id,number,ct,rt); }else{ MdcPrintPixel(id,number,col[pt]-1,rt); } } }else{ if (col[pt] == 0) { /* all pixels of the column */ for (ct=0; ct < id->width; ct++) MdcPrintPixel(id,number,ct,row[pt]-1); }else{ MdcPrintPixel(id,number,col[pt]-1,row[pt]-1); } } } } MdcPrintLine('+',MDC_FULL_LENGTH); } double MdcGetOnePixel(IMG_DATA *id, Uint32 i, Uint32 x, Uint32 y) { double value=0.0; Uint32 offset; if ((x < id->width) && (y < id->height)) { offset = (y * id->width) + x; switch (id->type) { case BIT8_U: { Uint8 *pix = (Uint8 *)id->buf; value = (double)pix[offset]; } break; case BIT8_S: { Int8 *pix = (Int8 *)id->buf; value = (double)pix[offset]; } break; case BIT16_U: { Uint16 *pix = (Uint16 *)id->buf; value = (double)pix[offset]; } break; case BIT16_S: { Int16 *pix = (Int16 *)id->buf; value = (double)pix[offset]; } break; case BIT32_U: { Uint32 *pix = (Uint32 *)id->buf; value = (double)pix[offset]; } break; case BIT32_S: { Int32 *pix = (Int32 *)id->buf; value = (double)pix[offset]; } break; #ifdef HAVE_8BYTE_INT case BIT64_U: { Uint64 *pix = (Uint64 *)id->buf; value = (double)pix[offset]; } break; case BIT64_S: { Int64 *pix = (Int64 *)id->buf; value = (double)pix[offset]; } break; #endif case FLT32: { float *pix = (float *)id->buf; value = (double)pix[offset]; } break; case FLT64: { double *pix = (double *)id->buf; value = pix[offset]; } break; } }else{ value = 0.0; } return(value); } void MdcPrintPixel(IMG_DATA *id, Uint32 i, Uint32 x, Uint32 y) { double ppv; /* plain pixel value */ if ((x < id->width) && (y < id->height)) { ppv = MdcGetOnePixel(id,i,x,y); /* Plain Pixel Value */ MdcPrntScrn("#: %4u :",i+1); MdcPrntScrn("S: %+e :",id->rescale_slope); MdcPrntScrn("I: %+e :",id->rescale_intercept); MdcPrntScrn("P(%3u,%3u): %+e\n",x+1,y+1,ppv); }else{ MdcPrntWarn("Invalid pixel (%u,%u) for image #%u [%ux%u]" ,x+1,y+1,i+1,id->width,id->height); } } xmedcon-0.14.1/source/xoptions.h0000644000175000017510000000604512636253502013521 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xoptions.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xoptions.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xoptions.h,v 1.22 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XOPTIONS_H__ #define __XOPTIONS_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcOptionsMedconCallbackApply(GtkWidget *widget, gpointer data); void XMdcOptionsMedconAddTabPixels(GtkWidget *notebook); void XMdcOptionsMedconAddTabFiles(GtkWidget *notebook); void XMdcOptionsMedconAddTabSlices(GtkWidget *notebook); void XMdcOptionsMedconAddTabFormats(GtkWidget *notebook); void XMdcOptionsMedconAddTabMosaic(GtkWidget *notebook); void XMdcOptionsMedconSel(GtkWidget *widget, gpointer data); void XMdcOptionsRenderSel(GtkWidget *widget, gpointer data); void XMdcOptionsResizeSel(GtkWidget *widget, gpointer data); void XMdcOptionsColorMapSel(GtkWidget *widget, gpointer data); void XMdcOptionsLabelSel(GtkWidget *widget, gpointer data); void XMdcOptionsPagesSel(GtkWidget *widget, gpointer data); void XMdcOptionsMapPlaceSel(GtkWidget *widget, gpointer data); void XMdcSensitiveBitsUsed12(GtkWidget *widget, gpointer data); void XMdcUnsensitiveBitsUsed12(GtkWidget *widget, gpointer data); void XMdcToggleSensitivityMosaic(GtkWidget *widget, gpointer data); void XMdcToggleSensitivityForced(GtkWidget *widget, gpointer data); void XMdcInitMosaicFrame(void); void XMdcToggleSensitivityCine(GtkWidget *widget, gpointer data); void XMdcInitCineButtons(void); void XMdcToggleSensitivityColor(GtkWidget *widget, gpointer data); void XMdcInitColorButtons(void); #endif xmedcon-0.14.1/source/m-defs.h0000644000175000017510000003334212636253502013011 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-defs.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : project variables, structs & datatypes * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-defs.h,v 1.62 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_DEFS_H__ #define __M_DEFS_H__ #include "m-config.h" /************************** COMPILATION CONDITIONALS **************************/ #ifdef _WIN32 /* dos/mswindows */ #define MDC_PATH_DELIM_STR "\\" #define MDC_PATH_DELIM_CHR '\\' #define MDC_NEWLINE "\r\n" #else /* unix/linux */ #define MDC_PATH_DELIM_STR "/" #define MDC_PATH_DELIM_CHR '/' #define MDC_NEWLINE "\n" #endif /* For output formats without slice_spacing key, it is prefered * to use slice_spacing as the slice_width parameter, and thus * virtually "eliminating" any gaps/overlaps between those sices. * If not wanted, comment out following define line. */ #define MDC_USE_SLICE_SPACING 1 /******************* PORTABILITY TYPES *******************/ /* 16 bit type */ #if (MDC_SIZEOF_INT == 2) # define INT_2BYTE #elif (MDC_SIZEOF_SHORT == 2) # define SHORT_2BYTE #else # error "What!? No 16-bit integer type available!" #endif /* 32 bit type */ #if (MDC_SIZEOF_INT == 4) # define INT_4BYTE #elif (MDC_SIZEOF_LONG == 4) # define LONG_4BYTE #else # error "What!? No 32-bit integer type available!" #endif /* 64 bit type */ #ifdef MDC_SIZEOF_LONG_LONG #if (MDC_SIZEOF_LONG_LONG == 8) # define LONG_LONG_8BYTE #endif #else #if (MDC_SIZEOF_LONG == 8) # define LONG_8BYTE #endif #endif /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_ONE 1 #define MDC_ZERO 0 #define MDC_FALSE (0) #define MDC_TRUE (!MDC_FALSE) #define MDC_UNKNOWN MDC_ZERO #define MDC_LITTLE_ENDIAN MDC_ONE #define MDC_BIG_ENDIAN MDC_ZERO #define MDC_1KB_OFFSET 1024 #define MDC_2KB_OFFSET 2048 #define MDC_INPUT_NORM_STYLE 1 #define MDC_INPUT_ECAT_STYLE 2 #define MDC_MAX_PATH 256 #define MDC_MAX_LIST 256 #define MDC_YES MDC_ONE #define MDC_NO MDC_ZERO #define MDC_ARG_FILE 0 #define MDC_ARG_CONV 1 #define MDC_ARG_EXTRACT 2 #define MDC_FILES 0 #define MDC_CONVS 1 /* precision */ #define MDC_FLT_EPSILON 1.1920928955078125e-07 /* passess */ #define MDC_PASS0 0 #define MDC_PASS1 1 #define MDC_PASS2 2 /* output message levels */ #define MDC_LEVEL_MESG 1 #define MDC_LEVEL_WARN 2 #define MDC_LEVEL_ERR 3 #define MDC_LEVEL_ALL 4 /* supported color maps */ #define MDC_MAP_PRESENT MDC_ZERO /* 256 RGB colormap */ #define MDC_MAP_GRAY 1 /* grayscale colormap */ #define MDC_MAP_INVERTED 2 /* inverted colormap */ #define MDC_MAP_RAINBOW 3 /* rainbow colormap */ #define MDC_MAP_COMBINED 4 /* combined colormap */ #define MDC_MAP_HOTMETAL 5 /* hotmetal colormap */ #define MDC_MAP_LOADED 6 /* loaded colormap */ /* supported color modes */ #define MDC_COLOR_INDEXED 0 /* 256 indexed colors */ #define MDC_COLOR_RGB 1 /* 24bit true colors */ /* supported formats */ #define MDC_FRMT_BAD MDC_ZERO #define MDC_FRMT_NONE MDC_FRMT_BAD #define MDC_FRMT_RAW 1 #define MDC_FRMT_ASCII 2 #define MDC_FRMT_GIF 3 #define MDC_FRMT_ACR 4 #define MDC_FRMT_INW 5 #define MDC_FRMT_ECAT6 6 #define MDC_FRMT_ECAT7 7 #define MDC_FRMT_INTF 8 #define MDC_FRMT_ANLZ 9 #define MDC_FRMT_DICM 10 #define MDC_FRMT_PNG 11 #define MDC_FRMT_CONC 12 #define MDC_FRMT_NIFTI 13 #define MDC_MAX_FRMTS 14 /* total+1 conversion formats supported */ /* acquisition types */ /* InterFile and DICOM */ #define MDC_ACQUISITION_UNKNOWN MDC_ZERO /* unknown = static */ #define MDC_ACQUISITION_STATIC 1 /* static, simple default */ #define MDC_ACQUISITION_DYNAMIC 2 /* dynamic */ #define MDC_ACQUISITION_TOMO 3 /* tomographic */ #define MDC_ACQUISITION_GATED 4 /* gated */ #define MDC_ACQUISITION_GSPECT 5 /* gated spect */ #define MDC_MAX_ACQUISITIONS 6 /* total acquisitions + 1 */ /* ECAT sort order */ #define MDC_ANATOMICAL 1 #define MDC_BYFRAME 2 /* pat_orient */ #define MDC_LEFT 1 #define MDC_RIGHT 2 #define MDC_ANTERIOR 3 #define MDC_POSTERIOR 4 #define MDC_HEAD 5 #define MDC_FEET 6 /* patient rotation */ #define MDC_SUPINE 1 /* on the back */ #define MDC_PRONE 2 /* on the face */ #define MDC_DECUBITUS_RIGHT 3 /* on the right side */ #define MDC_DECUBITUS_LEFT 4 /* on the left side */ /* patient orientation */ #define MDC_HEADFIRST 1 /* head first in scanner */ #define MDC_FEETFIRST 2 /* feet first in scanner */ /* slice orientation */ /* consider a patient on */ /* his back on the table, */ /* then the direction is: */ #define MDC_TRANSAXIAL 1 /* // device ;_|_ ground */ #define MDC_SAGITTAL 2 /* _|_ device ;_|_ ground */ #define MDC_CORONAL 3 /* _|_ device ; // ground */ /* patient/slice combined */ #define MDC_SUPINE_HEADFIRST_TRANSAXIAL 1 #define MDC_SUPINE_HEADFIRST_SAGITTAL 2 #define MDC_SUPINE_HEADFIRST_CORONAL 3 #define MDC_SUPINE_FEETFIRST_TRANSAXIAL 4 #define MDC_SUPINE_FEETFIRST_SAGITTAL 5 #define MDC_SUPINE_FEETFIRST_CORONAL 6 #define MDC_PRONE_HEADFIRST_TRANSAXIAL 7 #define MDC_PRONE_HEADFIRST_SAGITTAL 8 #define MDC_PRONE_HEADFIRST_CORONAL 9 #define MDC_PRONE_FEETFIRST_TRANSAXIAL 10 #define MDC_PRONE_FEETFIRST_SAGITTAL 11 #define MDC_PRONE_FEETFIRST_CORONAL 12 #define MDC_DECUBITUS_RIGHT_HEADFIRST_TRANSAXIAL 13 #define MDC_DECUBITUS_RIGHT_HEADFIRST_SAGITTAL 14 #define MDC_DECUBITUS_RIGHT_HEADFIRST_CORONAL 15 #define MDC_DECUBITUS_RIGHT_FEETFIRST_TRANSAXIAL 16 #define MDC_DECUBITUS_RIGHT_FEETFIRST_SAGITTAL 17 #define MDC_DECUBITUS_RIGHT_FEETFIRST_CORONAL 18 #define MDC_DECUBITUS_LEFT_HEADFIRST_TRANSAXIAL 19 #define MDC_DECUBITUS_LEFT_HEADFIRST_SAGITTAL 20 #define MDC_DECUBITUS_LEFT_HEADFIRST_CORONAL 21 #define MDC_DECUBITUS_LEFT_FEETFIRST_TRANSAXIAL 22 #define MDC_DECUBITUS_LEFT_FEETFIRST_SAGITTAL 23 #define MDC_DECUBITUS_LEFT_FEETFIRST_CORONAL 24 #define MDC_MAX_ORIENT 25 /* total orientations + 1 */ /* detector rotation */ #define MDC_ROTATION_CW 1 /* clockwise */ #define MDC_ROTATION_CC 2 /* counter-clocwise */ /* detector motion */ #define MDC_MOTION_STEP 1 /* stepped */ #define MDC_MOTION_CONT 2 /* continuous */ #define MDC_MOTION_DRNG 3 /* during step */ /* gated spect nesting outer level */ #define MDC_GSPECT_NESTING_SPECT 1 #define MDC_GSPECT_NESTING_GATED 2 /* gated heart rate */ #define MDC_HEART_RATE_ACQUIRED 1 #define MDC_HEART_RATE_OBSERVED 2 /* image padding */ #define MDC_PAD_AROUND 1 #define MDC_PAD_TOP_LEFT 2 #define MDC_PAD_BOTTOM_RIGHT 3 /* some maximum limits */ #define MDC_MAX_FILES 10000 /* maximum files handled */ /* 3-char prefix: 34696 uniques */ #define MDC_MAXSTR 35 /* max length of strings */ #define MDC_BUF_ITMS 10 /* realloc per BUF_ITMS items */ #define MDC_CHAR_BUF 100 /* max chars for string buffer */ #define MDC_MAX_PREFIX 15 /* max chars for prefix */ /* pixel types */ #define BIT1 1 /* 1-bit */ #define BIT8_S 2 /* 8-bit signed */ #define BIT8_U 3 /* 8-bit unsigned */ #define BIT16_S 4 /* 16-bit signed */ #define BIT16_U 5 /* 16-bit unsigned */ #define BIT32_S 6 /* 32-bit signed */ #define BIT32_U 7 /* 32-bit unsigned */ #define BIT64_S 8 /* 64-bit signed */ #define BIT64_U 9 /* 64-bit unsigned */ #define FLT32 10 /* 32-bit float */ #define FLT64 11 /* 64-bit double */ #define ASCII 12 /* ascii */ #define VAXFL32 13 /* 32-bit vaxfloat */ #define COLRGB 20 /* RGB triplets */ /* define maximum integer values */ #define MDC_MAX_BIT8_U 255 #define MDC_MAX_BIT16_S ((1<<16)/2) - 1 /* file compression type */ #define MDC_COMPRESS 1 #define MDC_GZIP 2 /* 8 bit type */ typedef signed char Int8; typedef unsigned char Uint8; /* 16 bit type */ #ifdef SHORT_2BYTE typedef signed short Int16; typedef unsigned short Uint16; #elif INT_2BYTE typedef signed int Int16; typedef unsigned int Uint16; #endif /* 32 bit type */ #ifdef INT_4BYTE typedef signed int Int32; typedef unsigned int Uint32; #elif LONG_4BYTE typedef signed long Int32; typedef unsigned long Uint32; #endif /* 64 bit type */ #ifdef LONG_8BYTE #define HAVE_8BYTE_INT typedef signed long Int64; typedef unsigned long Uint64; #else #ifdef LONG_LONG_8BYTE #define HAVE_8BYTE_INT typedef signed long long Int64; typedef unsigned long long Uint64; #endif #endif /* define different modalities */ typedef enum { M_AS=('A'<<8)|'S', /* Angioscopy */ M_AU=('A'<<8)|'U', /* Audio */ M_BI=('B'<<8)|'I', /* Biomagnetic Imaging */ M_CD=('C'<<8)|'D', /* Color Flow Doppler */ M_CF=('C'<<8)|'F', /* Cinefluorography */ M_CP=('C'<<8)|'P', /* Culposcopy */ M_CR=('C'<<8)|'R', /* Computed Radiography */ M_CS=('C'<<8)|'S', /* Cystoscopy */ M_CT=('C'<<8)|'T', /* Computed Tomography */ M_DD=('D'<<8)|'D', /* Duplex Doppler */ M_DF=('D'<<8)|'F', /* Digital Fluoroscopy */ M_DG=('D'<<8)|'G', /* Diaphanography */ M_DM=('D'<<8)|'M', /* Digital Microscopy */ M_DS=('D'<<8)|'S', /* Digital Substraction Angiography */ M_DX=('D'<<8)|'X', /* Digital Radiography */ M_EC=('E'<<8)|'C', /* Echocardiography */ M_ES=('E'<<8)|'S', /* Endoscopy */ M_FA=('F'<<8)|'A', /* Fluorescein Angiography */ M_FS=('F'<<8)|'S', /* Fundoscopy */ M_GM=('G'<<8)|'M', /* General Microscopy */ M_HD=('H'<<8)|'D', /* Hemodynamic Waveform */ M_IO=('I'<<8)|'O', /* Intra-Oral Radiography */ M_HC=('H'<<8)|'C', /* Hardcopy */ M_LP=('L'<<8)|'P', /* Laparoscopy */ M_MA=('M'<<8)|'A', /* Magnetic Resonance Angiography */ M_MG=('M'<<8)|'G', /* Mammography */ M_MR=('M'<<8)|'R', /* Magnetic Resonance */ M_MS=('M'<<8)|'S', /* Magnetic Resonance Spectroscopy */ M_NM=('N'<<8)|'M', /* Nuclear Medicine */ M_OT=('O'<<8)|'T', /* Other */ M_PT=('P'<<8)|'T', /* Positron Emission Tomography */ M_PX=('P'<<8)|'X', /* Panoramic X-Ray */ M_RF=('R'<<8)|'F', /* Radio Fluoroscopy */ M_RG=('R'<<8)|'G', /* Radiographic Imaging */ M_RT=('R'<<8)|'T', /* Radiotherapy */ M_SM=('S'<<8)|'M', /* Slide Microscopy */ M_SR=('S'<<8)|'R', /* SR Document */ M_ST=('S'<<8)|'T', /* Single-Photon Emission Computed Tomography */ M_TG=('T'<<8)|'G', /* Thermography */ M_US=('U'<<8)|'S', /* Ultrasound */ M_VF=('V'<<8)|'F', /* Videofluorography */ M_XA=('X'<<8)|'A', /* X-Ray Angiography */ M_XC=('X'<<8)|'C' /* External-Camera Photography */ } MDC_MODALITY; #endif /* __M_DEFS_H__ */ xmedcon-0.14.1/source/xfiles.c0000644000175000017510000000641712636253502013126 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xfiles.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : file routines * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcDisplayFile() - Read file and display images * * XMdcRereadFile() - Reread the file * * XMdcCloseFile() - Close file (free memory) * * XMdcNoFileOpened() - Give message if no file open * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xfiles.c,v 1.23 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "xmedcon.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcDisplayFile(const char *fname) { XMdcViewerHide(); XMdcMainWidgetsInsensitive(); XMdcFileReset(); if (XMdcReadFile(fname) == MDC_OK) { XMDC_FILE_OPEN = MDC_YES; XMdcViewerEnableAutoShrink(); XMdcDisplayImages(); } XMdcProgressBar(MDC_PROGRESS_END,0.,NULL); XMdcMainWidgetsResensitive(); } void XMdcRereadFile(GtkWidget *widget, gpointer data) { MdcMergePath(my.fi->ipath,my.fi->idir,my.fi->ifname); strcpy(xmdcstr,my.fi->ipath); MdcAddCompressionExt(my.fi->compression, xmdcstr); XMdcDisplayFile(xmdcstr); } void XMdcCloseFile(GtkWidget *widget, gpointer data) { XMdcViewerHide(); XMdcFileReset(); } int XMdcNoFileOpened(void) { if (XMDC_FILE_OPEN == MDC_NO) { XMdcDisplayWarn("No file opened"); return(MDC_YES); } return(MDC_NO); } xmedcon-0.14.1/source/xpages.h0000644000175000017510000000415512636253502013125 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xpages.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xpages.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xpages.h,v 1.19 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XPAGES_H__ #define __XPAGES_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcPagesSelected(GtkWidget *widget, Uint32 *pagenr); gboolean XMdcPagesGoTo(GtkWidget *spinner, gpointer data); GtkWidget *XMdcPagesCreateMenu(void); void XMdcPagesNext(void); void XMdcPagesPrev(void); void XMdcPagesSelCallbackApply(GtkWidget *widget, gpointer data); void XMdcPagesSel(void); Uint32 XMdcPagesGetNrImages(void); #endif xmedcon-0.14.1/source/m-algori.c0000644000175000017510000014203612636253501013340 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-algori.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : endian/image algorithms * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcRealloc() - if (NULL) malloc else realloc * * MdcCeilPwr2() - Find least power of two >= * * MdcRotateAngle() - Rotate angle in degrees * * MdcDoSwap() - Test to swap * * MdcHostBig() - Test if host is bigendian * * MdcSwapBytes() - Swap the bytes * * MdcForceSwap() - Forced bytes swapping * * MdcIEEEfl_to_VAXfl() - Change hostfloat to VAX float * * MdcVAXfl_to_IEEEfl() - Change VAX float to hostfloat * * MdcType2Bytes() - Pixel data type in bytes * * MdcType2Bits() - Pixel data type in bits * * MdcTypeIntMax() - Give maximum of integer type * * MdcSingleImageDuration()- Get duration of a single image * * MdcImagesPixelFiddle() - Process all pixels & images * * MdcGetDoublePixel() - Get pixel from memory buffer * * MdcPutDoublePixel() - Put pixel to memory buffer * * MdcDoSimpleCast() - Test cast sufficient to rescale* * MdcGetResizedImage() - Make image of same size * * MdcGetDisplayImage() - Get image to display * * MdcMakeBIT8_U() - Make an Uint8 image * * MdcGetImgBIT8_U() - Get an Uint8 image * * MdcMakeBIT16_S() - Make an Int16 image * * MdcGetImgBIT16_S() - Get an Int16 image * * MdcMakeBIT32_S() - Make an Int32 image * * MdcGetImgBIT32_S() - Get an Int32 image * * MdcMakeFLT32() - Make a float image * * MdcGetImgFLT32() - Get a float image * * MdcMakeImgSwapped() - Make an endian swapped image * * MdcGetImgSwapped() - Get an endian swapped image * * MdcUnpackBIT12() - Unpack 12 bit into Uint16 * * MdcHashDJB2() - Get hash using djb2 method * * MdcHashSDBM() - Get hash using sdbm method * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-algori.c,v 1.92 2015/12/22 13:59:29 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #define __USE_ISOC99 1 #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "medcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ #define maxmin(x, max, min) { maxmin_t=(x); \ if (maxmin_t > max) max=maxmin_t; \ if (maxmin_t < min) min=maxmin_t; \ } static Uint8 MDC_ALLOW_CAST = MDC_YES; /**************************************************************************** F U N C T I O N S ****************************************************************************/ void *MdcRealloc(void *p, Uint32 bytes) { void *ptmp; if (p == NULL) { ptmp = malloc(bytes); }else{ ptmp = realloc(p, bytes); } return(ptmp); } /* Find least power of 2 greater than or equal to x */ /* Hacker's Delight - Henry S. Warren, Jr. */ /* ISBN 0-201-91465-4 / pg. 48 */ Uint32 MdcCeilPwr2(Uint32 x) { x = x - 1; x = x | (x >> 1); x = x | (x >> 2); x = x | (x >> 4); x = x | (x >> 8); x = x | (x >> 16); return(x + 1); } float MdcRotateAngle(float angle, float rotate) { float new_angle; new_angle = (float)fmod((double)rotate - (double)angle + 360., 360.); return(new_angle); } /* the machine-endian soup */ /* READING: host infile swap ----------------------------------- big0 big0 0 big0 little1 1 little1 big0 1 little1 little1 0 ---------------------------------- READING: host XOR file = swap WRITING: host outfile swap ---------------------------------- big0 big0 0 little1 big0 1 big0 little1 1 little1 little1 0 ---------------------------------- WRITING host XOR file = swap */ int MdcDoSwap(void) { return(MDC_HOST_ENDIAN^MDC_FILE_ENDIAN); } int MdcHostBig(void) { if (MDC_HOST_ENDIAN == MDC_BIG_ENDIAN) return 1; return 0; } void MdcSwapBytes(Uint8 *ptr, int bytes) { int i, j; if ( MdcDoSwap() ) for (i=0,j=bytes-1;i < (bytes/2); i++, j--) { ptr[i]^=ptr[j]; ptr[j]^=ptr[i]; ptr[i]^=ptr[j]; } } void MdcForceSwap(Uint8 *ptr, int bytes) { int i, j; for (i=0,j=bytes-1;i < (bytes/2); i++, j--) { ptr[i]^=ptr[j]; ptr[j]^=ptr[i]; ptr[i]^=ptr[j]; } } void MdcIEEEfl_to_VAXfl(float *f) { Uint16 exp; union { Uint16 t[2]; float t4; } test; test.t4 = *f; if (test.t4 != 0.0) { if (!MdcHostBig()) { /* swap words */ Uint16 temp; memcpy((void *)&temp,(void *)&test.t[0],2); memcpy((void *)&test.t[0],(void *)&test.t[1],2); memcpy((void *)&test.t[1],(void *)&temp,2); } exp = ((test.t[0] & 0x7f00) + 0x0100) & 0x7f00; test.t[0] = (test.t[0] & 0x80ff) + exp; MdcSwapBytes((Uint8 *)&test.t[0],2); MdcSwapBytes((Uint8 *)&test.t[1],2); } memcpy((void *)f,(void *)&test.t4,4); } void MdcVAXfl_to_IEEEfl(float *f) { Uint16 t1, t2; union { Uint16 n[2]; float n4; } number; union { Uint32 t3; float t4; } test; number.n4 = *f; if (MdcHostBig()) { Uint16 temp; temp = number.n[0]; number.n[0]=number.n[1]; number.n[1]=temp; } MdcSwapBytes((Uint8 *)&number.n4,4); if ((number.n[0] != 0) || (number.n[1] != 0) ) { t1 = number.n[0] & 0x80ff; t2 = (((number.n[0])&0x7f00)+0xff00)&0x7f00; test.t3 = (t1+t2)<<16; test.t3 = test.t3+number.n[1]; number.n4 = test.t4; } memcpy((void *)f,(void *)&number.n4,4); } int MdcFixFloat(float *ref) { float value = *ref; int fixed = 0; #ifdef HAVE_ISNAN if (isnan(value)) { value = 0.; fixed = 1; } #endif #ifdef HAVE_ISINF if (isinf(value)) { value = 0.; fixed = 1; } #endif *ref = value; return(fixed); } int MdcFixDouble(double *ref) { double value = *ref; int fixed = 0; #ifdef HAVE_ISNAN if (isnan(value)) { value = 0.; fixed = 1; } #endif #ifdef HAVE_ISINF if (isinf(value)) { value = 0.; fixed = 1; } #endif *ref = value; return(fixed); } int MdcType2Bytes(int type) { int bytes = 0; switch (type) { case BIT1 : case BIT8_S: case BIT8_U: bytes = 1; break; case BIT16_S: case BIT16_U: bytes = 2; break; case COLRGB : bytes = 3; break; case BIT32_S: case BIT32_U: case FLT32 : case VAXFL32: bytes = 4; break; case ASCII : /* read as double */ #ifdef HAVE_8BYTE_INT case BIT64_S: case BIT64_U: #endif case FLT64 : bytes = 8; break; } return(bytes); } int MdcType2Bits(int type) { int bits = 0; switch (type) { case BIT1 : bits = 1; break; case BIT8_S: case BIT8_U: bits = 8; break; case BIT16_S: case BIT16_U: bits = 16; break; case COLRGB : bits = 24; break; case BIT32_S: case BIT32_U: case FLT32 : case VAXFL32: bits = 32; break; case ASCII : /* read as double */ #ifdef HAVE_8BYTE_INT case BIT64_S: case BIT64_U: #endif case FLT64 : bits = 64; break; } return(bits); } double MdcTypeIntMax(int type) { switch (type) { case BIT8_S : return(127.); case BIT8_U : return(255.); case BIT16_S: return(32767.); case BIT16_U: return(65535.); case BIT32_S: return(2147483647.); case BIT32_U: return(4294967295.); #ifdef HAVE_8BYTE_INT case BIT64_S: return(9223372036854775807.); case BIT64_U: return(18446744073709551615.); #endif } return(0.0); } float MdcSingleImageDuration(FILEINFO *fi, Uint32 frame) { DYNAMIC_DATA *dd; float duration, slices; if ((fi->dynnr == 0) || (fi->dyndata == NULL)) return(0.); if (frame >= fi->dynnr) return(0.); dd = &fi->dyndata[frame]; if (dd->nr_of_slices == 0) return 0.; slices = (float)dd->nr_of_slices; /* planar -> each slice separate: Tslice = Tframe/Nslices */ /* tomo -> all slices at once : Tslice = Tframe */ duration = dd->time_frame_duration; /* no frame delay */ duration -= ((slices - 1) * dd->delay_slices); /* no slice delays */ if (fi->planar) duration /= slices; /* time per slice */ return(duration); /* [ms] */ } /* pixel by pixel processes: yes, THE all in one routine - swap bytes - make positive - get global & image variables check some parameters WARNING: double pixel types may get corrupted quantification values because our quantification is stripped down to a float!! */ char *MdcImagesPixelFiddle(FILEINFO *fi) { DYNAMIC_DATA *dd; IMG_DATA *id, *idprev; STATIC_DATA *sd; Uint32 f, i, j, n, s, t; float start, duration; double fmin=0., fmax=0., qfmin=0., qfmax=0.; char *msg; int FixWarn=0; /* initial checks for FILEINFO integrity */ if (fi->number == 0) return("Internal Error ## Improper fi->number value"); /* make sure fi->dim[] are 1-based */ for (i=0; idim[i] <= 0) fi->dim[i] = 1; /* check number of slices */ for (t=1, i=3; i <= fi->dim[0]; i++) { MdcDebugPrint("dim[] TEST : fi->dim[%d] = %u",i,fi->dim[i]); t *= fi->dim[i]; } if (fi->number != t) { /* return("Internal Error ## Improper fi->dim values"); */ if (((t / fi->dim[3]) > 1) && (fi->planar == MDC_NO)) { /* complain when non-planar multi-dimensional array was found */ MdcPrntWarn("Internal Error ## Improper fi->dim values\n" \ "\t\t - falling back to one dimensional array"); } fi->dim[0] = 3; fi->dim[3] = fi->number; for (i=4; idim[i] = 1; } /* sanity check ACQ_DATA stuff */ if (fi->acqdata == NULL) fi->acqnr = 0; /* sanity check GATED_DATA structs */ if (fi->gdata == NULL) fi->gatednr = 0; /* sanity check DYN_DATA structs + updates */ if (fi->dyndata == NULL) fi->dynnr = 0; if (fi->dynnr > 0) { /* check number of slices */ for (i=0, t=0; idynnr; i++) { t += fi->dyndata[i].nr_of_slices; } if (t != fi->number) { /* reset to one frame */ if (!MdcGetStructDD(fi,1)) return("Internal Error ## Failure to realloc DYNAMIC_DATA struct"); fi->dyndata[0].nr_of_slices = fi->number; MdcPrntWarn("Internal Warning ## Bad DYNAMIC_DATA values fixed"); } /* go through all frames */ for (f=0, t=0; fdynnr; f++) { dd = &fi->dyndata[f]; /* update frame_start values */ if ((f > 0) && (dd->time_frame_start == 0.)) { dd->time_frame_start = fi->dyndata[f-1].time_frame_start + fi->dyndata[f-1].time_frame_delay + fi->dyndata[f-1].time_frame_duration; } /* set initial slice values */ start = dd->time_frame_start + dd->time_frame_delay; duration = MdcSingleImageDuration(fi,f); /* update frame & start for each slice */ for (s=0; snr_of_slices; s++, t++) { id = &fi->image[t]; id->frame_number = f+1; /* must be one based */ id->slice_start = start; if (fi->planar == MDC_YES) start += (duration + dd->delay_slices); } } } /* fill in orientation information */ if (strcmp(fi->pat_pos,"Unknown") == 0) strcpy(fi->pat_pos,MdcGetStrPatPos(fi->pat_slice_orient)); if (strcmp(fi->pat_orient,"Unknown") == 0) strcpy(fi->pat_orient,MdcGetStrPatOrient(fi->pat_slice_orient)); if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Checking images:"); /* sanity check IMG_DATA stuff */ if (fi->image == NULL) return("Internal Error ## Missing IMG_DATA structs"); for (j=0; jnumber; j++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); id = &fi->image[j]; /* check dimension/pixeltype values */ if ( id->width == 0 || id->height == 0 || id->bits == 0 || id->type == 0 || id->buf == NULL) { return("Internal Error ## Improper IMG_DATA values"); } if (id->pixel_xsize <= 0.0 ) id->pixel_xsize = 1.0; if (id->pixel_ysize <= 0.0 ) id->pixel_ysize = 1.0; if (id->slice_width <= 0.0 ) id->slice_width = 1.0; if (id->slice_spacing <= 0.0 ) id->slice_spacing = id->slice_width; if (id->ct_zoom_fctr <= 0.0 ) id->ct_zoom_fctr= 1.0; id->bits = MdcType2Bits(id->type); if (id->type != fi->image[0].type) fi->diff_type = MDC_YES; if (id->quant_scale != fi->image[0].quant_scale) fi->diff_scale = MDC_YES; if (id->calibr_fctr != fi->image[0].calibr_fctr) fi->diff_scale = MDC_YES; if (id->intercept != fi->image[0].intercept ) fi->diff_scale = MDC_YES; if (j == 0) { fi->mwidth = id->width; fi->mheight = id->height; }else{ if (id->width != fi->mwidth) { fi->diff_size = MDC_YES; if (id->width > fi->mwidth ) fi->mwidth = id->width; } if (id->height != fi->mheight) { fi->diff_size = MDC_YES; if (id->height > fi->mheight ) fi->mheight = id->height; } } } /* set some global values */ fi->dim[1] = (Int16) fi->mwidth; fi->dim[2] = (Int16) fi->mheight; fi->bits = fi->image[0].bits; fi->type = fi->image[0].type; /* check for really ugly things */ if (fi->dim[0] <= 2 ) { sprintf(mdcbufr,"Internal Error ## fi->dim[0]=%d",fi->dim[0]); return(mdcbufr); }else{ for (t=1; t<=fi->dim[0]; t++) { if (fi->dim[t] <= 0 ) { sprintf(mdcbufr,"Internal Error ## fi->dim[%d]=%d",t,fi->dim[t]); return(mdcbufr); } } } /* fixable things */ if (fi->pixdim[0] == 3.0 || fi->pixdim[0] == 4.0 || fi->pixdim[0] == 5.0 || fi->pixdim[0] == 6.0 || fi->pixdim[0] == 7.0 ) { for (t=1; t<=(Int32)fi->pixdim[0]; t++) { if (fi->pixdim[t] <= 0.0 ) fi->pixdim[t] = 1.; } }else{ fi->pixdim[0] = 3.; fi->pixdim[1] = 1.; fi->pixdim[2] = 1.; fi->pixdim[3] = 1.; } /* color */ if (fi->map == MDC_MAP_PRESENT) { msg=MdcHandleColor(fi); if (msg != NULL) return(msg); } if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Processing images:"); /* max/min, endian, quantitation */ for (j=0; jnumber; j++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); id = &fi->image[j]; n = id->width * id->height; sd = id->sdata; if (MDC_FORCE_RESCALE) { id->quant_scale = mdc_si_slope; id->calibr_fctr = 1.; id->intercept = mdc_si_intercept; } if (MDC_QUANTIFY) { id->rescale_slope = id->quant_scale; id->rescale_intercept = id->intercept; }else if (MDC_CALIBRATE) { id->rescale_slope = id->quant_scale * id->calibr_fctr; id->rescale_intercept = id->intercept; }else{ id->rescale_slope = 1.; id->rescale_intercept = 0.; } if (fi->contrast_remapped == MDC_YES) { /* any rescale already done */ id->quant_scale = 1.; id->calibr_fctr = 1.; id->intercept = 0.; id->rescale_slope = 1.; id->rescale_intercept = 0.; } switch (id->type) { case BIT8_U: { Uint8 *pix = (Uint8 *) id->buf, pix0; Uint8 max, min, maxmin_t; /* init first pixel */ memcpy((void *)&pix0,(void *)pix,1); /* init max,min values */ min = pix0; max = pix0; if (j == 0) { fi->glmin = (double) pix0; fi->glmax = (double) pix0; } /* go through all pixels */ for (i=0; itotal_counts += (float)*pix; } id->max = (double) max; id->min = (double) min; } break; case BIT8_S: { Int8 *pix = (Int8 *) id->buf, pix0; Int8 max, min, maxmin_t; /* init first pixel */ memcpy((void *)&pix0,(void *)pix,1); if (!MDC_NEGATIVE && (pix0 < 0)) pix0 = 0; /* init max,min values */ min = pix0; max = pix0; if (j == 0) { fi->glmin = (double) pix0; fi->glmax = (double) pix0; } /* go through all pixels */ for (i=0; itotal_counts += (float)*pix; } id->max = (double) max; id->min = (double) min; } break; case BIT16_U: { Uint16 *pix = (Uint16 *) id->buf, pix0; Uint16 max, min, maxmin_t; /* init first pixel */ memcpy((void *)&pix0,(void *)pix,2); MdcSwapBytes((Uint8 *)&pix0, 2); /* init max,min values */ min = pix0; max = pix0; if (j == 0) { fi->glmin = (double) pix0; fi->glmax = (double) pix0; } /* go through all pixels */ for (i=0; itotal_counts += (float)*pix; } id->max = (double) max; id->min = (double) min; } break; case BIT16_S: { Int16 *pix = (Int16 *) id->buf, pix0; Int16 max, min, maxmin_t; /* init first pixel */ memcpy((void *)&pix0,(void *)pix,2); MdcSwapBytes((Uint8 *)&pix0, 2); if (!MDC_NEGATIVE && (pix0 < 0)) pix0 = 0; /* init max,min values */ min = pix0; max = pix0; if (j == 0) { fi->glmin = (double) pix0; fi->glmax = (double) pix0; } /* go through all pixels */ for (i=0; itotal_counts += (float)*pix; } id->max = (double) max; id->min = (double) min; } break; case BIT32_U: { Uint32 *pix = (Uint32 *) id->buf, pix0; Uint32 max, min, maxmin_t; /* init first pixel */ memcpy((void *)&pix0,(void *)pix,4); MdcSwapBytes((Uint8 *)&pix0, 4); /* init max,min values */ min = pix0; max = pix0; if (j == 0) { fi->glmin = (double) pix0; fi->glmax = (double) pix0; } /* go through all pixels */ for (i=0; itotal_counts += (float)*pix; } id->max = (double) max; id->min = (double) min; } break; case BIT32_S: { Int32 *pix = (Int32 *) id->buf, pix0; Int32 max, min, maxmin_t; /* init first pixel */ memcpy((void *)&pix0,(void *)pix,4); MdcSwapBytes((Uint8 *)&pix0, 4); if (!MDC_NEGATIVE && (pix0 < 0)) pix0 = 0; /* init max,min values */ min = pix0; max = pix0; if (j == 0) { fi->glmin = (double) pix0; fi->glmax = (double) pix0; } for (i=0; itotal_counts += (float)*pix; } id->max = (double) max; id->min = (double) min; } break; #ifdef HAVE_8BYTE_INT case BIT64_U: { Uint64 *pix = (Uint64 *) id->buf, pix0; Uint64 max, min, maxmin_t; /* init first pixel */ memcpy((void *)&pix0,(void *)pix,8); MdcSwapBytes((Uint8 *)&pix0, 8); /* init max,min values */ min = pix0; max = pix0; if (j == 0) { fi->glmin = (double) pix0; fi->glmax = (double) pix0; } /* go through all pixels */ for (i=0; itotal_counts += (float)*pix; } id->max = (double) max; id->min = (double) min; } break; case BIT64_S: { Int64 *pix = (Int64 *) id->buf, pix0; Int64 max, min, maxmin_t; /* init first pixel */ memcpy((void *)&pix0,(void *)pix,8); MdcSwapBytes((Uint8 *)&pix0, 8); if (!MDC_NEGATIVE && (pix0 < 0)) pix0 = 0; /* init max,min values */ min = pix0; max = pix0; if (j == 0) { fi->glmin = (double) pix0; fi->glmax = (double) pix0; } /* go through all pixels */ for (i=0; itotal_counts += (float)*pix; } id->max = (double) max; id->min = (double) min; } break; #endif case FLT32: { float *pix = (float *) id->buf, pix0; float max, min, maxmin_t; /* init first pixel */ memcpy((void *)&pix0,(void *)pix,4); MdcSwapBytes((Uint8 *)&pix0, 4); FixWarn |= MdcFixFloat(&pix0); if (!MDC_NEGATIVE && (pix0 < 0.)) pix0 = 0.; /* init max,min values */ min = pix0; max = pix0; if (j == 0) { fi->glmin = (double) pix0; fi->glmax = (double) pix0; } for (i=0; itotal_counts += (float)*pix; } id->max = (double) max; id->min = (double) min; } break; case FLT64: { double *pix = (double *) id->buf, pix0; double max, min, maxmin_t; /* init first pixel */ memcpy((void *)&pix0,(void *)pix,8); MdcSwapBytes((Uint8 *)&pix0, 8); FixWarn |= MdcFixDouble(&pix0); if (!MDC_NEGATIVE && (pix0 < 0.)) pix0 = 0.; /* init max,min values */ min = pix0; max = pix0; if (j == 0) { fi->glmin = pix0; fi->glmax = pix0; } /* go through all pixels */ for (i=0; itotal_counts += (float)*pix; /* overflow */ } id->max = max; id->min = min; } break; } /* no negatives -> min = 0 */ if (!MDC_NEGATIVE && (id->min < 0.)) id->min = 0.; /* handle global max,min values */ if (j == 0) { fi->glmin = id->min; fi->glmax = id->max; }else{ if ( id->max > fi->glmax ) fi->glmax = id->max; if ( id->min < fi->glmin ) fi->glmin = id->min; } /* get quantified max,min */ id->qmin = (double)((float)id->min * id->rescale_slope); id->qmin += (double)id->rescale_intercept; id->qmax = (double)((float)id->max * id->rescale_slope); id->qmax += (double)id->rescale_intercept; /* negative slope -> reverse qmax,qmin */ if (id->rescale_slope < 0.) { double x; x = id->qmin; id->qmin = id->qmax; id->qmax = x; } /* handle quantified global min values */ if (j == 0) { fi->qglmin = id->qmin; }else{ if ( id->qmin < fi->qglmin) fi->qglmin = id->qmin; } /* handle quantified global max values */ if (j == 0) { fi->qglmax = id->qmax; }else{ if ( id->qmax > fi->qglmax ) fi->qglmax = id->qmax; } /* handle the max/min values for the frame group */ if ( (j % fi->dim[3]) == 0 ) { /* a frame boundary */ if (j == 0) { /* the beginning frame group */ fmin = id->min; fmax = id->max; qfmin = id->qmin; qfmax = id->qmax; }else{ /* new frame group, fill in the values for previous frame */ for (t=j - fi->dim[3]; timage[t]; idprev->fmin = fmin; idprev->fmax = fmax; idprev->qfmin = qfmin; idprev->qfmax = qfmax; } /* re-initialize the values for the new frame group */ fmin = id->min; fmax = id->max; qfmin = id->qmin; qfmax = id->qmax; } }else{ /* inside a frame group, determine min/max values */ if (id->min < fmin ) fmin = id->min; if (id->max > fmax ) fmax = id->max; if (id->qmin < qfmin ) qfmin = id->qmin; if (id->qmax > qfmax ) qfmax = id->qmax; } } /* warn about fixed values */ if (FixWarn) MdcPrntWarn("Fixed pixels with bad float value (= set to zero)"); /* don't forget to fill in the min/max values for the last frame group */ for (t=j - fi->dim[3]; timage[t]; idprev->fmin = fmin; idprev->fmax = fmax; idprev->qfmin = qfmin; idprev->qfmax = qfmax; } /* MARK: Prevent strange side effect of negative & raw reading: */ /* raw reading => enables negative values */ /* In this case min value is really the min value found */ /* and not set to zero. In case min value is >0 this value*/ /* will be displayed in XMedCon as black which is not */ /* wanted sometimes (ex. DICOM's converted to pgm files) */ /* Here we check if fi->glmin > 0 and fi->qglmin > 0 */ /* in order to set the min values to zero */ if (MDC_NEGATIVE == MDC_YES && fi->glmin > 0. && fi->qglmin > 0.) { fi->glmin = 0.; fi->qglmin = 0.; for (t = 0; t < fi->number; t++) { fi->image[t].min = 0.; fi->image[t].qmin = 0.; fi->image[t].fmin = 0.; fi->image[t].qfmin = 0.; } } /* from here on, endianess is host based */ MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; return(NULL); } double MdcGetDoublePixel(Uint8 *buf, int type) { double value=0.0; switch (type) { case BIT8_U: { Uint8 *pix = (Uint8 *)buf; value = (double)pix[0]; } break; case BIT8_S: { Int8 *pix = (Int8 *)buf; value = (double)pix[0]; } break; case BIT16_U: { Uint16 *pix = (Uint16 *)buf; value = (double)pix[0]; } break; case BIT16_S: { Int16 *pix = (Int16 *)buf; value = (double)pix[0]; } break; case BIT32_U: { Uint32 *pix = (Uint32 *)buf; value = (double)pix[0]; } break; case BIT32_S: { Int32 *pix = (Int32 *)buf; value = (double)pix[0]; } break; #ifdef HAVE_8BYTE_INT case BIT64_U: { Uint64 *pix = (Uint64 *)buf; value = (double)pix[0]; } break; case BIT64_S: { Int64 *pix = (Int64 *)buf; value = (double)pix[0]; } break; #endif case FLT32: { float *pix = (float *)buf; value = (double)pix[0]; } break; case FLT64: { double *pix = (double *)buf; value = pix[0]; } break; } return(value); } void MdcPutDoublePixel(Uint8 *buf, double pix, int type) { unsigned int bytes = (unsigned int)MdcType2Bytes(type); switch (type) { case BIT8_S: { Int8 c = (Int8) pix; buf[0] = c; } break; case BIT8_U: { Uint8 c = (Uint8) pix; buf[0] = c; } break; case BIT16_S: { Int16 c = (Int16) pix; memcpy(buf,(Uint8 *)&c,bytes); } break; case BIT16_U: { Uint16 c = (Uint16) pix; memcpy(buf,(Uint8 *)&c,bytes); } break; case BIT32_S: { Int32 c = (Int32) pix; memcpy(buf,(Uint8 *)&c,bytes); } break; case BIT32_U: { Uint32 c = (Uint32) pix; memcpy(buf,(Uint8 *)&c,bytes); } break; #ifdef HAVE_8BYTE_INT case BIT64_S: { Int64 c = (Int64) pix; memcpy(buf,(Uint8 *)&c,bytes); } break; case BIT64_U: { Uint64 c = (Uint64) pix; memcpy(buf,(Uint8 *)&c,bytes); } break; #endif case FLT32: { float c = (float) pix; memcpy(buf,(Uint8 *)&c,bytes); } break; case FLT64: { double c = (double) pix; memcpy(buf,(Uint8 *)&c,bytes); } break; } } int MdcDoSimpleCast(double minv, double maxv, double negmin, double posmax) { Int32 casted; /* Rescaling to new integer values (Int32, Int16, Uint8): when original * values are integers and within the range of the new pixel type, a * simple cast would do - without rescaling * - preserving original values */ if (MDC_ALLOW_CAST == MDC_NO) return(MDC_NO); /* TEST #1: simple cast test -> original values = integer ? */ casted = (Int32)minv; if ((double)casted != minv) return(MDC_NO); casted = (Int32)maxv; if ((double)casted != maxv) return(MDC_NO); /* TEST #2: within new pixel type range ? */ if (minv < negmin || maxv > posmax) return(MDC_NO); return(MDC_YES); } Uint8 *MdcGetResizedImage(FILEINFO *fi,Uint8 *buffer,int type,Uint32 img) { IMG_DATA *id = &fi->image[img]; Uint32 h, p, bytes, linesize, size; Uint32 lpad, rpad, tpad, bpad, linepad; Uint8 *lbuf=NULL, *rbuf=NULL, *linebuf=NULL, *pbuf; double pval; Uint8 *maxbuf, *obuf, *ibuf=buffer; if (id->type == COLRGB) { MdcPrntWarn("Resizing true color RGB images unsupported"); return(NULL); } if (id->rescaled) { pval = id->rescaled_min; }else{ pval = id->min; } bytes = MdcType2Bytes(type); linesize = id->width * bytes; size = fi->mwidth * fi->mheight * bytes; maxbuf = MdcGetImgBuffer(size); if (maxbuf == NULL) return NULL; obuf = maxbuf; /* calculate padding (left, right, top, bottom) */ linepad = fi->mwidth; switch (MDC_PADDING_MODE) { case MDC_PAD_AROUND: lpad = (fi->mwidth - id->width) / 2; rpad = (fi->mwidth - id->width + 1) / 2; /* +1 for int rounding */ tpad = (fi->mheight - id->height) / 2; bpad = (fi->mheight - id->height + 1) / 2; /* +1 for int rounding */ break; case MDC_PAD_BOTTOM_RIGHT: lpad = 0; rpad = fi->mwidth - id->width; tpad = 0; bpad = fi->mheight - id->height; break; case MDC_PAD_TOP_LEFT: lpad = fi->mwidth - id->width; rpad = 0; tpad = fi->mheight - id->height; bpad = 0; break; default: /* MDC_PAD_BOTTOM_RIGHT: */ lpad = 0; rpad = fi->mwidth - id->width; tpad = 0; bpad = fi->mheight - id->height; } /* malloc & fill left, right and full line buffers */ if (lpad > 0) { lbuf = malloc(bytes * lpad); if (lbuf == NULL) { MdcFree(maxbuf); return(NULL); } pbuf = lbuf; for (p = 0; p < lpad; p++) { MdcPutDoublePixel(pbuf,pval,type); pbuf += bytes; } } if (rpad > 0) { rbuf = malloc(bytes * rpad); if (rbuf == NULL) { MdcFree(maxbuf); MdcFree(lbuf); return(NULL); } pbuf = rbuf; for (p = 0; p < rpad; p++) { MdcPutDoublePixel(pbuf,pval,type); pbuf += bytes; } } if ((tpad > 0) || (bpad > 0)) { linebuf = malloc(bytes * linepad); if (linebuf == NULL) { MdcFree(maxbuf); MdcFree(lbuf); MdcFree(rbuf); return(NULL); } pbuf = linebuf; for (p = 0; p < linepad; p++) { MdcPutDoublePixel(pbuf,pval,type); pbuf += bytes; } } for (h=0; h < fi->mheight; h++) { if ( (h < tpad) || h >= (fi->mheight - bpad) ) { /* pad a full line at top or bottom */ memcpy(obuf,linebuf,linepad*bytes); obuf += linepad*bytes; }else{ /* copy an image line */ if (lpad > 0) { /* first pad line left */ memcpy(obuf,lbuf,lpad*bytes); obuf += lpad*bytes; } /* now copy line */ memcpy(obuf,ibuf,linesize); obuf += linesize; ibuf += linesize; if (rpad > 0) { /* then pad line right */ memcpy(obuf,rbuf,rpad*bytes); obuf += rpad*bytes; } } } MdcFree(lbuf); MdcFree(rbuf); MdcFree(linebuf); return(maxbuf); } /* get buffer for screen display */ Uint8 *MdcGetDisplayImage(FILEINFO *fi, Uint32 img) { Uint8 *buf, RESTORE=MDC_ALLOW_CAST; Uint32 width, height, bytes; if (fi->image[img].type == COLRGB) { /* RGB */ width = fi->image[img].width; height = fi->image[img].height; bytes = width * height * 3; buf = malloc(bytes); if (buf != NULL) memcpy(buf,fi->image[img].buf,bytes); }else{ /* indexed */ if (fi->map == MDC_MAP_PRESENT) { /* color */ MDC_ALLOW_CAST = MDC_YES; }else{ /* gray */ MDC_ALLOW_CAST = MDC_NO; } buf = MdcGetImgBIT8_U(fi,img); MDC_ALLOW_CAST = RESTORE; } return(buf); } Uint8 *MdcMakeBIT8_U(Uint8 *cbuf, FILEINFO *fi, Uint32 img) { IMG_DATA *id = &fi->image[img]; Uint8 *buf=(Uint8 *)cbuf, *pixel, DO_QUANT_CALIBR; Uint32 i, n = id->width * id->height; double pixval, min, max, idmin, idmax, scale=1.0; float newval; /* get proper maximum/minimum value */ if (MDC_QUANTIFY || MDC_CALIBRATE) { DO_QUANT_CALIBR = MDC_YES; if (MDC_NORM_OVER_FRAMES) { min = id->qfmin; max = id->qfmax; }else{ min = fi->qglmin; max = fi->qglmax; } }else{ DO_QUANT_CALIBR = MDC_NO; if (MDC_NORM_OVER_FRAMES) { min = id->fmin; max = id->fmax; }else{ min = fi->glmin; max = fi->glmax; } } scale = (max == min) ? 1. : 255./(max - min); if (MdcDoSimpleCast(min,max,0.,255.) == MDC_YES) { scale = 1.; min = 0.; } switch( id->type ) { case BIT1: /* convert bits to byte */ { /* to avoid a premature overwrite, we must begin from the end */ Uint8 masktable[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01}; for (i=n; i>0; i--) if(buf[(i-1) >> 3] & masktable[(i-1) & 7]) buf[i-1]=0xff; else buf[i-1]=0x00; } break; default: /* anything else to byte */ { for (pixel=id->buf, i=0; itype)) { pixval = MdcGetDoublePixel(pixel,id->type); if (DO_QUANT_CALIBR) { pixval *= (double)id->rescale_slope; pixval += (double)id->rescale_intercept; } newval = (float) (scale * (pixval - min)); buf[i] = (Uint8) newval; } } } id->rescaled = MDC_YES; if (DO_QUANT_CALIBR) { id->rescaled_fctr = (min < 0.) ? 1. : 1./scale; id->rescaled_slope= 1./scale; id->rescaled_intercept = min; idmax = id->qmax; idmin = id->qmin; }else{ id->rescaled_fctr = 1.; id->rescaled_slope= 1.; id->rescaled_intercept = 0.; idmax = id->max; idmin = id->min; } id->rescaled_max = (double)((Uint8)(scale * (idmax - min))); id->rescaled_min = (double)((Uint8)(scale * (idmin - min))); return(buf); } /* converts to Uint8 */ Uint8 *MdcGetImgBIT8_U(FILEINFO *fi, Uint32 img) { IMG_DATA *id = &fi->image[img]; Uint32 size = id->width * id->height * MdcType2Bytes(BIT8_U); Uint8 *buffer; if ( (buffer=(Uint8 *)malloc(size)) == NULL ) return NULL; buffer=MdcMakeBIT8_U(buffer,fi,img); return((Uint8 *)buffer); } Uint8 *MdcMakeBIT16_S(Uint8 *cbuf, FILEINFO *fi, Uint32 img) { IMG_DATA *id = &fi->image[img]; Uint8 *pixel, DO_QUANT_CALIBR, DO_LINEAR_SCALE=MDC_NO; Int16 *buf = (Int16 *)cbuf; Uint32 i, n = id->width * id->height; double pixval, min, max, idmin, idmax, scale=1.0; double SMAX, UMAX, negmin, posmax; float newval; UMAX = (double)(1 << MDC_INT16_BITS_USED); /* 16-bits: 65536 */ SMAX = (double)(1 << (MDC_INT16_BITS_USED-1)); /* 16-bits: 32768 */ /* get proper maximum/minimum value */ if (MDC_QUANTIFY || MDC_CALIBRATE) { DO_QUANT_CALIBR = MDC_YES; if (MDC_NORM_OVER_FRAMES) { min = id->qfmin; max = id->qfmax; }else{ min = fi->qglmin; max = fi->qglmax; } }else{ DO_QUANT_CALIBR = MDC_NO; if (MDC_NORM_OVER_FRAMES) { min = id->fmin; max = id->fmax; }else{ min = fi->glmin; max = fi->glmax; } } /* set limit values */ switch (MDC_INT16_BITS_USED) { case 16: /* signed */ negmin = -SMAX; posmax = SMAX - 1.; break; default: /* unsigned */ negmin = 0.; posmax = UMAX - 1.; } /* check scale type: linear / affine */ if (DO_QUANT_CALIBR) { /* get scale to transform max positive value to max new type */ /* check whether neg values scale within neg range, which */ /* allows linear transform, otherwise affine transform used */ DO_LINEAR_SCALE = ((min * posmax / max) >= negmin) ? MDC_YES : MDC_NO; } /* linear scaling, do not shift to positive range */ if (DO_LINEAR_SCALE == MDC_YES) min = 0.; /* set scale value */ scale = (max == min) ? 1. : posmax / (max - min); if (MdcDoSimpleCast(min,max,negmin,posmax) == MDC_YES) { scale = 1.; min = 0.; } /* scale pixel values */ for (pixel=id->buf, i=0; itype)) { /* get pixel value */ pixval = MdcGetDoublePixel(pixel,id->type); if (DO_QUANT_CALIBR) { pixval *= (double)id->rescale_slope; pixval += (double)id->rescale_intercept; } newval = (float) (scale * (pixval - min)); buf[i] = (Int16) newval; } /* preserve rescaled values */ id->rescaled = MDC_YES; if (DO_QUANT_CALIBR) { id->rescaled_fctr = (min < 0.) ? 1. : 1./scale; id->rescaled_slope= 1./scale; id->rescaled_intercept = min; idmax = id->qmax; idmin = id->qmin; }else{ id->rescaled_fctr = 1.; id->rescaled_slope= 1.; id->rescaled_intercept = 0.; idmax = id->max; idmin = id->min; } id->rescaled_max = (double)((Int16)(scale * (idmax - min))); id->rescaled_min = (double)((Int16)(scale * (idmin - min))); return((Uint8 *)buf); } /* converts to Int16 */ Uint8 *MdcGetImgBIT16_S(FILEINFO *fi, Uint32 img) { IMG_DATA *id = &fi->image[img]; Uint32 bytes = id->width * id->height * MdcType2Bytes(BIT16_S); Uint8 *buffer; if ( (buffer=(Uint8 *)malloc(bytes)) == NULL ) return NULL; buffer=MdcMakeBIT16_S(buffer,fi,img); return(buffer); } Uint8 *MdcMakeBIT32_S(Uint8 *cbuf, FILEINFO *fi, Uint32 img) { IMG_DATA *id = &fi->image[img]; Uint8 *pixel, DO_QUANT_CALIBR, DO_LINEAR_SCALE=MDC_NO, BITS = 32; Int32 *buf = (Int32 *)cbuf; Uint32 i, n = id->width * id->height; double pixval, min, max, idmin, idmax, scale=1.0; double SMAX, negmin, posmax; float newval; SMAX = (double)(1 << (BITS-1)); /* 2147483648 */ /* get proper maximum/minimum value */ if (MDC_QUANTIFY || MDC_CALIBRATE) { DO_QUANT_CALIBR = MDC_YES; if (MDC_NORM_OVER_FRAMES) { min = id->qfmin; max = id->qfmax; }else{ min = fi->qglmin; max = fi->qglmax; } }else{ DO_QUANT_CALIBR = MDC_NO; if (MDC_NORM_OVER_FRAMES) { min = id->fmin; max = id->fmax; }else{ min = fi->glmin; max = fi->glmax; } } /* set limit values */ negmin = -SMAX; posmax = SMAX - 1.; /* check scale type: linear / affine */ if (DO_QUANT_CALIBR) { /* get scale to transform max positive value to max new type */ /* check whether neg values scale within neg range, which */ /* allows linear transform, otherwise affine transform used */ DO_LINEAR_SCALE = ((min * posmax / max) >= negmin) ? MDC_YES : MDC_NO; } /* linear scaling, do not shift to positive range */ if (DO_LINEAR_SCALE == MDC_YES) min = 0.; /* set scale value */ scale = (max == min) ? 1. : posmax / (max - min); if (MdcDoSimpleCast(min,max,-SMAX,SMAX-1.) == MDC_YES) { scale = 1.; min = 0.; } /* scale pixel values */ for (pixel=id->buf, i=0; itype)) { /* get pixel value */ pixval = MdcGetDoublePixel(pixel,id->type); if (DO_QUANT_CALIBR) { pixval *= (double)id->rescale_slope; pixval += (double)id->rescale_intercept; } newval = (float) (scale * (pixval - min)); buf[i] = (Int32) newval; } /* preserve rescaled value */ id->rescaled = MDC_YES; if (DO_QUANT_CALIBR) { id->rescaled_fctr = ( min < 0. ) ? 1. : 1./scale; id->rescaled_slope= 1./scale; id->rescaled_intercept = min; idmax = id->qmax; idmin = id->qmin; }else{ id->rescaled_fctr = 1.; id->rescaled_slope= 1.; id->rescaled_intercept = 0.; idmax = id->max; idmin = id->min; } id->rescaled_max = (double)((Int32)(scale * (idmax - min))); id->rescaled_min = (double)((Int32)(scale * (idmin - min))); return((Uint8 *)buf); } /* converts to Int32 */ Uint8 *MdcGetImgBIT32_S(FILEINFO *fi, Uint32 img) { IMG_DATA *id = &fi->image[img]; Uint32 size = id->width * id->height * MdcType2Bytes(BIT32_S); Uint8 *buffer; if ( (buffer=(Uint8 *)malloc(size)) == NULL ) return NULL; buffer=MdcMakeBIT32_S(buffer,fi,img); return(buffer); } Uint8 *MdcMakeFLT32(Uint8 *cbuf, FILEINFO *fi, Uint32 img) { IMG_DATA *id = &fi->image[img]; Uint8 *pixel, DO_QUANT_CALIBR, DO_CAST=MDC_NO; float *buf = (float *)cbuf, newval; Uint32 i, n = id->width * id->height; double pixval, min, max, scale=1.0; double smin = 0.; /* shift to positive values (rescale) */ /* get proper maximum/minimum value */ if (MDC_QUANTIFY || MDC_CALIBRATE) { /* do the real quantification */ DO_QUANT_CALIBR = MDC_YES; min = id->qmin; max = id->qmax; if (id->type == FLT64) { /* probably be too big for float. if global too */ /* big, don't quantify an image but do a simple */ /* downscaling to float and warn the user! */ if (fi->qglmax > 3.40282347e+38) { MdcPrntWarn("Values `double' too big for `quantified float'"); DO_QUANT_CALIBR = MDC_NO; if (MDC_NORM_OVER_FRAMES) { min = id->fmin; max = id->fmax; }else{ min = fi->glmin; max = fi->glmax; } } } }else{ DO_QUANT_CALIBR = MDC_NO; if (MDC_NORM_OVER_FRAMES) { min = id->fmin; max = id->fmax; }else{ min = fi->glmin; max = fi->glmax; } } if (DO_QUANT_CALIBR) { scale = (double)id->rescale_slope; /* anything else fits in float */ }else{ /* try preserving pixel values with simple cast */ if (id->type <= FLT32 ) { scale = 1.; DO_CAST = MDC_YES; /* ok, integers */ }else if ( id->type == FLT64 && fabs(fi->glmax) < 3.40282347e+38 && fabs(fi->glmin) > 1e-37 ) { scale = 1.; DO_CAST = MDC_YES; /* ok, doubles fit in float */ }else{ /* need rescaling: 0 -> MAX_FLOAT*/ scale = (max == min) ? 1. : 3.40282347e+38 / (max - min); smin = min; min = 0.; DO_CAST = MDC_NO; } } for (pixel=id->buf, i=0; itype)) { pixval = MdcGetDoublePixel(pixel,id->type); newval = (float) (scale * (pixval - smin)); if (DO_QUANT_CALIBR) newval += id->rescale_intercept; buf[i] = newval; } id->rescaled = MDC_YES; if (DO_QUANT_CALIBR) { id->rescaled_fctr = 1.; /* got the real quantified values this time! */ id->rescaled_slope= 1.; id->rescaled_intercept = 0.; id->rescaled_max = max; id->rescaled_min = min; }else if (DO_CAST == MDC_NO) { id->rescaled_fctr = 1.; id->rescaled_slope= 1.; id->rescaled_intercept = 0.; id->rescaled_max = 3.40282347e+38; id->rescaled_min = 0.; }else{ id->rescaled = MDC_NO; } return((Uint8 *)buf); } /* converts from FLT64 to FLT32 */ /* or in case of quantification all other types into a FLT32 */ Uint8 *MdcGetImgFLT32(FILEINFO *fi, Uint32 img) { IMG_DATA *id = &fi->image[img]; Uint32 bytes = id->width * id->height * MdcType2Bytes(FLT32); Uint8 *buffer = NULL; if ( (buffer=(Uint8 *)malloc(bytes)) == NULL ) return NULL; buffer=MdcMakeFLT32(buffer,fi,img); if (buffer == NULL) return NULL; return(buffer); } Uint8 *MdcMakeImgSwapped(Uint8 *cbuf, FILEINFO *fi, Uint32 img, Uint32 width, Uint32 height, int type) { IMG_DATA *id = &fi->image[img]; Uint8 *pixel=NULL; int i, pixbytes; /* giving a width, heigth & type, allows to use this function directly */ /* for swapping of none IMG_DATA image buffers */ if ((type == BIT8_U) || (type == BIT8_S)) return(cbuf); /* no swap needed */ if (width == 0) width = id->width; if (height == 0) height = id->height; if (type <= 0) type = id->type; pixbytes = MdcType2Bytes(type); for (i=0; iimage[img]; Uint32 bytes = id->width * id->height * MdcType2Bytes(id->type); Uint8 *buffer = NULL; if ( (buffer=(Uint8 *)malloc(bytes)) == NULL ) return NULL; memcpy(buffer,id->buf,bytes); buffer=MdcMakeImgSwapped(buffer,fi,img,0,0,0); return(buffer); } /* unpack BIT12_U pixels into BIT16_U */ /* 2 pix 12bit = [0xABCDEF] */ /* 2 pix 16bit = [0x0ABD] + [0x0FCE] */ int MdcUnpackBIT12(FILEINFO *fi, Uint32 img) { IMG_DATA *id = &fi->image[img]; Uint32 p, pixels = id->width * id->height; Uint16 *buf16 = NULL; Uint8 *buf = id->buf, b0, b1, b2; if ( (buf16=(Uint16 *)malloc(pixels * sizeof(Uint16))) == NULL) return(MDC_NO); for (p=0; p> 4) << 8) + ((b0 & 0x0f) << 4) + (b1 & 0x0f); /* A */ /* B */ /* D */ MdcSwapBytes((Uint8 *)&buf16[p],2); buf16[p+1] = ((b2 & 0x0f) << 8) + ((b1 >> 4) << 4) + (b2 >> 4); /* F */ /* C */ /* E */ MdcSwapBytes((Uint8 *)&buf16[p+1],2); buf+=3; } MdcFree(id->buf); id->buf = (Uint8 *)buf16; id->bits = 12; id->type = BIT16_U; return(MDC_YES); } Uint32 MdcHashDJB2(unsigned char *str) { Uint32 hash = 5381; int c; while ((c = *str++)) { hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ } return(hash); } Uint32 MdcHashSDBM(unsigned char *str) { unsigned long hash = 0; int c; while ((c = *str++)) { hash = c + (hash << 6) + (hash << 16) - hash; } return hash; } xmedcon-0.14.1/source/xreslice.c0000644000175000017510000000532012636253502013442 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xreslice.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : volume reslice routines * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcResliceImages() - Reslice the images * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xreslice.c,v 1.21 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include #include "xmedcon.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcResliceImages(GtkWidget *widget, guint projection) { char *msg; Int8 newproj = (Int8)projection; if (XMdcNoFileOpened()) return; msg = MdcCheckReslice(my.fi,newproj); if (msg != NULL) { XMdcDisplayWarn("Reslice - %s",msg); return; } XMdcProgressBar(MDC_PROGRESS_BEGIN,0.,"Reslicing images:"); XMdcViewerHide(); XMdcViewerEnableAutoShrink(); XMdcViewerReset(); msg = MdcResliceImages(my.fi, newproj); if (msg != NULL) XMdcDisplayErr("Reslice - %s",msg); XMdcDisplayImages(); XMdcProgressBar(MDC_PROGRESS_END,0.,NULL); XMDC_FILE_TYPE = XMDC_RESLICE; } xmedcon-0.14.1/source/m-structs.h0000644000175000017510000004023012636253502013571 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-structs.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-structs.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-structs.h,v 1.64 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_STRUCTS_H__ #define __M_STRUCTS_H__ /**************************************************************************** D E F I N E S *****************************************************************************/ #define MDC_MAX_DIMS 8 /* maximum number of dimensions */ /* generic info GN */ typedef struct General_Info_t { char study_date[MDC_MAXSTR]; char study_time[MDC_MAXSTR]; char series_date[MDC_MAXSTR]; char series_time[MDC_MAXSTR]; char acquisition_date[MDC_MAXSTR]; char acquisition_time[MDC_MAXSTR]; char image_date[MDC_MAXSTR]; char image_time[MDC_MAXSTR]; } GN_INFO; /* specific info XA modality */ typedef struct Mod_XA_Info_t { /* Image identification characteristics */ char ImageType[MDC_MAXSTR]; /* (0008,0008) */ /* Number of samples (color planes) should be 1 */ Int16 Samples_Per_Pixel; /* (0028,0002) */ /* Interpretation of pixel data should be MONOCROME2 */ char Photo_Interp[MDC_MAXSTR]; /* (0028,0004) */ /* Frame Incr Pointer (0018,1063) Time (0018,1065) Vect */ char Frame_Increment_Pointer[MDC_MAXSTR]; /* (0028,0009) */ /* Relationship between pixel sample & X-ray intensity */ char Pixel_Intensity_Rel[MDC_MAXSTR]; /* (0028,1040) */ /* */ /* kvp Peak kilo voltage output of X-Ray generator used */ char kvp[MDC_MAXSTR]; /* (0018,0060) */ /* Radiation Setting */ char Radiation_Setting[MDC_MAXSTR]; /* (0018,1155) */ } XA_INFO; /* specific info MR modality */ typedef struct Mod_MR_Info_t { double repetition_time; double echo_time; double inversion_time; double num_averages; double imaging_freq; double pixel_bandwidth; double flip_angle; double dbdt; Uint32 transducer_freq; char transducer_type[MDC_MAXSTR]; Uint32 pulse_repetition_freq; char pulse_seq_name[MDC_MAXSTR]; char steady_state_pulse_seq[MDC_MAXSTR]; double slab_thickness; double sampling_freq; } MR_INFO; typedef struct Modality_Info_t { GN_INFO gn_info; /*XA_INFO xa_info;*/ MR_INFO mr_info; } MOD_INFO; /* static related data */ typedef struct Static_Data_t { char label[MDC_MAXSTR]; /* label name of image */ /* Ant/Post */ float total_counts; /* total counts in image */ float image_duration; /* duration of image (ms) */ Int16 start_time_hour; /* start time hour */ Int16 start_time_minute; /* start time minute */ Int16 start_time_second; /* start time second */ } STATIC_DATA; /* gated SPECT related data */ typedef struct Gated_Data_t { Int8 gspect_nesting; /* gated spect nesting */ float nr_projections; /* number of projections */ float extent_rotation; /* extent of rotation */ float study_duration; /* study duration (ms) */ float image_duration; /* image duration (ms) */ float time_per_proj; /* time per proj (ms) */ float window_low; /* lower limit (ms) */ float window_high; /* higher limit (ms) */ float cycles_observed; /* cardiac cycles observed*/ float cycles_acquired; /* cardiac cycles acquired*/ } GATED_DATA; /* acquisition data */ typedef struct Acquisition_Data_t { Int16 rotation_direction; /* direction of rotation */ Int16 detector_motion; /* type detector motion */ float rotation_offset; /* centre rotation offset */ float radial_position; /* radial position */ float angle_start; /* start angle (interfile)*/ /* 180 - dicom */ float angle_step; /* angular step */ float scan_arc; /* angular range */ } ACQ_DATA; /* dynamic data */ typedef struct Dynamic_Data_t { Uint32 nr_of_slices; /* images in time frame */ float time_frame_start; /* start time frame (ms) */ float time_frame_delay; /* delay this frame (ms) */ float time_frame_duration; /* duration frame (ms) */ float delay_slices; /* delay each slice (ms) */ } DYNAMIC_DATA; /* bed data */ typedef struct Bed_Data_t { float hoffset; /* horizon. position (mm) */ float voffset; /* vertical position (mm) */ } BED_DATA; /* images related data */ typedef struct Image_Data_t { /* ** general data ** */ Uint32 width,height; /* image dimension */ Int16 bits,type; /* bits/pixel & datatype */ Uint16 flags; /* extra flag */ double min, max; /* min/max pixelvalue */ double qmin, qmax; /* quantified min/max */ double fmin, fmax; /* min/max in whole frame */ double qfmin, qfmax; /* in whole frame (quant) */ float rescale_slope; /* rescale slope */ /* auto filled */ float rescale_intercept; /* rescale intercept */ /* auto filled */ Uint32 frame_number; /* part of frame (1-based)*/ /* auto filled */ float slice_start; /* start of slice (ms) */ /* auto filled */ Uint8 *buf; /* pointer to raw image */ size_t load_location; /* load start in file */ /* ** internal items ** */ Int8 rescaled; /* rescaled image? */ double rescaled_min; /* new rescaled max */ double rescaled_max; /* new rescaled min */ double rescaled_fctr; /* new rescaled fctr */ double rescaled_slope; /* new rescaled slope */ double rescaled_intercept; /* new rescaled intercept */ /* ** ecat64 items ** */ Int16 quant_units; /* quantification units */ Int16 calibr_units; /* calibration units */ float quant_scale; /* quantification scale */ float calibr_fctr; /* calibration factor */ float intercept; /* scale intercept */ float pixel_xsize; /* pixel size X (mm) */ float pixel_ysize; /* pixel size Y (mm) */ float slice_width; /* slice width (mm) */ float recon_scale; /* recon magnification */ /* ** Acr/Nema items ** */ float image_pos_dev[3]; /* image posit dev (mm) */ float image_orient_dev[6]; /* image orient dev (mm) */ float image_pos_pat[3]; /* image posit pat (mm) */ float image_orient_pat[6]; /* image orient pat (mm) */ float slice_spacing; /* space btw centres (mm) */ float ct_zoom_fctr; /* CT image zoom factor */ /* ** Miscellaneous ** */ STATIC_DATA *sdata; /* extra static entries */ /* just one */ unsigned char *plugb; /* like to attach here? */ } IMG_DATA; /* the file information struct */ typedef struct File_Info_t { FILE *ifp; /* pointer to input file */ FILE *ifp_raw; /* pointer to raw input */ FILE *ofp; /* pointer to output file */ FILE *ofp_raw; /* pointer to raw output */ char ipath[MDC_MAX_PATH+1]; /* path to input file */ char opath[MDC_MAX_PATH+1]; /* path to output file */ char *idir; /* dir to input file */ char *odir; /* dir to output file */ char *ifname; /* name of input file */ char *ofname; /* name of output file */ int iformat; /* format of input file */ int oformat; /* format of output file */ int modality; /* modality */ Int8 rawconv; /* FRMT_RAW | FRMT_ASCII */ Int8 endian; /* endian of file */ Int8 compression; /* file compression */ Int8 truncated; /* truncated file? */ Int8 diff_type; /* images with diff type? */ Int8 diff_size; /* images with diff size? */ Int8 diff_scale; /* images with diff scale?*/ Uint32 number; /* total number of images */ /* private */ Uint32 mwidth,mheight; /* global max dimensions */ Int16 bits, type; /* global bits & datatype */ Int16 dim[MDC_MAX_DIMS]; /* [0] = # of dimensions */ /* [1] = X-dim (pixels) */ /* [2] = Y-dim (pixels) */ /* [3] = Z-dim (planes) */ /* [4] = (frames) */ /* [5] = (gates) */ /* [6] = (beds) */ /* ... */ /* values must be 1-based */ float pixdim[MDC_MAX_DIMS]; /* [0] = # of dimensions */ /* [1] = X-dim (mm) */ /* [2] = Y-dim (mm) */ /* [3] = Z-dim (mm) */ /* [4] = time (ms) */ /* ... */ double glmin, glmax; /* global min/max value */ double qglmin, qglmax; /* quantified min/max */ Int8 contrast_remapped; /* contrast remap applied */ float window_centre; /* contrast window centre */ float window_width; /* contrast window width */ Int8 slice_projection; /* projection of images */ Int8 pat_slice_orient; /* combined flag */ char pat_pos[MDC_MAXSTR]; /* patient position */ char pat_orient[MDC_MAXSTR]; /* patient orientation */ char patient_sex[MDC_MAXSTR]; /* sex of patient */ char patient_name[MDC_MAXSTR];/* name of patient */ char patient_id[MDC_MAXSTR]; /* id of patient */ char patient_dob[MDC_MAXSTR]; /* birth of patient */ /* YYYYMMDD */ float patient_weight; /* weight of patient (kg) */ float patient_height; /* height of patient (m) */ char operator_name[MDC_MAXSTR];/* name of scan operator */ char study_descr[MDC_MAXSTR]; /* study description */ char study_id[MDC_MAXSTR]; /* study id */ Int16 study_date_day; /* day of study (1-31) */ Int16 study_date_month; /* month of study (1-12) */ Int16 study_date_year; /* year of study */ Int16 study_time_hour; /* hour of study */ Int16 study_time_minute; /* minute of study */ Int16 study_time_second; /* second of study */ Int16 dose_time_hour; /* hour of dose start */ Int16 dose_time_minute; /* minute of dose start */ Int16 dose_time_second; /* second of dose start */ Int32 nr_series; /* series number */ Int32 nr_acquisition; /* acquisition number */ Int32 nr_instance; /* instance number */ Int16 acquisition_type; /* acquisition type */ Int16 planar; /* planar or tomo ? */ Int16 decay_corrected; /* decay corrected ? */ Int16 flood_corrected; /* flood corrected ? */ Int16 reconstructed; /* reconstructed ? */ char recon_method[MDC_MAXSTR]; /* reconstruction method */ char institution[MDC_MAXSTR]; /* name of institution */ char manufacturer[MDC_MAXSTR]; /* name of manufacturer */ char series_descr[MDC_MAXSTR]; /* series description */ char radiopharma[MDC_MAXSTR]; /* radiopharmaceutical */ char filter_type[MDC_MAXSTR]; /* filter type */ char organ_code[MDC_MAXSTR]; /* organ */ char isotope_code[MDC_MAXSTR]; /* isotope */ float isotope_halflife; /* isotope halflife (sec) */ float injected_dose; /* amount injected (MBq) */ float gantry_tilt; /* gantry tilt */ Uint8 map; /* indexed 256 colormap */ Uint8 palette[768]; /* global palette */ char *comment; /* whatever comment */ Uint32 comm_length; /* length of comment */ Uint32 gatednr; /* number of gated entries*/ /* now 0 or 1 */ GATED_DATA *gdata; /* array of GATED_DATA */ Uint32 acqnr; /* number acq. entries */ ACQ_DATA *acqdata; /* array ACQ_DATA entries */ Uint32 dynnr; /* number of time frames */ DYNAMIC_DATA *dyndata; /* array of DYNAMIC_DATA */ Uint32 bednr; /* number bed positions */ BED_DATA * beddata; /* array of BED_DATA */ IMG_DATA *image; /* array IMG_DATA images */ MOD_INFO *mod; /* modality related info */ unsigned char *pluga; /* want to attach stuff? */ } FILEINFO; /**************************************************************************** F U N C T I O N S ****************************************************************************/ char *MdcCheckFI(FILEINFO *fi); int MdcGetStructMOD(FILEINFO *fi); int MdcGetStructID(FILEINFO *fi, Uint32 number); int MdcGetStructSD(FILEINFO *fi, Uint32 number); int MdcGetStructGD(FILEINFO *fi, Uint32 number); int MdcGetStructAD(FILEINFO *fi, Uint32 number); int MdcGetStructDD(FILEINFO *fi, Uint32 number); int MdcGetStructBD(FILEINFO *fi, Uint32 number); void MdcInitMOD(MOD_INFO *mod); void MdcInitID(IMG_DATA *id); void MdcInitSD(STATIC_DATA *sd); void MdcInitGD(GATED_DATA *gd); void MdcInitAD(ACQ_DATA *acq); void MdcInitDD(DYNAMIC_DATA *dd); void MdcInitBD(BED_DATA *bd); void MdcInitFI(FILEINFO *fi, const char *path); char *MdcCopyMOD(MOD_INFO *mod, MOD_INFO *src); char *MdcCopyID(IMG_DATA *dest, IMG_DATA *src, int COPY_IMAGE); char *MdcCopySD(STATIC_DATA *dest, STATIC_DATA *src); char *MdcCopyGD(GATED_DATA *dest, GATED_DATA *src); char *MdcCopyAD(ACQ_DATA *dest, ACQ_DATA *src); char *MdcCopyDD(DYNAMIC_DATA *dest, DYNAMIC_DATA *src); char *MdcCopyBD(BED_DATA *dst, BED_DATA *src); char *MdcCopyFI(FILEINFO *dest, FILEINFO *src, int COPY_IMAGES, int KEEP_FILES); void MdcFreeMODs(FILEINFO *fi); void MdcFreeIDs(FILEINFO *fi); void MdcFreeODs(FILEINFO *fi); void MdcResetIDs(FILEINFO *fi); char *MdcResetODs(FILEINFO *fi); void MdcCleanUpFI(FILEINFO *fi); #endif xmedcon-0.14.1/source/m-error.h0000644000175000017510000000505512636253502013221 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-error.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-error.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-error.h,v 1.18 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_ERROR_H__ #define __M_ERROR_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_OK 0 /* return codes */ #define MDC_BAD_OPEN -1 #define MDC_BAD_CLOSE -2 #define MDC_BAD_FILE -3 #define MDC_BAD_READ -4 #define MDC_UNEXPECTED_EOF -5 #define MDC_BAD_CODE -6 #define MDC_BAD_FIRSTCODE -7 #define MDC_BAD_ALLOC -8 #define MDC_BAD_SYMBOLSIZE -9 #define MDC_OVER_FLOW -10 #define MDC_NO_CODE -11 #define MDC_BAD_WRITE -12 /**************************************************************************** F U N C T I O N S ****************************************************************************/ void MdcPrntScrn(char *fmt, ...); void MdcPrntWarn(char *fmt, ...); void MdcPrntMesg(char *fmt, ...); void MdcPrntErr(int code, char *fmt, ...); #endif xmedcon-0.14.1/source/m-vifi.h0000644000175000017510000000362112636253502013022 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-vifi.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-vifi.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-vifi.h,v 1.16 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_VIFI_H__ #define __M_VIFI_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void MdcMakePatAnonymous(FILEINFO *fi); void MdcGivePatInformation(FILEINFO *fi); char *MdcEditFI(FILEINFO *fi); #endif xmedcon-0.14.1/source/m-color.h0000644000175000017510000000413512636253501013203 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-color.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-color.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-color.h,v 1.19 2015/12/22 13:59:29 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_COLOR_H__ #define __M_COLOR_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcLoadLUT(const char *lutname); void MdcGrayScale(Uint8 *palette); void MdcInvertedScale(Uint8 *palette); void MdcRainbowScale(Uint8 *palette); void MdcCombinedScale(Uint8 *palette); void MdcHotmetalScale(Uint8 *palette); void MdcGetColorMap(int map, Uint8 palette[]); int MdcSetPresentMap(Uint8 palette[]); #endif xmedcon-0.14.1/source/xinfo.h0000644000175000017510000000361012636253502012754 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xinfo.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xinfo.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xinfo.h,v 1.17 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XINFO_H__ #define __XINFO_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcImagesInfo(GtkWidget *widget, Uint32 nr); void XMdcShowFileInfo(GtkWidget *widget, gpointer data); #endif xmedcon-0.14.1/source/xprogbar.h0000644000175000017510000000422212636253502013455 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xprogbar.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xprogbar.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xprogbar.h,v 1.20 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XPROGBAR_H__ #define __XPROGBAR_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcProgressBar(int type, float value, char *label); void XMdcUpdateDrawing(void); void XMdcUpdateProgressBar(void); void XMdcSetProgressBar(float set); void XMdcIncrProgressBar(float incr); void XMdcCreateProgressBar(char *labelstring); void XMdcBeginProgressBar(char *labelstring); void XMdcEndProgressBar(void); char *XMdcHandleBarLabel(char *labelstring); #endif xmedcon-0.14.1/source/m-anlz.h0000644000175000017510000001554212636253501013035 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-anlz.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-anlz.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-anlz.h,v 1.21 2015/12/22 13:59:29 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_ANLZ_H__ #define __M_ANLZ_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_ANLZ_SIG 'r' #define MDC_ANLZ_MAX_DIMS 8 /* maximum number of dimensions */ /* datatypes */ #define MDC_ANLZ_DT_UNKNOWN 0 #define MDC_ANLZ_DT_BINARY 1 /* 1-bit */ #define MDC_ANLZ_DT_UNSIGNED_CHAR 2 /* Uint8 */ #define MDC_ANLZ_DT_SIGNED_SHORT 4 /* Int16 */ #define MDC_ANLZ_DT_SIGNED_INT 8 /* Int32 */ #define MDC_ANLZ_DT_FLOAT 16 /* float */ #define MDC_ANLZ_DT_COMPLEX 32 /* 2 x float */ /* unsupported */ #define MDC_ANLZ_DT_DOUBLE 64 /* double */ #define MDC_ANLZ_DT_RGB 128 /* 3 x Uint8 */ /* unsupported */ #define MDC_ANLZ_DT_ALL 255 /* All */ /* unsupported */ /* orient types */ #define MDC_ANLZ_TRANS_UNFLIPPED 0 #define MDC_ANLZ_CORON_UNFLIPPED 1 #define MDC_ANLZ_SAGIT_UNFLIPPED 2 #define MDC_ANLZ_TRANS_FLIPPED 3 #define MDC_ANLZ_CORON_FLIPPED 4 #define MDC_ANLZ_SAGIT_FLIPPED 5 typedef struct Header_Key_t { Int32 sizeof_hdr; /* 348 or 148 */ char data_type[10]; /* "dsr" */ char db_name[18]; /* filename without extension */ Int32 extents; Int16 session_error; char regular; /* 'r' */ char hkey_un0; } MDC_ANLZ_HEADER_KEY; #define MDC_ANLZ_HK_SIZE 40 typedef struct Image_Dimensions_t { Int16 dim[MDC_ANLZ_MAX_DIMS]; /* [0] = # of dimensions */ /* [1] = X-dim */ /* [2] = Y-dim */ /* [3] = Z-dim */ /* [4] = t-dim */ /* ... */ char avw_vox_units[4]; /* AVW real world dim units */ char avw_cal_units[8]; /* AVW real world pix units */ Int16 unused1; Int16 datatype; /* pixel type */ /* 0 = Unknown 1 = one-bit */ /* 2 = Uint8 4 = Int16 */ /* 8 = Int32 16 = float */ /* 32 = complex 64 = double */ Int16 bitpix; /* bits per pixel */ Int16 dim_un0; float pixdim[MDC_ANLZ_MAX_DIMS]; /* [0] = # of dimensions */ /* [1] = X-dim (mm) */ /* [2] = Y-dim (mm) */ /* [3] = Z-dim (mm) */ /* [4] = t-dim (ms) */ /* ... */ float avw_vox_offset; /* AVW offset to pixel data */ float spm_pix_rescale; /* SPM pixel rescale factor */ float funused1; float funused2; float avw_cal_max; /* AVW max calibrated values */ float avw_cal_min; /* AVW min calibrated values */ float compressed; float verified; Int32 glmax,glmin; } MDC_ANLZ_IMAGE_DIMS; #define MDC_ANLZ_IMD_SIZE 108 typedef struct Data_History_t { char descrip[80]; char aux_file[24]; char orient; /* patient orientation */ /* 0 = transverse unflipped */ /* 1 = coronal unflipped */ /* 2 = sagittal unflipped */ /* 3 = transverse flipped */ /* 4 = coronal flipped */ /* 5 = sagittal flipped */ char originator[10]; char generated[10]; char scannum[10]; char patient_id[10]; char exp_date[10]; char exp_time[10]; char hist_un0[3]; Int32 views; Int32 vols_added; Int32 start_field; Int32 field_skip; Int32 omax, omin; Int32 smax, smin; } MDC_ANLZ_DATA_HIST; #define MDC_ANLZ_DH_SIZE 200 typedef struct MdcSpmOpt_t { Int16 origin_x; Int16 origin_y; Int16 origin_z; float offset; } MDC_SPMOPT; /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcCheckANLZ(FILEINFO *fi); const char *MdcReadANLZ(FILEINFO *fi); const char *MdcWriteANLZ(FILEINFO *fi); int MdcWriteHeaderKey(FILEINFO *fi); int MdcWriteImageDimension(FILEINFO *fi, MDC_SPMOPT *opt); int MdcWriteDataHistory(FILEINFO *fi, MDC_SPMOPT *opt); char *MdcWriteImagesData(FILEINFO *fi); void MdcGetSpmOpt(FILEINFO *fi, MDC_SPMOPT *opt); #endif xmedcon-0.14.1/source/m-inw.h0000644000175000017510000001350712636253502012666 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-inw.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-inw.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-inw.h,v 1.17 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_INW_H__ #define __M_INW_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_INW_VERS_HIGH 1 /* INW version 1.0 */ #define MDC_INW_VERS_LOW 0 #define MDC_INW_SIG (int)(0x789abcde) /* for identification of header */ /* scanner type */ #define EcatII 2 #define EcatIV 4 /* reconstruction methods */ #define reconFBP 'i' #define reconMaxLikFV 'm' #define reconMaxLik 'l' #define reconMaxPos 'e' #define reconALL "imle" #define reconTEXT "Filtered Backprojection",\ "Maximum likelihood (Frank Vermeulen)",\ "Maximum likelihood (Tom De Backer)",\ "Maximum a Posteriori" /* image headers */ typedef struct Head_start_t { Int32 mark; /* should be HEADER_MARK */ Int16 version; /* high*256 + low */ Int16 size_header; /* whole header (in bytes) */ Int16 size_start; /* sizeof(Head_start_t) */ Int16 size_gen; /* sizeof(Head_gen_t) */ Int16 size_spec; /* sizeof(Head_spec_t) */ char reserved[10]; } MDC_INW_HEAD_START; /* current size: 24 */ #define MDC_INW_HEAD_START_SIZE 24 typedef struct Head_gen_t { Int16 no; /* number of planes */ Int16 sizeX; /* number of columns */ Int16 sizeY; /* number of rows */ Int16 pixel_type; /* sizeof(pixel) */ /* for compatibility only 2 is allowed */ Int16 init_trans; /* initial translation (mm) */ Int16 dummy1; /* for alignment reasons only */ /* Note: We take the positive axis into the gantry ! This means, if the patient lies with his head into the gantry, the head has higher translation offset than his feet */ char day[12]; /* day of first scan eg. 04-AUG-89 */ Int32 time; /* seconds after midnight */ /* first scan or time activity measured */ float decay_cst; /* NOT half_life ! (discards log(2)) */ /* decay_cst = half_life / log(2) */ float pixel_size; /* sampling distance (mm) */ float max; /* scaled maximum of all images */ float min; Int16 scanner; /* EcatII, EcatIV */ char reconstruction; /* reconFBP, reconMaxLik,... */ char recon_version; /* reconstruction version (0-99) */ char reserved[24]; } MDC_INW_HEAD_GEN; /* current size: 72 */ #define MDC_INW_HEAD_GEN_SIZE 72 typedef struct Head_spec_t { Int32 time; /* time relative to gen.time (secs) */ float cal_cst; /* abs_activ(uCU/ml) = cal_cst*pix_val */ /* cal_cst = calibr_cst * decay_comp */ /* decay_comp = exp(time/decay_cst) */ Int32 max; /* maximum in plane */ Int32 min; /* minimum in plane */ Int16 trans; /* translation relative to gen.trans mm */ char reserved[6]; } MDC_INW_HEAD_SPEC; /* current size: 24 */ #define MDC_INW_HEAD_SPEC_SIZE 24 /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcCheckINW(FILEINFO *fi); char *MdcReadINW(FILEINFO *fi); int MdcWriteHeadStart(FILEINFO *fi); int MdcWriteHeadGen(FILEINFO *fi); int MdcSkipHeadSpecs(FILEINFO *fi); int MdcWriteHeadSpecs(FILEINFO *fi); char *MdcWriteINW(FILEINFO *fi); #endif xmedcon-0.14.1/source/m-init.h0000644000175000017510000000367312636253502013037 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-init.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-init.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-init.h,v 1.13 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_SIGFPE_H__ #define __M_SIGFPE_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void MdcIgnoreSIGFPE(void); void MdcAcceptSIGFPE(void); void MdcSetLocale(void); void MdcUnsetLocale(void); void MdcInit(void); void MdcFinish(void); #endif xmedcon-0.14.1/source/m-global.h0000644000175000017510000001100112636253502013314 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-global.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-global.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-global.h,v 1.70 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_GLOBAL_H__ #define __M_GLOBAL_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ extern const char *MDC_MAJOR; extern const char *MDC_MINOR; extern const char *MDC_MICRO; extern const char *MDC_PRGR; extern const char *MDC_DATE; extern const char *MDC_VERSION; extern const char *MDC_LIBVERS; extern char mdcbufr[MDC_2KB_OFFSET+1]; extern char errmsg[MDC_1KB_OFFSET+1]; extern char prefix[MDC_MAX_PREFIX+1]; extern char *mdcbasename; extern char *mdc_arg_files[MDC_MAX_FILES]; extern int mdc_arg_convs[MDC_MAX_FRMTS]; extern int mdc_arg_total[2]; extern Int8 FrmtSupported[MDC_MAX_FRMTS]; extern char FrmtString[MDC_MAX_FRMTS][15]; extern char FrmtExt[MDC_MAX_FRMTS][8]; extern float mdc_si_slope; extern float mdc_si_intercept; extern float mdc_cw_centre; extern float mdc_cw_width; extern Uint32 mdc_mosaic_width; extern Uint32 mdc_mosaic_height; extern Uint32 mdc_mosaic_number; extern Int8 mdc_mosaic_interlaced; extern Uint32 mdc_crop_xoffset; extern Uint32 mdc_crop_yoffset; extern Uint32 mdc_crop_width; extern Uint32 mdc_crop_height; extern char MDC_INSTITUTION[MDC_MAXSTR]; extern Int8 MDC_COLOR_MODE; extern Int8 MDC_COLOR_MAP; extern Int8 MDC_PADDING_MODE; extern Int8 MDC_ANLZ_SPM, MDC_ANLZ_OPTIONS; extern Int8 MDC_DICOM_MOSAIC_ENABLED, MDC_DICOM_MOSAIC_FORCED; extern Int8 MDC_DICOM_MOSAIC_DO_INTERL, MDC_DICOM_MOSAIC_FIX_VOXEL; extern Int8 MDC_DICOM_WRITE_IMPLICIT, MDC_DICOM_WRITE_NOMETA; extern Int8 MDC_FORCE_RESCALE; extern Int8 MDC_FORCE_CONTRAST; extern Int8 MDC_HOST_ENDIAN, MDC_FILE_ENDIAN; extern Int8 MDC_BLOCK_MESSAGES; extern Int8 MDC_INFO, MDC_INTERACTIVE, MDC_CONVERT; extern Int8 MDC_EXTRACT, MDC_NEGATIVE; extern Int8 MDC_PIXELS, MDC_PIXELS_PRINT_ALL; extern Int8 MDC_QUANTIFY, MDC_CALIBRATE, MDC_DEBUG; extern Int8 MDC_CONTRAST_REMAP; extern Int8 MDC_GIF_OPTIONS; extern Int8 MDC_MAKE_GRAY, MDC_DITHER_COLOR; extern Int8 MDC_VERBOSE, MDC_RENAME; extern Int8 MDC_NORM_OVER_FRAMES; extern Int8 MDC_SKIP_PREVIEW, MDC_IGNORE_PATH, MDC_SINGLE_FILE; extern Int8 MDC_FORCE_INT; extern Int8 MDC_INT16_BITS_USED; extern Int8 MDC_TRUE_GAP; extern Int8 MDC_ALIAS_NAME; extern Int8 MDC_ECHO_ALIAS; extern Int8 MDC_PREFIX_DISABLED, MDC_PREFIX_ACQ, MDC_PREFIX_SER; extern Int8 MDC_RESLICE; extern Int8 MDC_PATIENT_ANON, MDC_PATIENT_IDENT; extern Int8 MDC_EDIT_FI; extern Int8 MDC_FILE_OVERWRITE; extern Int8 MDC_FILE_STDOUT; extern Int8 MDC_FILE_STDIN; extern Int8 MDC_FILE_SPLIT, MDC_FILE_STACK; extern Int8 MDC_FLIP_HORIZONTAL, MDC_FLIP_VERTICAL; extern Int8 MDC_SORT_REVERSE, MDC_SORT_CINE_APPLY, MDC_SORT_CINE_UNDO; extern Int8 MDC_MAKE_SQUARE, MDC_CROP_IMAGES; extern Int8 MDC_FRMT_INPUT; extern Int8 MDC_WRITE_ENDIAN; extern Int8 MDC_MY_DEBUG; extern Int8 MDC_INFO_DB; extern Int8 MDC_HACK_ACR; extern Int8 MDC_ECAT6_SORT; extern Int8 MDC_FALLBACK_FRMT; extern char *mdc_comments; extern Int8 XMDC_GUI, XMDC_WRITE_FRMT; #endif xmedcon-0.14.1/source/xwriter.h0000644000175000017510000000351112636253503013336 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xwriter.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xwriter.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xwriter.h,v 1.16 2015/12/22 13:59:31 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XWRITER_H__ #define __XWRITER_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ int XMdcWriteFile(int format_to_save); #endif xmedcon-0.14.1/source/m-gif.h0000644000175000017510000001062512636253502012634 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-gif.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-gif.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-gif.h,v 1.18 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_GIF_H__ #define __M_GIF_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_GIF_SIG "GIF" #define MDC_GIF89_SIG "GIF89a" #define GIF_DELAY 165 typedef struct MdcGifHeader_t { char sig[6]; Uint16 screenwidth,screenheight; Uint8 flags,background,aspect; } MDC_GIFHEADER; #define MDC_GIF_GH_SIZE 13 typedef struct MdcGifImageBlock_t { Uint16 left,top,width,height; Uint8 flags; } MDC_GIFIMAGEBLOCK; #define MDC_GIF_IBLK_SIZE 9 typedef struct MdcGifControlBlock_t { Uint8 blocksize; Uint8 flags; Uint16 delay; Uint8 transparent_colour; Uint8 terminator; } MDC_GIFCONTROLBLOCK; #define MDC_GIF_CBLK_SIZE 6 typedef struct MdcGifPlainText_t { Uint8 blocksize; Uint16 left,top; Uint16 gridwidth,gridheight; Uint8 cellwidth,cellheight; Uint8 forecolour,backcolour; } MDC_GIFPLAINTEXT; #define MDC_GIF_TBLK_SIZE 13 typedef struct MdcGifApplication_t { Uint8 blocksize; char applstring[8]; char authentication[3]; } MDC_GIFAPPLICATION; #define MDC_GIF_ABLK_SIZE 12 typedef struct MdcGifOpt_t { Uint8 loop, transp; /* 1 = YES or 0 = NO */ Uint8 bground_color; /* 0 ... 255 */ Uint8 transp_color; /* 0 ... 255 */ Uint16 delay; /* delay 1/100ths sec */ } MDC_GIFOPT; /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcCheckGIF(FILEINFO *fi); char *MdcReadGIF(FILEINFO *fi); void MdcDoExtension(FILEINFO *fi); int MdcReadGifHeader(FILE *fp, MDC_GIFHEADER *gh); int MdcReadGifImageBlk(FILE *fp, MDC_GIFIMAGEBLOCK *ib); int MdcReadGifControlBlk(FILE *fp, MDC_GIFCONTROLBLOCK *cb); int MdcReadGifPlainTextBlk(FILE *fp, MDC_GIFPLAINTEXT *pt); int MdcReadGifApplicationBlk(FILE *fp, MDC_GIFAPPLICATION *ap); char *MdcUnpackImage(FILEINFO *fi, Uint32 nr); void MdcPutGifLine(IMG_DATA *ri, Uint8 *p, Int16 n); char *MdcWriteGIF(FILEINFO *fi); void MdcGetGifOpt(FILEINFO *fi, MDC_GIFOPT *opt); int MdcWriteGifHeader(FILEINFO *fi, MDC_GIFOPT *opt); int MdcWriteControlBlock(FILEINFO *fi, MDC_GIFOPT *opt, Uint32 n); int MdcWriteImageBlock(FILEINFO *fi, Uint32 n); int MdcWriteImage(Uint8 *buffer, FILEINFO *fi, Uint32 n); int MdcWriteCommentBlock(FILEINFO *fi, const char *comment); int MdcWriteLoopBlock(FILEINFO *fi, const char *applstr, const char *auth); int MdcWriteApplicationBlock(FILEINFO *fi, const char *applstr, const char *auth); void MdcInitTable(Int16 min_code_size); void MdcFlush(FILE *fp, Int16 n); void MdcWriteCode(FILE *fp, Int16 code); #endif xmedcon-0.14.1/source/m-intf.c0000644000175000017510000031206412636253502013024 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-intf.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : read and write InterFile 3.3 * * * * project : (X)MedCon by Erik Nolf * * * * Functions : MdcCheckINTF() - Check for InterFile 3.3 format * * MdcGetIntfKey() - Get InterFile key * * MdcInitIntf() - Init InterFile struct (defaults) * * MdcIntfIsString() - String occurency test * * MdcIsArrayKey() - Check for array like keys {,,} * * MdcGetMaxIntArrayKey()- Get max integer from array key * * MdcGetIntKey() - Get key with integer * * MdcGetYesNoKey() - Get key Y or N * * MdcGetFloatKey() - Get key with float * * MdcGetStrKey() - Get key with string * * MdcGetSubStrKey() - Get string between separators * * MdcGetDateKey() - Get key with date format * * MdcGetSplitDateKey() - Get date in year, month, day * * MdcGetSplitTimeKey() - Get time in hour, minute, sec * * MdcGetDataType() - Get data type of pixels * * MdcGetProcessStatus() - Get process status * * MdcGetPatRotation() - Get patient rotation * * MdcGetPatOrientation()- Get patient orientation * * MdcGetSliceOrient() - Get slice orient * * MdcGetPatSlOrient() - Get patient slice orientation * * MdcGetPixelType() - Get pixel data type * * MdcGetRotation() - Get rotation direction * * MdcGetMotion() - Get detector motion * * MdcGetGSpectNesting() - Get Gated SPECT nesting * * MdcSpecifyPixelType() - Specify pixel data type (bytes) * * MdcHandleIntfDialect()- Handle InterFile dialect headers * * MdcReadIntfHeader() - Read InterFile header * * MdcReadIntfImages() - Read InterFile images * * MdcReadINTF() - Read InterFile file * * MdcType2Intf() - Translate data type to InterFile * * MdcGetProgramDate() - Get date in correct format * * MdcCheckIntfDim() - Check supported dimensions * * MdcSetPatRotation() - Set patient rotation string * * MdcSetPatOrientation()- Set patient orientation string * * MdcWriteGenImgData() - Write general image data * * MdcWriteWindows() - Write energy windows * * MdcWriteMatrixInfo() - Write matrix info * * MdcWriteIntfStatic() - Write a Static header * * MdcWriteIntfDynamic() - Write a Dynamic header * * MdcWriteIntfTomo() - Write a Tomographic header * * MdcWriteIntfGated() - Write a Gated header * * MdcWriteIntfGSPECT() - Write a GSPECT header * * MdcWriteIntfHeader() - Write InterFile header * * MdcWriteIntfImages() - Write InterFile images * * MdcWriteINTF() - Write InterFile file * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-intf.c,v 1.141 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #ifdef HAVE_UNISTD_H #include #endif #include "medcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_IGNORE_DATA_ENCODE 1 /* 0/1 - ignore "data encode" key */ #define MDC_IGNORE_DATA_COMPRESS 1 /* 0/1 - ignore "data compression" key */ #define MDC_INTF_SUPPORT_DIALECT 1 /* 0/1 - support dialect interfile */ #define MDC_INTF_SUPPORT_SCALE 1 /* 0/1 - support global scale factor */ #define MDC_INTF_SUPPORT_NUD 1 /* 0/1 - support NUD extended keys */ #define MdcThisString(x) MdcIntfIsString(x,0) #define MdcThisKey(x) MdcIntfIsString(x,1) #define MDC_INTF_DATA_OFFSET 5120 static char keystr[MDC_INTF_MAXKEYCHARS+1]; /* all lower case */ static char keystr_check[MDC_INTF_MAXKEYCHARS+1]; /* all lower, no spaces */ static char keystr_case[MDC_INTF_MAXKEYCHARS+1]; /* original key string */ static Uint32 ACQI = 0; /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcCheckINTF(FILEINFO *fi) { if (MdcGetIntfKey(fi->ifp) != MDC_OK) return(MDC_BAD_READ); if (strstr(keystr_check,MDC_INTF_SIG) == NULL) return(MDC_FRMT_NONE); return(MDC_FRMT_INTF); } /* three key string types to retrieve: */ /* 1. original key string */ /* 2. case insensitive */ /* 3. case insensitive and without spaces */ int MdcGetIntfKey(FILE *fp) { char *c, *pkeyval = NULL; /* assure string termination */ memset(keystr,'\0',MDC_INTF_MAXKEYCHARS+1); if (fgets(keystr,MDC_INTF_MAXKEYCHARS,fp) == NULL) return(MDC_BAD_READ); /* remove any comment from the key line*/ c = strchr(keystr,';'); if (c != NULL) c[0]='\0'; /* check for valid and safe interfile key */ if (strstr(keystr,":=") == NULL) strcat(keystr,":=\n"); /* [1] preserve original key string, without comments */ memcpy(keystr_case,keystr,MDC_INTF_MAXKEYCHARS+1); /* remove spaces from key value */ pkeyval = strstr(keystr,":=") + 2; MdcKillSpaces(pkeyval); /* [2] preserve case insensitive key string */ MdcLowStr(keystr); /* [3] case insensitive and without spaces */ strcpy(keystr_check,keystr); MdcRemoveAllSpaces(keystr_check); return MDC_OK; } void MdcInitIntf(MDC_INTERFILE *intf) { intf->DIALECT = MDC_NO; intf->dim_num = 0; intf->dim_found = 0; intf->data_type = MDC_INTF_STATIC; intf->process_status = MDC_INTF_UNKNOWN; intf->pixel_type = BIT8_U; intf->width = 0; intf->height = 0; intf->images_per_dimension = 1; intf->time_slots = 0; intf->data_offset = 0; intf->data_blocks = 0; intf->imagesize = 0; intf->number_images = 0; intf->energy_windows = intf->frame_groups = 1; intf->time_windows = intf->detector_heads = 1; intf->pixel_xsize = 1.; intf->pixel_ysize = 1.; intf->slice_thickness=1.; intf->slice_thickness_mm=1.; intf->centre_centre_separation=1.; intf->study_duration=0.; intf->image_duration = 0.; intf->image_pause = 0.; intf->group_pause = 0.; intf->ext_rot = 0.; intf->procent_cycles_acquired = 100.; /* default: acquired = observed */ intf->rescale_slope = 1.; intf->rescale_intercept = 0.; intf->patient_rot = MDC_SUPINE; intf->patient_orient = MDC_HEADFIRST; intf->slice_orient = MDC_TRANSAXIAL; } int MdcIsEmptyKeyValue(void) { char *pkeyval = NULL; pkeyval = strstr(keystr_check,":=") + 2; if (pkeyval[0] == '\0') return(MDC_YES); return(MDC_NO); } int MdcIntfIsString(char *string, int key) { char check[MDC_INTF_MAXKEYCHARS+1]; strcpy(check,string); if (key) strcat(check,":="); /* add key delimiter */ MdcRemoveAllSpaces(check); MdcLowStr(check); if( strstr(keystr_check,check) != NULL) return MDC_YES; return MDC_NO; } int MdcIsArrayKey(void) { char *pkeyval; pkeyval = strstr(keystr_check,":=") + 2; pkeyval = strchr(pkeyval,'{'); if (pkeyval != NULL) return(MDC_YES); return(MDC_NO); } int MdcGetMaxIntArrayKey(void) { char *pkeyval; int value, max=0; pkeyval = strstr(keystr,":=") + 2; if (pkeyval == NULL) return(max); pkeyval = strchr(pkeyval,'{'); while (pkeyval != NULL ) { pkeyval++; value = atoi(pkeyval); if (value > max) max = value; pkeyval = strchr(pkeyval,','); } return(max); } int MdcGetIntKey(void) { return(atoi(strstr(keystr,":=") + 2)); } int MdcGetYesNoKey(void) { strcpy(mdcbufr,(strstr(keystr,":=") + 2)); MdcKillSpaces(mdcbufr); if (mdcbufr[0] == 'y') return MDC_YES; if (mdcbufr[0] == 'n') return MDC_NO; return(MDC_NO); } double MdcGetFloatKey(void) { double d; d = (double)atof(strstr(keystr,":=") + 2); return(d); } void MdcGetStrKey(char *str) { memcpy(str,(strstr(keystr_case,":=") + 2),MDC_MAXSTR-1); str[MDC_MAXSTR-1] = '\0'; MdcKillSpaces(str); } void MdcGetSubStrKey(char *str, int n) { char *pkey; pkey = strstr(keystr_case,":=") + 2; MdcGetSubStr(str,pkey,MDC_MAXSTR,'/',n); } void MdcGetDateKey(char *str) { int i, t; memcpy(str,(strstr(keystr_case,":=") + 2),MDC_MAXSTR-1); str[MDC_MAXSTR-1] = '\0'; MdcKillSpaces(str); /* fix into YYYYMMDD format */ for (t=0,i=0; i < strlen(str); i++) { if (str[i] != ':') str[t++] = str[i]; } str[t]='\0'; } void MdcGetSplitDateKey(Int16 *year, Int16 *month, Int16 *day) { sscanf((char *)(strstr(keystr,":=")+2),"%4hd:%2hd:%2hd",year,month,day); } void MdcGetSplitTimeKey(Int16 *hour, Int16 *minute, Int16 *second) { sscanf((char *)(strstr(keystr,":=")+2),"%2hd:%2hd:%2hd",hour,minute,second); } int MdcGetDataType(void) { if (MdcThisString("gatedtomo")) return MDC_INTF_GSPECT; /* IS2 dialect, check before planar "gated" ;-) */ if (MdcThisString("static")) return MDC_INTF_STATIC; if (MdcThisString("dynamic")) return MDC_INTF_DYNAMIC; if (MdcThisString("gated")) return MDC_INTF_GATED; if (MdcThisString("tomographic")) return MDC_INTF_TOMOGRAPH; if (MdcThisString("curve")) return MDC_INTF_CURVE; if (MdcThisString("roi")) return MDC_INTF_ROI; if (MdcThisString("gspect")) return MDC_INTF_GSPECT; if (MdcThisString("pet")) return MDC_INTF_DIALECT_PET; return MDC_INTF_UNKNOWN; } int MdcGetProcessStatus(void) { if (MdcThisString("acquired")) return MDC_INTF_ACQUIRED; if (MdcThisString("reconstructed")) return MDC_INTF_RECONSTRUCTED; return MDC_INTF_UNKNOWN; } int MdcGetPatRotation(void) { if (MdcThisString("supine")) return MDC_SUPINE; if (MdcThisString("prone")) return MDC_PRONE; return MDC_UNKNOWN; } int MdcGetPatOrientation(void) { if (MdcThisString("head")) return MDC_HEADFIRST; if (MdcThisString("feet")) return MDC_FEETFIRST; return MDC_UNKNOWN; } int MdcGetSliceOrient(void) { if (MdcThisString("transverse")) return MDC_TRANSAXIAL; if (MdcThisString("sagittal")) return MDC_SAGITTAL; if (MdcThisString("coronal")) return MDC_CORONAL; return MDC_UNKNOWN; } int MdcGetPatSlOrient(MDC_INTERFILE *intf) { switch (intf->patient_rot) { case MDC_SUPINE: switch (intf->patient_orient) { case MDC_HEADFIRST: switch (intf->slice_orient) { case MDC_TRANSAXIAL: return(MDC_SUPINE_HEADFIRST_TRANSAXIAL); break; case MDC_SAGITTAL : return(MDC_SUPINE_HEADFIRST_SAGITTAL); break; case MDC_CORONAL : return(MDC_SUPINE_HEADFIRST_CORONAL); break; } break; case MDC_FEETFIRST: switch(intf->slice_orient) { case MDC_TRANSAXIAL: return(MDC_SUPINE_FEETFIRST_TRANSAXIAL); break; case MDC_SAGITTAL : return(MDC_SUPINE_FEETFIRST_SAGITTAL); break; case MDC_CORONAL : return(MDC_SUPINE_FEETFIRST_CORONAL); break; } break; } break; case MDC_PRONE : switch (intf->patient_orient) { case MDC_HEADFIRST: switch (intf->slice_orient) { case MDC_TRANSAXIAL: return(MDC_PRONE_HEADFIRST_TRANSAXIAL); break; case MDC_SAGITTAL : return(MDC_PRONE_HEADFIRST_SAGITTAL); break; case MDC_CORONAL : return(MDC_PRONE_HEADFIRST_CORONAL); break; } break; case MDC_FEETFIRST: switch (intf->slice_orient) { case MDC_TRANSAXIAL: return(MDC_PRONE_FEETFIRST_TRANSAXIAL); break; case MDC_SAGITTAL : return(MDC_PRONE_FEETFIRST_SAGITTAL); break; case MDC_CORONAL : return(MDC_PRONE_FEETFIRST_CORONAL); break; } break; } break; } return(MDC_SUPINE_HEADFIRST_TRANSAXIAL); /* default for InterFile (!) */ } int MdcGetPixelType(void) { if (MdcThisString("unsigned integer")) return BIT8_U; if (MdcThisString("signed integer")) return BIT8_S; if (MdcThisString("long float")) return FLT64; if (MdcThisString("short float")) return FLT32; if (MdcThisString("float")) return FLT32; if (MdcThisString("bit")) return BIT1; if (MdcThisString("ascii")) return ASCII; return BIT8_U; } int MdcGetRotation(void) { if (MdcThisString("ccw")) return(MDC_ROTATION_CC); if (MdcThisString("cw")) return(MDC_ROTATION_CW); return(MDC_UNKNOWN); } int MdcGetMotion(void) { if (MdcThisString("step")) return(MDC_MOTION_STEP); if (MdcThisString("continuous")) return(MDC_MOTION_CONT); return(MDC_UNKNOWN); } int MdcGetGSpectNesting(void) { /* can not use MdcThisString() because "SPECT" */ /* can be mentioned in key as well as in value */ char *pkeyval; if ( (pkeyval = strstr(keystr,":=")) != NULL ) { if (strstr(pkeyval,"spect") != NULL) return(MDC_GSPECT_NESTING_SPECT); if (strstr(pkeyval,"gated") != NULL) return(MDC_GSPECT_NESTING_GATED); } return(MDC_GSPECT_NESTING_GATED); } int MdcSpecifyPixelType(MDC_INTERFILE *intf) { int bytes; bytes = MdcGetIntKey(); if (intf->pixel_type == BIT8_S) switch (bytes) { case 1: break; case 2: intf->pixel_type = BIT16_S; break; case 4: intf->pixel_type = BIT32_S; break; case 8: intf->pixel_type = BIT64_S; break; default: intf->pixel_type = 0; }else if (intf->pixel_type == BIT8_U) switch (bytes) { case 1: break; case 2: intf->pixel_type = BIT16_U; break; case 4: intf->pixel_type = BIT32_U; break; case 8: intf->pixel_type = BIT64_U; break; default: intf->pixel_type = 0; } return intf->pixel_type; } char *MdcHandleIntfDialect(FILEINFO *fi, MDC_INTERFILE *intf) { int d, number=1; /* increment number of dimensions found */ intf->dim_found += 1; /* with "total number of images" key present -> already allocated */ /* if ((fi->number != 0) && (fi->image != NULL)) return(NULL); */ if (intf->dim_num == intf->dim_found) { for (d=3; d<=intf->dim_num; d++) number *= fi->dim[d]; if (number == 0) return("INTF Bad matrix size values (dialect)"); if (!MdcGetStructID(fi,(Uint32)number)) return("INTF Bad malloc IMG_DATA structs (dialect)"); } return NULL; } char *MdcReadIntfHeader(FILEINFO *fi, MDC_INTERFILE *intf) { DYNAMIC_DATA *dd=NULL; GATED_DATA *gd=NULL; STATIC_DATA *sd=NULL; ACQ_DATA *acq=NULL; IMG_DATA *id; FILE *fp = fi->ifp; Uint32 i, counter=0, total=0, img=0, uv, number=0, acqnr=0; char *err=NULL, *pfname=NULL; float v; int matrix_size_4=MDC_FALSE; if (MDC_INFO) { MdcPrintLine('-',MDC_HALF_LENGTH); MdcPrntScrn("InterFile Header\n"); MdcPrintLine('-',MDC_HALF_LENGTH); } while (!feof(fp)) { if (MdcGetIntfKey(fp) != MDC_OK) return("INTF Bad read of key"); if (err != NULL) return(err); if (MDC_INFO) { MdcPrntScrn("%s",keystr_case); } if (ferror(fp)) return("INTF Bad read header file"); if (MdcThisString(";")) continue; if (MdcThisKey("version of keys")) { if (strstr(keystr_case,MDC_INTF_SUPP_VERS) == NULL) MdcPrntWarn("INTF Unexpected version of keys found"); continue; } #if ! (MDC_IGNORE_DATA_COMPRESS) if (MdcThisKey("data compression")) { if (! (MdcThisString("none") || MdcIsEmptyKeyValue()) ) return("INTF Don't handle compressed images"); } #endif #if ! (MDC_IGNORE_DATA_ENCODE) if (MdcThisKey("data encode")) { if (! (MdcThisString("none") || MdcIsEmptyKeyValue()) ) return("INTF Don't handle encoded images"); } #endif if (MdcThisKey("organ")) { MdcGetStrKey(fi->organ_code); continue; } if (MdcThisKey("isotope")) { MdcGetSubStrKey(fi->isotope_code,1); MdcGetSubStrKey(fi->radiopharma,2); continue; } if (MdcThisKey("dose")) { fi->injected_dose = (float)MdcGetFloatKey(); continue; } #if MDC_INTF_SUPPORT_NUD if (MdcThisKey("patient weight [kg]")) { fi->patient_weight = (float)MdcGetFloatKey(); continue; } if (MdcThisKey("imaging modality")) { MdcGetStrKey(mdcbufr); fi->modality = MdcGetIntModality(mdcbufr); continue; } if (MdcThisKey("activity")) { fi->injected_dose = MdcGetFloatKey(); continue; } if (MdcThisKey("activity start time")) { MdcGetSplitTimeKey(&fi->dose_time_hour ,&fi->dose_time_minute ,&fi->dose_time_second); continue; } if (MdcThisKey("isotope half life [hours]")) { fi->isotope_halflife = (float)MdcGetFloatKey() * 3600.; continue; } #endif if (MdcThisKey("original institution")) { if (MdcIsEmptyKeyValue() == MDC_NO) MdcGetStrKey(fi->institution); continue; } if (MdcThisKey("originating system")) { if (MdcIsEmptyKeyValue() == MDC_NO) MdcGetStrKey(fi->manufacturer); continue; } if (MdcThisKey("data starting block")) { intf->data_offset = MdcGetIntKey() * 2048L; continue; } if (MdcThisKey("data offset in bytes")) { intf->data_offset = MdcGetIntKey(); continue; } if (MdcThisKey("name of data file")) { pfname = strstr(keystr_case,":=") + 2; MdcKillSpaces(pfname); /* protect against empty key */ if ( strlen(pfname) > 0 ) { fi->ifname = (MDC_IGNORE_PATH==MDC_YES) ? MdcGetFname(pfname) : pfname; if ((MDC_IGNORE_PATH == MDC_NO) && (MdcThisString("/") || MdcThisString("\\"))) { /* use absolute path mentioned in header file */ strcpy(fi->ipath,fi->ifname); }else{ /* use relative path where header was loaded */ if (fi->idir != NULL) { /* assume fi->idir = fi->ipath */ strcat(fi->ipath,"/"); strcat(fi->ipath,fi->ifname); }else{ strcpy(fi->ipath,fi->ifname); } } MdcSplitPath(fi->ipath,fi->idir,fi->ifname); } continue; } if (MdcThisKey("patient name")) { MdcGetStrKey(fi->patient_name); continue; } if (MdcThisKey("patient id")) { MdcGetStrKey(fi->patient_id); continue; } if (MdcThisKey("patient dob")) { MdcGetDateKey(fi->patient_dob); continue; } if (MdcThisKey("patient sex")) { MdcGetStrKey(fi->patient_sex); continue; } if (MdcThisKey("study id")) { MdcGetStrKey(fi->study_id); continue; } if (MdcThisKey("exam type")) { MdcGetStrKey(fi->series_descr); continue; } if (MdcThisKey("total number of images")) { number = MdcGetIntKey(); if (number == 0) return("INTF No valid images specified"); if (!MdcGetStructID(fi,number)) return("INTF Bad malloc IMG_DATA structs"); continue; } if (MdcThisKey("imagedata byte order")) { if (MdcThisString("bigendian")) MDC_FILE_ENDIAN = MDC_BIG_ENDIAN; else if (MdcThisString("littleendian")) MDC_FILE_ENDIAN = MDC_LITTLE_ENDIAN; else MDC_FILE_ENDIAN = MDC_BIG_ENDIAN; fi->endian = MDC_FILE_ENDIAN; if (intf->DIALECT == MDC_NO) continue; /* linked with end of interfile */ } if (MdcThisKey("process label")) { MdcGetStrKey(fi->study_descr); continue; } if (MdcThisKey("type of data")) { intf->data_type = MdcGetDataType(); if (intf->data_type == MDC_INTF_UNKNOWN) intf->data_type = MDC_INTF_STATIC; /* take this as default */ switch (intf->data_type) { case MDC_INTF_DYNAMIC : fi->acquisition_type = MDC_ACQUISITION_DYNAMIC; fi->planar = MDC_YES; break; case MDC_INTF_TOMOGRAPH : fi->acquisition_type = MDC_ACQUISITION_TOMO; break; case MDC_INTF_GATED : fi->acquisition_type = MDC_ACQUISITION_GATED; fi->planar = MDC_YES; break; case MDC_INTF_GSPECT : fi->acquisition_type = MDC_ACQUISITION_GSPECT; break; case MDC_INTF_DIALECT_PET: fi->acquisition_type = MDC_ACQUISITION_TOMO; break; case MDC_INTF_CURVE : /* default = Static */ case MDC_INTF_ROI : /* default = Static */ case MDC_INTF_STATIC : /* default = Static */ default : fi->acquisition_type = MDC_ACQUISITION_STATIC; fi->planar = MDC_YES; } if (fi->acquisition_type == MDC_ACQUISITION_GATED || fi->acquisition_type == MDC_ACQUISITION_GSPECT ) { /* MARK: limited to one AND no info on recon yet*/ if (!MdcGetStructGD(fi,1)) { return("INTF Bad malloc GATED_DATA structs"); }else{ gd = &fi->gdata[0]; } } continue; } if (MdcThisKey("study date")) { MdcGetSplitDateKey(&fi->study_date_year ,&fi->study_date_month ,&fi->study_date_day); continue; } if (MdcThisKey("study time")) { MdcGetSplitTimeKey(&fi->study_time_hour ,&fi->study_time_minute ,&fi->study_time_second); continue; } if (MdcThisKey("number of energy windows")) { intf->energy_windows = MdcGetIntKey(); continue; } if (MdcThisKey("flood corrected")) { fi->flood_corrected = MdcGetYesNoKey(); continue; } if (MdcThisKey("decay corrected")) { fi->decay_corrected = MdcGetYesNoKey(); continue; } /* read some keys without making a distinction in type of data, thus */ /* allowing some great flexibility in reading interfile images */ /* ==>> pixel/voxel/slice dimensions */ if (MdcThisKey("matrix size [1]")) { intf->width = MdcGetIntKey(); if (intf->DIALECT == MDC_YES) { err = MdcHandleIntfDialect(fi,intf); if (err != NULL) return(err); }else{ for (i=img; inumber; i++) { /* fill the rest too */ fi->image[i].width = intf->width; } } continue; } if (MdcThisKey("matrix size [2]")) { intf->height = MdcGetIntKey(); if (intf->DIALECT == MDC_YES) { err = MdcHandleIntfDialect(fi,intf); if (err != NULL) return(err); }else{ for (i=img; inumber; i++) { /* fill the rest too */ fi->image[i].height = intf->height; } } continue; } #if MDC_INTF_SUPPORT_DIALECT if (MdcThisKey("number of dimensions")) { intf->DIALECT = MDC_YES; intf->dim_num = MdcGetIntKey(); if (intf->dim_num >= MDC_MAX_DIMS) return("INTF Maximum dimensions exceeded"); fi->dim[0] = (Uint32) intf->dim_num; continue; } if (MdcThisKey("matrix size [3]")) { fi->acquisition_type = MDC_ACQUISITION_TOMO; if (MdcIsArrayKey()) { fi->dim[3] = (Int16)MdcGetMaxIntArrayKey(); /* only symmetric */ }else{ fi->dim[3] = (Int16)MdcGetIntKey(); } intf->number_images = fi->dim[3]; intf->images_per_dimension = intf->number_images; err = MdcHandleIntfDialect(fi,intf); if (err != NULL) return(err); continue; } if (MdcThisKey("matrix size [4]")) { matrix_size_4=MDC_TRUE; fi->acquisition_type = MDC_ACQUISITION_DYNAMIC; if (MdcIsArrayKey()) { fi->dim[4] = (Int16)MdcGetMaxIntArrayKey(); /* only symmetric */ }else{ fi->dim[4] = (Int16)MdcGetIntKey(); } intf->number_images = fi->dim[4]; err = MdcHandleIntfDialect(fi,intf); if (err != NULL) return(err); continue; } if (MdcThisKey("number of time frames")) { if (matrix_size_4 == MDC_FALSE) { /* prefer "matrix size [4]" if found */ fi->acquisition_type = MDC_ACQUISITION_DYNAMIC; fi->dim[4] = (Int16)MdcGetIntKey(); intf->number_images = fi->dim[4]; intf->dim_num = 4; fi->dim[0] = (Uint32) intf->dim_num; err = MdcHandleIntfDialect(fi,intf); if (err != NULL) return(err); if (!MdcGetStructDD(fi,fi->dim[4])) return("INTF Bad malloc DYNAMIC_DATA structs"); } continue; } if (MdcThisKey("matrix size [5]")) { fi->acquisition_type = MDC_ACQUISITION_DYNAMIC; if (MdcIsArrayKey()) { fi->dim[5] = (Int16)MdcGetMaxIntArrayKey(); /* only symmetric */ }else{ fi->dim[5] = (Int16)MdcGetIntKey(); } intf->number_images = fi->dim[5]; err = MdcHandleIntfDialect(fi,intf); if (err != NULL) return(err); continue; } if (MdcThisKey("matrix size [6]")) { fi->acquisition_type = MDC_ACQUISITION_DYNAMIC; if (MdcIsArrayKey()) { fi->dim[6] = (Int16)MdcGetMaxIntArrayKey(); /* only symmetric */ }else{ fi->dim[6] = (Int16)MdcGetIntKey(); } intf->number_images = fi->dim[6]; err = MdcHandleIntfDialect(fi,intf); if (err != NULL) return(err); continue; } if (MdcThisKey("matrix size [7]")) { fi->acquisition_type = MDC_ACQUISITION_DYNAMIC; if (MdcIsArrayKey()) { fi->dim[7] = (Int16)MdcGetMaxIntArrayKey(); /* only symmetric */ }else{ fi->dim[7] = (Int16)MdcGetIntKey(); } intf->number_images = fi->dim[7]; err = MdcHandleIntfDialect(fi,intf); if (err != NULL) return(err); continue; } #endif if (MdcThisKey("number format")) { intf->pixel_type = MdcGetPixelType(); for (i=img; inumber; i++) { /* fill the rest too */ fi->image[i].type = intf->pixel_type; fi->image[i].bits = MdcType2Bits(fi->image[i].type); } continue; } if (MdcThisKey("number of bytes per pixel")) { intf->pixel_type = MdcSpecifyPixelType(intf); for (i=img; inumber; i++) { /* fill the rest too */ fi->image[i].type = intf->pixel_type; fi->image[i].bits = MdcType2Bits(fi->image[i].type); } continue; } if (MdcThisKey("scaling factor (mm/pixel) [1]")) { intf->pixel_xsize = (float)MdcGetFloatKey(); continue; } if (MdcThisKey("scaling factor (mm/pixel) [2]")) { intf->pixel_ysize = (float)MdcGetFloatKey(); continue; } #if MDC_INTF_SUPPORT_DIALECT if (MdcThisKey("scaling factor (mm/pixel) [3]")) { intf->slice_thickness_mm = (float)MdcGetFloatKey(); fi->pixdim[0] = 3.; fi->pixdim[3] = intf->slice_thickness_mm; continue; } #endif if (MdcThisKey("slice thickness (pixels)")) { intf->slice_thickness = MdcGetFloatKey(); continue; } if (MdcThisKey("centre-centre slice separation (pixels)")) { intf->centre_centre_separation = MdcGetFloatKey(); continue; } if (MdcThisKey("center-center slice separation (pixels)")) { intf->centre_centre_separation = MdcGetFloatKey(); continue; } /* ==>> slice/patient orientations */ if (MdcThisKey("slice orientation")) { intf->slice_orient = MdcGetSliceOrient(); continue; } if (MdcThisKey("patient rotation")) { intf->patient_rot = MdcGetPatRotation(); continue; } if (MdcThisKey("patient orientation")) { intf->patient_orient = MdcGetPatOrientation(); continue; } #if MDC_INTF_SUPPORT_SCALE /* some global scale factors */ if (MdcThisKey("quantification units")) { /* mediman */ v = (float)MdcGetFloatKey(); if (v != 0.0) intf->rescale_slope = v; continue; } if (MdcThisKey("rescale slope")) { /* NUD */ v = (float)MdcGetFloatKey(); if (v != 0.0) intf->rescale_slope = v; continue; } if (MdcThisKey("rescale intercept")) { /* NUD */ v = (float)MdcGetFloatKey(); if (v != 0.0) intf->rescale_intercept = v; continue; } #endif /* now make a distinction between each type of data */ switch (intf->data_type) { case MDC_INTF_STATIC: case MDC_INTF_ROI: if (img < fi->number) sd = fi->image[img].sdata; if (MdcThisKey("static study (general)")) { if (!MdcGetStructSD(fi,fi->number)) return("INTF Couldn't malloc STATIC_DATA structs"); continue; } if (MdcThisKey("image number")) { img = MdcGetIntKey() - 1; continue; } if (MdcThisKey("number of images/energy window")) { intf->number_images = MdcGetIntKey(); intf->images_per_dimension = intf->number_images; continue; } /* place to store static data info */ if (sd != NULL) { if (MdcThisKey("label")) { MdcGetStrKey(sd->label); continue; } if (MdcThisKey("image duration (sec)")) { sd->image_duration = (float)MdcGetFloatKey() * 1000.; continue; } if (MdcThisKey("image start time")) { MdcGetSplitTimeKey(&sd->start_time_hour ,&sd->start_time_minute ,&sd->start_time_second); continue; } } if ( MdcThisKey("static study (each frame)") || MdcThisKey("end of interfile")) if (img < fi->number) { id = &fi->image[img]; id->type = intf->pixel_type; id->bits = MdcType2Bits(id->type); id->width = intf->width; id->height = intf->height; id->pixel_xsize = intf->pixel_xsize; id->pixel_ysize = intf->pixel_ysize; } break; case MDC_INTF_DIALECT_PET: /* probably GE vendor specific */ if (MdcThisString("image duration (sec)")) { intf->image_duration=MdcGetFloatKey() * 1000.; if ((fi->dyndata != NULL) && (counter < fi->dim[4])) { dd = &(fi->dyndata[counter]); counter++; if (dd != NULL) { dd->time_frame_duration = intf->image_duration; dd->nr_of_slices = fi->dim[3]; } } continue; } /* write info to all images in frame group # */ if ( MdcThisKey("frame group number") || MdcThisKey("end of interfile")) if ((counter > 0) && (counter <= total) && (img < fi->number)) { for (i=0; inumber_images; i++, img++) { if (i == fi->number) break; id = &fi->image[img]; id->type = intf->pixel_type; id->bits = MdcType2Bits(id->type); id->width = intf->width; id->height = intf->height; id->pixel_xsize = intf->pixel_xsize; id->pixel_ysize = intf->pixel_ysize; } intf->number_images=0; /* fill the rest too */ for (i=img; inumber; i++) { id = &fi->image[i]; id->type = intf->pixel_type; id->bits = MdcType2Bits(id->type); id->width = intf->width; id->height = intf->height; id->pixel_xsize = intf->pixel_xsize; id->pixel_ysize = intf->pixel_ysize; } /* fix some DIALECT settings */ if (intf->DIALECT == MDC_YES) { fi->planar = MDC_NO; if (dd != NULL) dd->nr_of_slices = intf->images_per_dimension; } } break; case MDC_INTF_DYNAMIC: if (MdcThisKey("number of frame groups")) { intf->frame_groups = MdcGetIntKey(); total = intf->frame_groups * intf->energy_windows; if (total == 0) { MdcPrntWarn("INTF Found zero frame groups (fixed = 1)"); total = 1; } if (!MdcGetStructDD(fi,total)) return("INTF Bad malloc DYNAMIC_DATA structs"); continue; } if (MdcThisKey("frame group number")) { counter = MdcGetIntKey(); if ((counter > 0)&&(counter <= fi->dynnr)&&(fi->dyndata != NULL)) dd = &fi->dyndata[counter - 1]; }else{ if (MdcThisKey("number of images this frame group")) { intf->number_images = MdcGetIntKey(); if (intf->DIALECT == MDC_NO) intf->images_per_dimension = intf->number_images; if (dd != NULL) dd->nr_of_slices = intf->number_images; continue; } if (MdcThisKey("image duration (sec)")) { intf->image_duration=MdcGetFloatKey() * 1000.; if (dd != NULL) { float duration; duration = intf->image_duration * dd->nr_of_slices; dd->time_frame_duration += duration; } continue; } if (MdcThisKey("pause between images (sec)")) { intf->image_pause=MdcGetFloatKey() * 1000.; if (dd != NULL) { dd->delay_slices = intf->image_pause; dd->time_frame_duration += dd->delay_slices*(dd->nr_of_slices-1); } continue; } if (MdcThisKey("pause between frame groups (sec)")) { intf->group_pause=MdcGetFloatKey() * 1000.; if (dd != NULL) { dd->time_frame_delay = intf->group_pause; } continue; } } /* write info to all images in frame group # */ if ( MdcThisKey("frame group number") || MdcThisKey("end of interfile")) if ((counter > 0) && (counter <= total) && (img < fi->number)) { for (i=0; inumber_images; i++, img++) { if (i == fi->number) break; id = &fi->image[img]; id->type = intf->pixel_type; id->bits = MdcType2Bits(id->type); id->width = intf->width; id->height = intf->height; id->pixel_xsize = intf->pixel_xsize; id->pixel_ysize = intf->pixel_ysize; } intf->number_images=0; /* fill the rest too */ for (i=img; inumber; i++) { id = &fi->image[i]; id->type = intf->pixel_type; id->bits = MdcType2Bits(id->type); id->width = intf->width; id->height = intf->height; id->pixel_xsize = intf->pixel_xsize; id->pixel_ysize = intf->pixel_ysize; } /* fix some DIALECT settings */ if (intf->DIALECT == MDC_YES) { fi->planar = MDC_NO; if (dd != NULL) dd->nr_of_slices = intf->images_per_dimension; } } break; case MDC_INTF_GATED: if (MdcThisKey("study duration (acquired) sec")) { gd->study_duration = (float)MdcGetFloatKey() * 1000.; continue; } if (MdcThisKey("number of cardiac cycles (observed)")) { /* MARK: for entire energy window */ gd->cycles_observed = MdcGetFloatKey(); continue; } if (MdcThisKey("number of time windows")) { intf->time_windows = MdcGetIntKey(); total = intf->time_windows * intf->energy_windows; continue; } if (MdcThisKey("time window number")) { counter = MdcGetIntKey(); }else{ if (MdcThisKey("number of images in time window")) { intf->number_images = MdcGetIntKey(); intf->images_per_dimension = intf->number_images; continue; } if (gd!=NULL && MdcThisKey("image duration (sec)")) { gd->image_duration = (float)MdcGetFloatKey() * 1000.; continue; } if (gd!=NULL && MdcThisKey("time window lower limit (sec)")) { gd->window_low = (float)MdcGetFloatKey() * 1000.; continue; } if (gd!=NULL && MdcThisKey("time window upper limit (sec)")) { gd->window_high = (float)MdcGetFloatKey() * 1000.; continue; } if (gd!=NULL && MdcThisKey("R-R cycles acquired this window")) { v = (float)MdcGetFloatKey(); if (v > 100. || v <= 0.) v = 100.; intf->procent_cycles_acquired = v; /* calculate observed */ v = (gd->cycles_acquired * 100.) / intf->procent_cycles_acquired; uv = (Uint32)v; v = (float)uv; /* simply chop to integer */ if ((v > gd->cycles_acquired) || (gd->cycles_observed == 0.)) { gd->cycles_observed = v; } continue; } if (gd!=NULL && MdcThisKey("number of cardiac cycles (acquired)")) { gd->cycles_acquired = (float)MdcGetFloatKey(); /* calculate observed */ v = (gd->cycles_acquired * 100.) / intf->procent_cycles_acquired; uv = (Uint32)v; v = (float)uv; /* simply chop to integer */ if ((v > gd->cycles_acquired) || (gd->cycles_observed == 0.)) { gd->cycles_observed = v; } continue; } } if ( MdcThisKey("time window number") || MdcThisKey("end of interfile")) if ((counter > 0) && (counter <= total) && (img < fi->number)) { for (i=0; inumber_images; i++, img++) { if (i == fi->number) break; id = &fi->image[img]; id->type = intf->pixel_type; id->bits = MdcType2Bits(id->type); id->width = intf->width; id->height = intf->height; id->pixel_xsize = intf->pixel_xsize; id->pixel_ysize = intf->pixel_ysize; } intf->number_images=0; /* fill in the rest too */ for (i=img; inumber; i++) { id = &fi->image[i]; id->type = intf->pixel_type; id->bits = MdcType2Bits(id->type); id->width = intf->width; id->height = intf->height; id->pixel_xsize = intf->pixel_xsize; id->pixel_ysize = intf->pixel_ysize; } } break; case MDC_INTF_TOMOGRAPH: if (MdcThisKey("number of detector heads")) { intf->detector_heads = MdcGetIntKey(); total = intf->detector_heads * intf->energy_windows; continue; } if (MdcThisKey("process status")) { intf->process_status = MdcGetProcessStatus(); switch (intf->process_status) { case MDC_INTF_ACQUIRED : fi->reconstructed = MDC_NO; acqnr = intf->detector_heads * intf->energy_windows; if (acqnr == 0) { MdcPrntWarn("INTF Requesting zero ACQ_DATA (fixed = 1)"); acqnr = 1; } if (!MdcGetStructAD(fi,acqnr)) return("INTF Couldn't malloc ACQ_DATA structs"); break; case MDC_INTF_RECONSTRUCTED : fi->reconstructed = MDC_YES; break; default : fi->reconstructed = MDC_YES; } if (fi->reconstructed == MDC_YES) { if (total == 0) { MdcPrntWarn("INTF Requesting zero DYNAMIC_DATA (fixed = 1)"); total = 1; } if (!MdcGetStructDD(fi,total)) return("INTF Couldn't malloc DYNAMIC_DATA structs"); } continue; } if (MdcThisKey("number of projections")) { intf->number_images = MdcGetIntKey(); intf->images_per_dimension = intf->number_images; continue; } if (MdcThisKey("extent of rotation")) { intf->ext_rot = (float)MdcGetFloatKey(); continue; } if (MdcThisKey("study duration (sec)") || /* official */ MdcThisKey("study duration (elapsed) sec")) { /* dialects */ intf->study_duration = (float)MdcGetFloatKey() * 1000.; continue; } switch (intf->process_status) { case MDC_INTF_ACQUIRED: if (MdcThisKey("spect study (acquired data)")) { if (fi->acqnr > counter && fi->acqdata != NULL) { acq = &fi->acqdata[counter]; acq->scan_arc = intf->ext_rot; if (intf->number_images > 0) acq->angle_step=intf->ext_rot/(float)intf->number_images; }else{ acq = NULL; } counter += 1; continue; } if (MdcThisKey("direction of rotation")) { if (acq != NULL) { acq->rotation_direction = (Int16)MdcGetRotation(); } continue; } if (MdcThisKey("acquisition mode")) { if (acq != NULL) { acq->detector_motion = (Int16)MdcGetMotion(); } continue; } if (MdcThisKey("start angle")) { if (acq != NULL) { acq->angle_start = (float)MdcGetFloatKey(); } continue; } if (MdcThisKey("x_offset")) { if (acq != NULL) { acq->rotation_offset = (float)MdcGetFloatKey(); } continue; } if (MdcThisKey("radius")) { if (acq != NULL) { acq->radial_position = (float)MdcGetFloatKey(); } continue; } break; case MDC_INTF_RECONSTRUCTED: if (MdcThisKey("method of reconstruction")) { MdcGetStrKey(fi->recon_method); continue; } if (MdcThisKey("number of slices")) { intf->number_images = MdcGetIntKey(); intf->images_per_dimension = intf->number_images; continue; } if (MdcThisKey("filter name")) { MdcGetStrKey(fi->filter_type); continue; } if (MdcThisKey("spect study (reconstructed data)")) { /* fill in dynamic data (time) */ if ((counter < fi->dynnr) && (fi->dyndata != NULL)) { dd = &fi->dyndata[counter]; dd->nr_of_slices = intf->number_images; dd->time_frame_duration = intf->study_duration; } counter += 1; } break; } if ((MdcThisKey("spect study (acquired data)") && (counter>1)) || (MdcThisKey("spect study (reconstructed data)") && (counter>1)) || (MdcThisKey("end of interfile"))) if (counter <= total && img < fi->number) { for (i=0; inumber_images; i++, img++) { if (i == fi->number) break; id = &fi->image[img]; id->type = intf->pixel_type; id->bits = MdcType2Bits(id->type); id->width = intf->width; id->height = intf->height; id->pixel_xsize = intf->pixel_xsize; id->pixel_ysize = intf->pixel_ysize; id->slice_width = ((id->pixel_xsize + id->pixel_ysize)/2.) * intf->slice_thickness; fi->pat_slice_orient = MdcGetPatSlOrient(intf); id->slice_spacing= ((id->pixel_xsize + id->pixel_ysize)/2.) * intf->centre_centre_separation; MdcFillImgPos(fi,i,i,0.0); MdcFillImgOrient(fi,i); } intf->number_images = 0; /* fill in the rest too */ for (i=img; inumber; i++) { id = &fi->image[i]; id->type = intf->pixel_type; id->bits = MdcType2Bits(id->type); id->width = intf->width; id->height = intf->height; id->pixel_xsize = intf->pixel_xsize; id->pixel_ysize = intf->pixel_ysize; id->slice_width = ((id->pixel_xsize + id->pixel_ysize)/2.) * intf->slice_thickness; fi->pat_slice_orient = MdcGetPatSlOrient(intf); id->slice_spacing= ((id->pixel_xsize + id->pixel_ysize)/2.) * intf->centre_centre_separation; MdcFillImgPos(fi,i,i,0.0); MdcFillImgOrient(fi,i); } /* set number of slices in dynamic data */ if (dd != NULL) dd->nr_of_slices = intf->images_per_dimension; } break; case MDC_INTF_GSPECT: /* mixture of GATED and TOMOGRAPH */ /* GATED related stuff */ if (gd!=NULL && MdcThisKey("gated spect nesting outer level")) { gd->gspect_nesting = MdcGetGSpectNesting(); continue; } if (gd!=NULL && MdcThisKey("study duration (acquired) sec")) { gd->study_duration = (float)MdcGetFloatKey() * 1000.; continue; } if (gd!=NULL && MdcThisKey("study duration (elapsed) sec")) { gd->study_duration = (float)MdcGetFloatKey() * 1000.; continue; } if (gd!=NULL && MdcThisKey("number of cardiac cycles (observed)")) { gd->cycles_observed = (float)MdcGetFloatKey(); continue; } if (MdcThisKey("number of time windows")) { intf->time_windows = MdcGetIntKey(); continue; } /* MARK: we don't use because it mostly results in dim confusion if (MdcThisKey("time window number")) { counter = MdcGetIntKey(); continue; } */ /* only support for SYMMETRIC dimensions */ /* note different interpretation than Gated */ if (MdcThisKey("number of images in time window")) { intf->time_slots = MdcGetIntKey(); continue; } if (gd!=NULL && MdcThisKey("image duration (sec)")) { gd->image_duration = (float)MdcGetFloatKey() * 1000.; continue; } if (gd!=NULL && MdcThisKey("time window lower limit (sec)")) { gd->window_low = (float)MdcGetFloatKey() * 1000.; continue; } if (gd!=NULL && MdcThisKey("time window upper limit (sec)")) { gd->window_high = (float)MdcGetFloatKey() * 1000.; continue; } if (gd!=NULL && MdcThisKey("R-R cycles acquired this window")) { v = (float)MdcGetFloatKey(); if (v > 100. || v <= 0.) v = 100.; intf->procent_cycles_acquired = v; /* calculate observed */ v = (gd->cycles_acquired * 100.) / intf->procent_cycles_acquired; uv = (Uint32)v; v = (float)uv; /* simply chop to integer */ if ((v > gd->cycles_acquired) || (gd->cycles_observed == 0.)) { gd->cycles_observed = v; } continue; } if (gd!=NULL && MdcThisKey("number of cardiac cycles (acquired)")) { gd->cycles_acquired = (float)MdcGetFloatKey(); /* calculate observed */ v = (gd->cycles_acquired * 100.) / intf->procent_cycles_acquired; uv = (Uint32)v; v = (float)uv; /* simply chop to integer */ if ((v > gd->cycles_acquired) || (gd->cycles_observed == 0.)) { gd->cycles_observed = v; } continue; } /* TOMOGRAPH related stuff */ if (MdcThisKey("number of detector heads")) { /* MARK: we don't use because it mostly results in dim confusion intf->detector_heads = MdcGetIntKey(); */ total = intf->time_slots*intf->detector_heads*intf->energy_windows; continue; } if (MdcThisKey("process status")) { intf->process_status = MdcGetProcessStatus(); switch (intf->process_status) { case MDC_INTF_ACQUIRED : fi->reconstructed = MDC_NO; acqnr = intf->detector_heads * intf->energy_windows; if (!MdcGetStructAD(fi,acqnr)) return("INTF Couldn't malloc ACQ_DATA structs"); break; case MDC_INTF_RECONSTRUCTED : fi->reconstructed = MDC_YES; break; default : fi->reconstructed = MDC_YES; } continue; } if (MdcThisKey("number of projections")) { intf->number_images = MdcGetIntKey(); intf->images_per_dimension = intf->number_images; if (gd != NULL) gd->nr_projections= (float)intf->number_images; continue; } if (MdcThisKey("extent of rotation")) { intf->ext_rot = (float)MdcGetFloatKey(); if (gd != NULL) gd->extent_rotation = intf->ext_rot; continue; } if (MdcThisKey("time per projection (sec)")) { gd->time_per_proj = (float)MdcGetFloatKey() * 1000.; continue; } switch (intf->process_status) { case MDC_INTF_ACQUIRED: if (MdcThisKey("spect study (acquired data)")) { if (fi->acqnr > counter && fi->acqdata != NULL) { acq = &fi->acqdata[counter]; acq->scan_arc = intf->ext_rot; if (intf->number_images > 0) acq->angle_step=intf->ext_rot/(float)intf->number_images; }else{ acq = NULL; } counter += 1; continue; } if (MdcThisKey("direction of rotation")) { if (acq != NULL) { acq->rotation_direction = (Int16)MdcGetRotation(); } continue; } if (MdcThisKey("acquisition mode")) { if (acq != NULL) { acq->detector_motion = (Int16)MdcGetMotion(); } continue; } if (MdcThisKey("start angle")) { if (acq != NULL) { acq->angle_start = (float)MdcGetFloatKey(); } continue; } if (MdcThisKey("x_offset")) { if (acq != NULL) { acq->rotation_offset = (float)MdcGetFloatKey(); } continue; } if (MdcThisKey("radius")) { if (acq != NULL) { acq->radial_position = (float)MdcGetFloatKey(); } continue; } break; case MDC_INTF_RECONSTRUCTED: if (MdcThisKey("method of reconstruction")) { MdcGetStrKey(fi->recon_method); continue; } if (MdcThisKey("number of slices")) { intf->number_images = MdcGetIntKey(); intf->images_per_dimension = intf->number_images; continue; } if (MdcThisKey("filter name")) { MdcGetStrKey(fi->filter_type); continue; } if (MdcThisKey("spect study (reconstructed data)")) { counter += 1; } break; } if ((MdcThisKey("spect study (acquired data)") && (counter>1)) || (MdcThisKey("spect study (reconstructed data)") && (counter>1)) || (MdcThisKey("end of interfile"))) if (counter <= total && img < fi->number) { for (i=0; inumber_images; i++, img++) { if (i == fi->number) break; id = &fi->image[img]; id->type = intf->pixel_type; id->bits = MdcType2Bits(id->type); id->width = intf->width; id->height = intf->height; id->pixel_xsize = intf->pixel_xsize; id->pixel_ysize = intf->pixel_ysize; id->slice_width = ((id->pixel_xsize + id->pixel_ysize)/2.) * intf->slice_thickness; fi->pat_slice_orient = MdcGetPatSlOrient(intf); id->slice_spacing= ((id->pixel_xsize + id->pixel_ysize)/2.) * intf->centre_centre_separation; MdcFillImgPos(fi,i,i,0.0); MdcFillImgOrient(fi,i); } intf->number_images = 0; /* fill in the rest too */ for (i=img; inumber; i++) { id = &fi->image[i]; id->type = intf->pixel_type; id->bits = MdcType2Bits(id->type); id->width = intf->width; id->height = intf->height; id->pixel_xsize = intf->pixel_xsize; id->pixel_ysize = intf->pixel_ysize; id->slice_width = ((id->pixel_xsize + id->pixel_ysize)/2.) * intf->slice_thickness; fi->pat_slice_orient = MdcGetPatSlOrient(intf); id->slice_spacing= ((id->pixel_xsize + id->pixel_ysize)/2.) * intf->centre_centre_separation; MdcFillImgPos(fi,i,i,0.0); MdcFillImgOrient(fi,i); } } break; case MDC_INTF_CURVE: MdcCloseFile(fi->ifp); return("INTF Curve data not supported"); break; } if (MdcThisKey("end of interfile")) break; } if (MDC_INFO) { MdcPrntScrn("\n"); MdcPrintLine('-',MDC_HALF_LENGTH); } /* safety check or for dialect without "number of dimensions" key */ if ((fi->image == NULL) || (fi->number == 0)) return("INTF Failure to decipher header information"); return NULL; } char *MdcReadIntfImages(FILEINFO *fi, MDC_INTERFILE *intf) { IMG_DATA *id; Uint32 i, p, bytes, nbr; char *err; /* set FILE pointer to begin of data */ if (intf->data_offset > 0L) fseek(fi->ifp,(signed)intf->data_offset,SEEK_SET); for (i=0; inumber; i++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); id = &fi->image[i]; bytes = id->width * id->height * MdcType2Bytes(id->type); if ( (id->buf = MdcGetImgBuffer(bytes)) == NULL) return("INTF Bad malloc image buffer"); switch(id->type) { case BIT1: /* convert directly to BIT8_U */ { bytes = MdcPixels2Bytes(id->width * id->height); if (fread(id->buf,1,bytes,fi->ifp) != bytes) { err=MdcHandleTruncated(fi,i+1,MDC_YES); if (err != NULL) return(err); } MdcMakeBIT8_U(id->buf, fi, i); id->type = BIT8_U; } break; case ASCII: { double *pix = (double *)id->buf; for (p=0; p<(id->width*id->height); p++) { if (fscanf(fi->ifp,"%le",&pix[p]) != 1) { err=MdcHandleTruncated(fi,i+1,MDC_YES); if (err != NULL) return(err); break; } } id->type = FLT64; MDC_FILE_ENDIAN = MDC_HOST_ENDIAN; } break; default: if ((nbr=fread(id->buf,1,bytes,fi->ifp)) != bytes) { if (nbr > 0) err=MdcHandleTruncated(fi,i+1,MDC_YES); else err=MdcHandleTruncated(fi,i,MDC_YES); if (err != NULL) return(err); } } if (fi->truncated) break; } return NULL; } const char *MdcReadINTF(FILEINFO *fi) { MDC_INTERFILE intf; IMG_DATA *id; const char *err; char *origpath=NULL; Uint32 i, check=1; Int8 WAS_COMPRESSED=MDC_NO; /* put in some defaults */ fi->endian = MDC_FILE_ENDIAN = MDC_BIG_ENDIAN; fi->flood_corrected = MDC_YES; fi->decay_corrected = MDC_NO; fi->reconstructed = MDC_YES; if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Reading InterFile:"); if (MDC_VERBOSE) MdcPrntMesg("INTF Reading <%s> ...",fi->ifname); /* preserve original input path - before header read fills fi->ipath */ MdcMergePath(fi->ipath,fi->idir,fi->ifname); if ((origpath=malloc(strlen(fi->ipath) + 1)) == NULL) { return("INTF Couldn't allocate original path"); } strcpy(origpath,fi->ipath); MdcSplitPath(fi->ipath,fi->idir,fi->ifname); /* initialize intf struct */ MdcInitIntf(&intf); /* read the header */ err=MdcReadIntfHeader(fi, &intf); if (err != NULL) { MdcFree(origpath); return(err); } if (MDC_ECHO_ALIAS == MDC_YES) { MdcEchoAliasName(fi); MdcFree(origpath); return(NULL); } MdcCloseFile(fi->ifp); /* complete FILEINFO stuct */ fi->type = intf.pixel_type; fi->bits = MdcType2Bits(fi->type); if (intf.DIALECT == MDC_YES) { for (i=0; inumber; i++) { id = &fi->image[i]; id->type = intf.pixel_type; id->bits = MdcType2Bits(id->type); id->width = intf.width; id->height= intf.height; id->pixel_xsize = intf.pixel_xsize; id->pixel_ysize = intf.pixel_ysize; id->slice_width = intf.slice_thickness_mm; id->slice_spacing = intf.slice_thickness_mm; } }else{ fi->dim[3] = intf.images_per_dimension; fi->dim[7] = intf.energy_windows; switch (intf.data_type) { case MDC_INTF_DYNAMIC: fi->dim[4] = intf.frame_groups; break; case MDC_INTF_TOMOGRAPH: fi->dim[6] = intf.detector_heads; break; case MDC_INTF_GATED: fi->dim[5] = intf.time_windows; break; case MDC_INTF_GSPECT: fi->dim[4] = intf.time_slots; fi->dim[5] = intf.time_windows; /* MARK: fishy, don't really know */ fi->dim[6] = intf.detector_heads; /* MARK: fishy, don't really know */ } } for (i=(MDC_MAX_DIMS-1); i>3; i--) if (fi->dim[i] > 1) break; fi->dim[0] = i; /* check fi->dim[] integrity */ for (i=(MDC_MAX_DIMS-1); i>2; i--) check*=fi->dim[i]; if ((fi->number > 1) && (fi->number - 1) == check) { /* probably an ugly preview slice included */ if (MDC_SKIP_PREVIEW == MDC_YES) { intf.data_offset += intf.width*intf.height*MdcType2Bytes(intf.pixel_type); fi->number -= 1; }else{ MdcPrntWarn("INTF Probably with confusing preview slice"); } } /* make one dimensional when planar or asymmetric tomo */ if ((check != fi->number) || (fi->planar == MDC_YES)) { if (fi->planar == MDC_NO) { if (fi->dim[0] == 3) { /* bad total images defined */ /* sometimes for reconstructed TOMO */ /* the key was not*/ /* filled in properly */ /* we DO issue a warning ... */ MdcPrntWarn("INTF Confusing number of images specified"); }else{ /* damn, an asymmetric amount of images per */ /* dimension which is unsupported for tomo (3D) */ MdcPrntWarn("INTF Garbled or unsupported images/dimension:\n" \ "\t - using one dimensional array\n" \ "\t - image position values might be corrupted"); intf.data_type = MDC_INTF_TOMOGRAPH; /* disable dynamic etc ... */ } } /* fix the dimensions */ fi->dim[0] = 3; fi->dim[3] = fi->number; for (i=4; idim[i] = 1; } fi->pixdim[0] = 3.; if (fi->image[0].pixel_xsize == 0. ) fi->pixdim[1]=1.; else fi->pixdim[1] = fi->image[0].pixel_xsize; if (fi->image[0].pixel_ysize == 0. ) fi->pixdim[2]=1.; else fi->pixdim[2] = fi->image[0].pixel_ysize; if (fi->image[0].slice_width == 0) fi->pixdim[3]= (fi->pixdim[1] + fi->pixdim[2]) / 2. ; else fi->pixdim[3]=fi->image[0].slice_width; /* loop final time through all images */ for (i=0; inumber; i++) { id = &fi->image[i]; #if MDC_INTF_SUPPORT_SCALE /* set scale factors */ id->quant_scale = intf.rescale_slope; id->intercept = intf.rescale_intercept; #endif #ifndef HAVE_8BYTE_INT /* unavailable BIT64 type */ if (id->type == BIT64_S || id->type == BIT64_U) { MdcFree(origpath); return("INTF Unsupported data type BIT64"); } #endif } MdcMergePath(fi->ipath,fi->idir,fi->ifname); /* check for compression */ if (MdcWhichCompression(fi->ipath) != MDC_NO) { /* "name of data file" with proper .Z or .gz extension */ if (MdcDecompressFile(fi->ipath) != MDC_OK) { MdcFree(origpath); return("INTF Decompression image file failed"); } WAS_COMPRESSED = MDC_YES; }else{ if (MdcFileExists(fi->ipath) == MDC_NO) { /* no uncompressed image file found */ /* so we look for the compressed image file */ /* depending on the compression of the header */ /* => result from doing `gzip basename.*` ;-) */ MdcAddCompressionExt(fi->compression, fi->ipath); if (MdcFileExists(fi->ipath)) { if (MdcDecompressFile(fi->ipath) != MDC_OK) { MdcFree(origpath); return("INTF Decompression image file failed"); } /* Yep, you loose if you're using a different */ /* compression for header and image files */ WAS_COMPRESSED = MDC_YES; }else{ /* maybe case sensitivity problem in key */ /* "name of data file" (DOS/Unix transition) */ /* try all UPPER case */ MdcSplitPath(fi->ipath,fi->idir,fi->ifname); MdcUpStr(fi->ifname); MdcMergePath(fi->ipath,fi->idir,fi->ifname); if (MdcFileExists(fi->ipath) == MDC_NO) { /* try all LOWER case */ MdcSplitPath(fi->ipath,fi->idir,fi->ifname); MdcLowStr(fi->ifname); MdcMergePath(fi->ipath,fi->idir,fi->ifname); if (MdcFileExists(fi->ipath) == MDC_NO) return("INTF Couldn't find specified image file"); } MdcPrntWarn("INTF Check upper/lower case of image file"); } } } /* open the (decompressed) image file */ if ( (fi->ifp=fopen(fi->ipath,"rb")) == NULL) { MdcFree(origpath); return("INTF Couldn't open image file"); } if (WAS_COMPRESSED == MDC_YES) { unlink(fi->ipath); /* delete after use */ if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Reading InterFile:"); } MdcSplitPath(fi->ipath,fi->idir,fi->ifname); err=MdcReadIntfImages(fi, &intf); if (err != NULL) { MdcFree(origpath); return(err); } MdcCloseFile(fi->ifp); /* restore original filename */ strcpy(fi->ipath,origpath); MdcSplitPath(fi->ipath,fi->idir,fi->ifname); MdcFree(origpath); if (fi->truncated) return("INTF Truncated image file"); return NULL; } char *MdcType2Intf(int type) { switch (type) { case BIT1 : return("bit"); break; case BIT8_U : case BIT16_U: case BIT32_U: case BIT64_U: return("unsigned integer"); break; case BIT8_S : case BIT16_S: case BIT32_S: case BIT64_S: return("signed integer"); break; case FLT32 : return("short float"); break; case FLT64 : return("long float"); break; case ASCII : return("ASCII"); break; } return("unsigned integer"); } char *MdcGetProgramDate(void) { int date, month=0, year; sscanf(MDC_DATE,"%2d-%3s-%4d",&date,keystr_check,&year); MdcLowStr(keystr_check); if ( MdcThisString("jan")) month=1; else if (MdcThisString("feb")) month=2; else if (MdcThisString("mar")) month=3; else if (MdcThisString("apr")) month=4; else if (MdcThisString("may")) month=5; else if (MdcThisString("jun")) month=6; else if (MdcThisString("jul")) month=7; else if (MdcThisString("aug")) month=8; else if (MdcThisString("sep")) month=9; else if (MdcThisString("oct")) month=10; else if (MdcThisString("nov")) month=11; else if (MdcThisString("dec")) month=12; sprintf(keystr,"%04d:%02d:%02d",year,month,date); return(keystr); } char *MdcSetPatRotation(int patient_slice_orient) { switch (patient_slice_orient) { case MDC_SUPINE_HEADFIRST_TRANSAXIAL: case MDC_SUPINE_HEADFIRST_SAGITTAL : case MDC_SUPINE_HEADFIRST_CORONAL : case MDC_SUPINE_FEETFIRST_TRANSAXIAL: case MDC_SUPINE_FEETFIRST_SAGITTAL : case MDC_SUPINE_FEETFIRST_CORONAL : return("supine"); break; case MDC_PRONE_HEADFIRST_TRANSAXIAL : case MDC_PRONE_HEADFIRST_SAGITTAL : case MDC_PRONE_HEADFIRST_CORONAL : case MDC_PRONE_FEETFIRST_TRANSAXIAL : case MDC_PRONE_FEETFIRST_SAGITTAL : case MDC_PRONE_FEETFIRST_CORONAL : return("prone"); break; default : return("Unknown"); } } char *MdcSetPatOrientation(int patient_slice_orient) { switch (patient_slice_orient) { case MDC_SUPINE_HEADFIRST_TRANSAXIAL: case MDC_SUPINE_HEADFIRST_SAGITTAL : case MDC_SUPINE_HEADFIRST_CORONAL : case MDC_PRONE_HEADFIRST_TRANSAXIAL : case MDC_PRONE_HEADFIRST_SAGITTAL : case MDC_PRONE_HEADFIRST_CORONAL : return("head_in"); break; case MDC_SUPINE_FEETFIRST_TRANSAXIAL: case MDC_SUPINE_FEETFIRST_SAGITTAL : case MDC_SUPINE_FEETFIRST_CORONAL : case MDC_PRONE_FEETFIRST_TRANSAXIAL : case MDC_PRONE_FEETFIRST_SAGITTAL : case MDC_PRONE_FEETFIRST_CORONAL : return("feet_in"); break; default : return("Unknown"); break; } } char *MdcCheckIntfDim(FILEINFO *fi) { int DIMENSION_WARNING = MDC_NO; switch (fi->acquisition_type) { case MDC_ACQUISITION_DYNAMIC: /* no support for R-R intervals and detector heads */ if ( (fi->dim[5] > 1) || (fi->dim[6] > 1) ) { strcpy(mdcbufr,"INTF Unsupported dimensions used for DYNAMIC file"); DIMENSION_WARNING = MDC_YES; } break; case MDC_ACQUISITION_TOMO : /* no support for time slots and R-R intervals */ if ( (fi->dim[4] > 1) || (fi->dim[5] > 1) ) { strcpy(mdcbufr,"INTF Unsupported dimensions used for TOMO file"); DIMENSION_WARNING = MDC_YES; } break; case MDC_ACQUISITION_GATED : /* no support for time slots and detector heads */ if ( (fi->dim[4] > 1) || (fi->dim[6] > 1) ) { strcpy(mdcbufr,"INTF Unsupported dimensions used for GATED file"); DIMENSION_WARNING = MDC_YES; } break; case MDC_ACQUISITION_GSPECT : /* uses all dimensions */ break; case MDC_ACQUISITION_UNKNOWN: /* default = Static */ case MDC_ACQUISITION_STATIC : /* default = Static */ default : /* no support for time slots, R-R intervals, detector heads */ if ( (fi->dim[4] > 1) || (fi->dim[5] > 1) || (fi->dim[6] > 1) ) { strcpy(mdcbufr,"INTF Unsupported dimensions used for STATIC file"); DIMENSION_WARNING = MDC_YES; } } if (DIMENSION_WARNING == MDC_YES) { MdcPrntWarn(mdcbufr); } return(NULL); } char *MdcWriteGenImgData(FILEINFO *fi) { FILE *fp = fi->ofp; fprintf(fp,";\r\n"); fprintf(fp,"!GENERAL IMAGE DATA :=\r\n"); fprintf(fp,"!type of data := "); switch (fi->acquisition_type) { case MDC_ACQUISITION_DYNAMIC: fprintf(fp,"Dynamic\r\n"); break; case MDC_ACQUISITION_TOMO : fprintf(fp,"Tomographic\r\n"); break; case MDC_ACQUISITION_GATED : fprintf(fp,"Gated\r\n"); break; case MDC_ACQUISITION_GSPECT : fprintf(fp,"GSPECT\r\n"); break; case MDC_ACQUISITION_UNKNOWN: /* default = Static */ case MDC_ACQUISITION_STATIC : /* default = Static */ default : fprintf(fp,"Static\r\n"); } fprintf(fp,"!total number of images := %u\r\n",fi->number); fprintf(fp,"study date := %04d:%02d:%02d\r\n",fi->study_date_year ,fi->study_date_month ,fi->study_date_day); fprintf(fp,"study time := %02d:%02d:%02d\r\n",fi->study_time_hour ,fi->study_time_minute ,fi->study_time_second); fprintf(fp,"imagedata byte order := "); if (MDC_FILE_ENDIAN == MDC_LITTLE_ENDIAN) fprintf(fp,"LITTLEENDIAN\r\n"); else fprintf(fp,"BIGENDIAN\r\n"); fprintf(fp,"process label := %s\r\n",fi->study_descr); #if MDC_INTF_SUPPORT_SCALE if (fi->image[0].rescaled) { /* write global scales */ fprintf(fp,";\r\n"); fprintf(fp,"quantification units := %+e\r\n" ,fi->image[0].rescaled_fctr); fprintf(fp,"NUD/rescale slope := %+e\r\n" ,fi->image[0].rescaled_slope); fprintf(fp,"NUD/rescale intercept := %+e\r\n" ,fi->image[0].rescaled_intercept); } #endif return(NULL); } char *MdcWriteMatrixInfo(FILEINFO *fi, Uint32 img) { IMG_DATA *id = &fi->image[img]; FILE *fp = fi->ofp; fprintf(fp,"!matrix size [1] := %u\r\n",id->width); fprintf(fp,"!matrix size [2] := %u\r\n",id->height); if (MDC_FORCE_INT != MDC_NO) { switch (MDC_FORCE_INT) { case BIT8_U : fprintf(fp,"!number format := %s\r\n",MdcType2Intf(BIT8_U)); fprintf(fp,"!number of bytes per pixel := %u\r\n" ,MdcType2Bytes(BIT8_U)); break; case BIT16_S: fprintf(fp,"!number format := %s\r\n",MdcType2Intf(BIT16_S)); fprintf(fp,"!number of bytes per pixel := %u\r\n" ,MdcType2Bytes(BIT16_S)); break; default : fprintf(fp,"!number format := %s\r\n",MdcType2Intf(BIT16_S)); fprintf(fp,"!number of bytes per pixel := %u\r\n", MdcType2Bytes(BIT16_S)); } }else if (MDC_QUANTIFY || MDC_CALIBRATE) { fprintf(fp,"!number format := short float\r\n"); fprintf(fp,"!number of bytes per pixel := 4\r\n"); }else{ fprintf(fp,"!number format := %s\r\n",MdcType2Intf(id->type)); fprintf(fp,"!number of bytes per pixel := %u\r\n", MdcType2Bytes(id->type)); } fprintf(fp,"scaling factor (mm/pixel) [1] := %+e\r\n",id->pixel_xsize); fprintf(fp,"scaling factor (mm/pixel) [2] := %+e\r\n",id->pixel_ysize); return (NULL); } char *MdcWriteWindows(FILEINFO *fi) { Uint32 window, total_energy_windows = fi->dim[7]; FILE *fp = fi->ofp; char *msg = NULL; if (total_energy_windows == 0) return("INTF Bad total number of windows"); fprintf(fp,";\r\n"); fprintf(fp,"number of energy windows := %u\r\n",total_energy_windows); for (window=1; window <= total_energy_windows; window++) { fprintf(fp,";\r\n"); fprintf(fp,"energy window [%u] :=\r\n",window); fprintf(fp,"energy window lower level [%u] :=\r\n",window); fprintf(fp,"energy window upper level [%u] :=\r\n",window); fprintf(fp,"flood corrected := "); if (fi->flood_corrected == MDC_YES) fprintf(fp,"Y\r\n"); else fprintf(fp,"N\r\n"); fprintf(fp,"decay corrected := "); if (fi->decay_corrected == MDC_YES) fprintf(fp,"Y\r\n"); else fprintf(fp,"N\r\n"); switch (fi->acquisition_type) { case MDC_ACQUISITION_DYNAMIC: msg=MdcWriteIntfDynamic(fi); break; case MDC_ACQUISITION_TOMO : msg=MdcWriteIntfTomo(fi); break; case MDC_ACQUISITION_GATED : msg=MdcWriteIntfGated(fi); break; case MDC_ACQUISITION_GSPECT : msg=MdcWriteIntfGSPECT(fi); break; case MDC_ACQUISITION_UNKNOWN: /* default = Static */ case MDC_ACQUISITION_STATIC : /* default = Static */ default : msg=MdcWriteIntfStatic(fi); } if (msg != NULL) return(msg); } return(NULL); } char *MdcWriteIntfStatic(FILEINFO *fi) { Uint32 i, total_energy_windows=fi->dim[7]; Uint32 images_per_window = fi->number/total_energy_windows; IMG_DATA *id = NULL; STATIC_DATA sdata, *sd; FILE *fp = fi->ofp; char *msg = NULL; fprintf(fp,";\r\n"); fprintf(fp,"!STATIC STUDY (General) :=\r\n"); fprintf(fp,"number of images/energy window := %u\r\n",images_per_window); for (i=0; iimage[i]; sd = &sdata; if (id->sdata != NULL) { MdcCopySD(sd,id->sdata); }else{ MdcInitSD(sd); } fprintf(fp,";\r\n"); fprintf(fp,"!Static Study (each frame) :=\r\n"); fprintf(fp,"!image number := %u\r\n",i+1); msg = MdcWriteMatrixInfo(fi, i); if (msg != NULL) return(msg); fprintf(fp,"image duration (sec) := %e\r\n",sd->image_duration / 1000.); fprintf(fp,"image start time := %02hd:%02hd:%02hd\r\n" ,sd->start_time_hour ,sd->start_time_minute ,sd->start_time_second); fprintf(fp,"label := %s\r\n",sd->label); if (id->rescaled) { fprintf(fp,"!maximum pixel count := %+e\r\n",id->rescaled_max); fprintf(fp,"!minimum pixel count := %+e\r\n",id->rescaled_min); }else{ fprintf(fp,"!maximum pixel count := %+e\r\n",id->max); fprintf(fp,"!minimum pixel count := %+e\r\n",id->min); } fprintf(fp,"total counts := %g\r\n",sd->total_counts); } if (ferror(fp)) return("INTF Error writing Static Header"); return(NULL); } char *MdcWriteIntfDynamic(FILEINFO *fi) { DYNAMIC_DATA *dd; Uint32 s, f, s0, img=0; Uint32 nrframes=1, nrslices=fi->dim[3]; double max; IMG_DATA *id = NULL; FILE *fp = fi->ofp; char *msg = NULL; if ((fi->dynnr == 0) || (fi->dyndata == NULL)) return("INTF Missing proper DYNAMIC_DATA structs"); if (fi->diff_size == MDC_YES) return("INTF Dynamic different sizes unsupported"); if (fi->diff_type == MDC_YES) return("INTF Dynamic different types unsupported"); nrframes = fi->dynnr; fprintf(fp,";\r\n"); fprintf(fp,"!DYNAMIC STUDY (general) :=\r\n"); fprintf(fp,"!number of frame groups := %u\r\n",nrframes); for (s0=0, f=0; f < nrframes; f++) { dd = &fi->dyndata[f]; nrslices = dd->nr_of_slices; id = &fi->image[s0]; /* first image of current time frame */ fprintf(fp,";\r\n"); fprintf(fp,"!Dynamic Study (each frame group) :=\r\n"); fprintf(fp,"!frame group number := %u\r\n",f+1); msg = MdcWriteMatrixInfo(fi, img); if (msg != NULL) return(msg); fprintf(fp,"!number of images this frame group := %u\r\n",nrslices); fprintf(fp,"!image duration (sec) := %.7g\r\n" ,MdcSingleImageDuration(fi,f) / 1000.); fprintf(fp,"pause between images (sec) := %.7g\r\n" ,dd->delay_slices / 1000. ); fprintf(fp,"pause between frame groups (sec) := %.7g\r\n" ,dd->time_frame_delay / 1000. ); if (id->rescaled || MDC_CALIBRATE || MDC_QUANTIFY) { max = id->rescaled_max; }else{ max = id->max; } for (s=1; s < nrslices; s++) { id = &fi->image[s0 + s]; if (id->rescaled) { if (id->rescaled_max > max) max = id->rescaled_max; }else{ if (id->max > max) max = id->max; } } fprintf(fp,"!maximum pixel count in group := %+e\r\n",max); s0 += dd->nr_of_slices; /* set first slice of next time frame */ } if (ferror(fp)) return("INTF Error writing Dynamic Header"); if (fi->planar == MDC_NO) return("INTF Inappropriate for non-planar dynamic studies"); return(NULL); } char *MdcWriteIntfTomo(FILEINFO *fi) { Uint32 total_energy_windows=fi->dim[7], total_detector_heads=fi->dim[6]; Uint32 head, img=0, planes = fi->dim[3], images_per_window, fnr; float slice_thickness, slice_separation, study_duration=0., proj_duration=0.; ACQ_DATA *acq = NULL; IMG_DATA *id = &fi->image[0]; DYNAMIC_DATA *dd = NULL; FILE *fp = fi->ofp; char *msg = NULL; images_per_window = fi->number / total_energy_windows; if (fi->diff_size == MDC_YES) return("INTF Tomographic different sizes unsupported"); if (fi->diff_type == MDC_YES) return("INTF Tomographic different types unsupported"); fnr = id->frame_number; if ((fi->dynnr > 0) && (fnr > 0)) { dd = &fi->dyndata[fnr - 1]; study_duration = dd->time_frame_duration; proj_duration = dd->time_frame_duration / dd->nr_of_slices; } /* in pixels instead of mm */ slice_thickness=id->slice_width/((id->pixel_xsize+id->pixel_ysize)/2.); slice_separation=id->slice_spacing/((id->pixel_xsize+id->pixel_ysize)/2.); fprintf(fp,";\r\n"); fprintf(fp,"!SPECT STUDY (general) :=\r\n"); fprintf(fp,"number of detector heads := %u\r\n",total_detector_heads); for (head=0; head < total_detector_heads; head++, ACQI++) { if (ACQI < fi->acqnr && fi->acqdata != NULL) { acq = &fi->acqdata[ACQI]; }else{ acq = NULL; } fprintf(fp,";\r\n"); fprintf(fp,"!number of images/energy window := %u\r\n",images_per_window); fprintf(fp,"!process status := "); if (fi->reconstructed == MDC_NO) { fprintf(fp,"Acquired\r\n"); }else{ fprintf(fp,"Reconstructed\r\n"); } msg = MdcWriteMatrixInfo(fi, img); if (msg != NULL) return(msg); fprintf(fp,"!number of projections := %u\r\n",planes); fprintf(fp,"!extent of rotation := "); if (acq != NULL) fprintf(fp,"%g",acq->angle_step*(float)planes); fprintf(fp,"\r\n"); fprintf(fp,"!time per projection (sec) := %.7g\r\n",proj_duration / 1000.); fprintf(fp,"study duration (sec) := %.7g\r\n",study_duration / 1000.); fprintf(fp,"!maximum pixel count := "); if (MDC_FORCE_INT != MDC_NO) { switch (MDC_FORCE_INT) { case BIT8_U: fprintf(fp,"%+e",(float)MDC_MAX_BIT8_U); break; case BIT16_S: fprintf(fp,"%+e",(float)MDC_MAX_BIT16_S); break; default: fprintf(fp,"%+e",(float)MDC_MAX_BIT16_S); } }else if (MDC_QUANTIFY || MDC_CALIBRATE) { fprintf(fp,"%+e",fi->qglmax); }else{ fprintf(fp,"%+e",fi->glmax); } fprintf(fp,"\r\n"); fprintf(fp,"patient orientation := %s\r\n" ,MdcSetPatOrientation(fi->pat_slice_orient)); fprintf(fp,"patient rotation := %s\r\n" ,MdcSetPatRotation(fi->pat_slice_orient)); if (fi->reconstructed == MDC_NO) { fprintf(fp,";\r\n"); fprintf(fp,"!SPECT STUDY (acquired data) :=\r\n"); fprintf(fp,"!direction of rotation := "); if (acq != NULL) { switch (acq->rotation_direction) { case MDC_ROTATION_CW: fprintf(fp,"CW"); break; case MDC_ROTATION_CC: fprintf(fp,"CCW"); break; } } fprintf(fp,"\r\n"); fprintf(fp,"start angle := "); if (acq != NULL) { fprintf(fp,"%g",acq->angle_start); } fprintf(fp,"\r\n"); fprintf(fp,"first projection angle in data set :=\r\n"); fprintf(fp,"acquisition mode := "); if (acq != NULL) { switch (acq->detector_motion) { case MDC_MOTION_STEP: fprintf(fp,"stepped"); break; case MDC_MOTION_CONT: fprintf(fp,"continuous"); break; default : fprintf(fp,"unknown"); } fprintf(fp,"\r\n"); if (acq->rotation_offset != 0.) { fprintf(fp,"Centre_of_rotation := Single_value\r\n"); fprintf(fp,"!X_offset := %.7g\r\n",acq->rotation_offset); fprintf(fp,"Y_offset := 0.\r\n"); fprintf(fp,"Radius := %.7g\r\n",acq->radial_position); }else{ fprintf(fp,"Centre_of_rotation := Corrected\r\n"); } }else{ fprintf(fp,"\r\n"); } fprintf(fp,"orbit := circular\r\n"); fprintf(fp,"preprocessed :=\r\n"); }else{ fprintf(fp,";\r\n"); fprintf(fp,"!SPECT STUDY (reconstructed data) :=\r\n"); fprintf(fp,"method of reconstruction := %s\r\n",fi->recon_method); fprintf(fp,"!number of slices := %u\r\n",planes); fprintf(fp,"number of reference frame := 0\r\n"); fprintf(fp,"slice orientation := %s\r\n", MdcGetStrSliceOrient(fi->pat_slice_orient)); fprintf(fp,"slice thickness (pixels) := %+e\r\n",slice_thickness); fprintf(fp,"centre-centre slice separation (pixels) := %+e\r\n", slice_separation); fprintf(fp,"filter name := %s\r\n",fi->filter_type); fprintf(fp,"filter parameters := Cutoff\r\n"); /*fprintf(fp,"z-axis filter :=\r\n");*/ /*fprintf(fp,"attenuation correction coefficient/cm :=\r\n");*/ fprintf(fp,"method of attenuation correction := measured\r\n"); fprintf(fp,"scatter corrected := N\r\n"); /*fprintf(fp,"method of scatter correction :=\r\n");*/ fprintf(fp,"oblique reconstruction := N\r\n"); /*fprintf(fp,"oblique orientation :=\r\n");*/ } } if (ferror(fp)) return("INTF Error writing Tomographic Header"); return(NULL); } char *MdcWriteIntfGated(FILEINFO *fi) { GATED_DATA *gd, tmpgd; FILE *fp = fi->ofp; IMG_DATA *id = NULL; Uint32 time_window; char *msg = NULL; float v; if (fi->gatednr > 0 && fi->gdata != NULL) { gd = &fi->gdata[0]; }else{ gd = &tmpgd; MdcInitGD(gd); } fprintf(fp,";\r\n"); fprintf(fp,"!GATED STUDY (general) :=\r\n"); msg = MdcWriteMatrixInfo(fi, 0); if (msg != NULL) return(msg); fprintf(fp,"study duration (elapsed) sec := %.7g\r\n" ,gd->study_duration / 1000.); fprintf(fp,"number of cardiac cycles (observed) := %.7g\r\n" ,gd->cycles_observed); fprintf(fp,";\r\n"); fprintf(fp,"number of time windows := %u\r\n",fi->dim[5]); for (time_window=0; time_windowdim[5]; time_window++) { id = &fi->image[time_window * fi->dim[3]]; fprintf(fp,";\r\n"); fprintf(fp,"!Gated Study (each time window) :=\r\n"); fprintf(fp,"!time window number := %u\r\n",time_window+1); fprintf(fp,"!number of images in time window := %u\r\n",fi->dim[3]); fprintf(fp,"!image duration (sec) := %.7g\r\n",gd->image_duration / 1000.); fprintf(fp,"framing method := Forward\r\n"); fprintf(fp,"time window lower limit (sec) := %.7g\r\n" ,gd->window_low / 1000.); fprintf(fp,"time window upper limit (sec) := %.7g\r\n" ,gd->window_high / 1000.); if (gd->cycles_observed > 0.) { v = (gd->cycles_acquired * 100.) / gd->cycles_observed; }else{ v = 100.; } fprintf(fp,"%% R-R cycles acquired this window := %.7g\r\n",v); fprintf(fp,"number of cardiac cycles (acquired) := %.7g\r\n" ,gd->cycles_acquired); fprintf(fp,"study duration (acquired) sec := %.7g\r\n" ,gd->study_duration / 1000.); fprintf(fp,"!maximum pixel count := "); if (MDC_FORCE_INT != MDC_NO) { switch (MDC_FORCE_INT) { case BIT8_U: fprintf(fp,"%+e",(float)MDC_MAX_BIT8_U); break; case BIT16_S: fprintf(fp,"%+e",(float)MDC_MAX_BIT16_S); break; default: fprintf(fp,"%+e",(float)MDC_MAX_BIT16_S); } }else if (MDC_QUANTIFY || MDC_CALIBRATE) { fprintf(fp,"%+e",id->qfmax); }else{ fprintf(fp,"%+e",id->fmax); } fprintf(fp,"\r\n"); fprintf(fp,"R-R histogram := N\r\n"); } return(NULL); } char *MdcWriteIntfGSPECT(FILEINFO *fi) { Uint32 total_energy_windows=fi->dim[7], total_detector_heads=fi->dim[6]; Uint32 time_window, head, planes = fi->dim[3], images_per_window; float slice_thickness, slice_separation, v; GATED_DATA *gd = NULL, tmpgd; ACQ_DATA *acq = NULL, tmpacq; IMG_DATA *id = &fi->image[0]; FILE *fp = fi->ofp; char *msg = NULL; if (fi->gatednr > 0 && fi->gdata != NULL) { /* use true struct */ gd = &fi->gdata[0]; }else{ /* use temp struct */ gd = &tmpgd; MdcInitGD(gd); } images_per_window = fi->number / total_energy_windows; if (fi->diff_size == MDC_YES) return("INTF Gated SPECT different sizes unsupported"); if (fi->diff_type == MDC_YES) return("INTF Gated SPECT different types unsupported"); /* in pixels instead of mm */ slice_thickness=id->slice_width/((id->pixel_xsize+id->pixel_ysize)/2.); slice_separation=id->slice_spacing/((id->pixel_xsize+id->pixel_ysize)/2.); fprintf(fp,";\r\n"); fprintf(fp,"!GATED SPECT STUDY (general) :=\r\n"); msg = MdcWriteMatrixInfo(fi, 0); if (msg != NULL) return(msg); fprintf(fp,"!gated SPECT nesting outer level := %s\r\n" ,MdcGetStrGSpectNesting(gd->gspect_nesting)); fprintf(fp,"study duration (elapsed) sec := %.7g\r\n" ,gd->study_duration / 1000.); fprintf(fp,"number of cardiac cycles (observed) := %.7g\r\n" ,gd->cycles_observed); fprintf(fp,";\r\n"); fprintf(fp,"number of time windows := %u\r\n",fi->dim[5]); for (time_window=0; time_windowdim[5]; time_window++) { id = &fi->image[time_window * fi->dim[3]]; fprintf(fp,";\r\n"); fprintf(fp,"!Gated Study (each time window) :=\r\n"); fprintf(fp,"!time window number := %u\r\n",time_window+1); fprintf(fp,"!number of images in time window := %u\r\n",fi->dim[4]); fprintf(fp,"!image duration (sec) := %.7g\r\n",gd->image_duration / 1000.); fprintf(fp,"framing method := Forward\r\n"); fprintf(fp,"time window lower limit (sec) := %.7g\r\n" ,gd->window_low / 1000.); fprintf(fp,"time window upper limit (sec) := %.7g\r\n" ,gd->window_high / 1000.); if (gd->cycles_observed > 0.) { v = (gd->cycles_acquired * 100.) / gd->cycles_observed; }else{ v = 100.; } fprintf(fp,"%% R-R cycles acquired this window := %.7g\r\n",v); fprintf(fp,"number of cardiac cycles (acquired) := %.7g\r\n" ,gd->cycles_acquired); fprintf(fp,"study duration (acquired) sec := %.7g\r\n" ,gd->study_duration / 1000.); fprintf(fp,"!maximum pixel count := "); if (MDC_FORCE_INT != MDC_NO) { switch (MDC_FORCE_INT) { case BIT8_U: fprintf(fp,"%+e",(float)MDC_MAX_BIT8_U); break; case BIT16_S: fprintf(fp,"%+e",(float)MDC_MAX_BIT16_S); break; default: fprintf(fp,"%+e",(float)MDC_MAX_BIT16_S); } }else if (MDC_QUANTIFY || MDC_CALIBRATE) { fprintf(fp,"%+e",id->qfmax); }else{ fprintf(fp,"%+e",id->fmax); } fprintf(fp,"\r\n"); fprintf(fp,"R-R histogram := N\r\n"); } fprintf(fp,";\r\n"); fprintf(fp,"number of detector heads := %u\r\n",fi->dim[6]); for (head=0; headacqnr && fi->acqdata != NULL) { acq = &fi->acqdata[ACQI]; }else{ acq = &tmpacq; MdcInitAD(acq); } fprintf(fp,";\r\n"); fprintf(fp,"!number of images/energy window := %u\r\n",images_per_window); fprintf(fp,"!process status := "); if (fi->reconstructed == MDC_NO) { fprintf(fp,"Acquired\r\n"); }else{ fprintf(fp,"Reconstructed\r\n"); } fprintf(fp,"!number of projections := %g\r\n",gd->nr_projections); fprintf(fp,"!extent of rotation := %g\r\n",gd->extent_rotation); fprintf(fp,"!time per projection (sec) := %.7g\r\n" ,gd->time_per_proj / 1000.0); fprintf(fp,"patient orientation := %s\r\n" ,MdcSetPatOrientation(fi->pat_slice_orient)); fprintf(fp,"patient rotation := %s\r\n" ,MdcSetPatRotation(fi->pat_slice_orient)); if (fi->reconstructed == MDC_NO) { fprintf(fp,";\r\n"); fprintf(fp,"!SPECT STUDY (acquired data) :=\r\n"); fprintf(fp,"!direction of rotation := "); switch (acq->rotation_direction) { case MDC_ROTATION_CW: fprintf(fp,"CW"); break; case MDC_ROTATION_CC: fprintf(fp,"CCW"); break; } fprintf(fp,"\r\n"); fprintf(fp,"start angle := %g",acq->angle_start); fprintf(fp,"\r\n"); fprintf(fp,"first projection angle in data set :=\r\n"); fprintf(fp,"acquisition mode := "); if (acq != NULL) { switch (acq->detector_motion) { case MDC_MOTION_STEP: fprintf(fp,"stepped"); break; case MDC_MOTION_CONT: fprintf(fp,"continuous"); break; default : fprintf(fp,"unknown"); } fprintf(fp,"\r\n"); if (acq->rotation_offset != 0.) { fprintf(fp,"Centre_of_rotation := Single_value\r\n"); fprintf(fp,"!X_offset := %.7g\r\n",acq->rotation_offset); fprintf(fp,"Y_offset := 0.\r\n"); fprintf(fp,"Radius := %.7g\r\n",acq->radial_position); }else{ fprintf(fp,"Centre_of_rotation := Corrected\r\n"); } }else{ fprintf(fp,"\r\n"); } fprintf(fp,"orbit := circular\r\n"); fprintf(fp,"preprocessed :=\r\n"); }else{ fprintf(fp,";\r\n"); fprintf(fp,"!SPECT STUDY (reconstructed data) :=\r\n"); fprintf(fp,"method of reconstruction := %s\r\n",fi->recon_method); fprintf(fp,"!number of slices := %u\r\n",planes); fprintf(fp,"number of reference frame := 0\r\n"); fprintf(fp,"slice orientation := %s\r\n", MdcGetStrSliceOrient(fi->pat_slice_orient)); fprintf(fp,"slice thickness (pixels) := %+e\r\n",slice_thickness); fprintf(fp,"centre-centre slice separation (pixels) := %+e\r\n", slice_separation); fprintf(fp,"filter name := %s\r\n",fi->filter_type); fprintf(fp,"filter parameters := Cutoff\r\n"); /*fprintf(fp,"z-axis filter :=\r\n");*/ /*fprintf(fp,"attenuation correction coefficient/cm :=\r\n");*/ fprintf(fp,"method of attenuation correction := measured\r\n"); fprintf(fp,"scatter corrected := N\r\n"); /*fprintf(fp,"method of scatter correction :=\r\n");*/ fprintf(fp,"oblique reconstruction := N\r\n"); /*fprintf(fp,"oblique orientation :=\r\n");*/ } } return(NULL); } char *MdcWriteIntfHeader(FILEINFO *fi) { FILE *fp = fi->ofp; char *msg=NULL; int i, t, offset=0; if (MDC_SINGLE_FILE == MDC_YES) fseek(fp,0,SEEK_SET); /* at begin of file */ fprintf(fp,"!INTERFILE :=\r\n"); fprintf(fp,"!imaging modality := nucmed\r\n"); fprintf(fp,"!originating system := %s\r\n",fi->manufacturer); fprintf(fp,"!version of keys := %s\r\n",MDC_INTF_SUPP_VERS); fprintf(fp,"date of keys := %s\r\n",MDC_INTF_SUPP_DATE); fprintf(fp,"conversion program := %s\r\n",MDC_PRGR); fprintf(fp,"program author := Erik Nolf\r\n"); fprintf(fp,"program version := %s\r\n",MDC_VERSION); fprintf(fp,"program date := %s\r\n",MdcGetProgramDate()); fprintf(fp,";\r\n"); fprintf(fp,"!GENERAL DATA :=\r\n"); fprintf(fp,"original institution := %s\r\n",fi->institution); if (MDC_SINGLE_FILE == MDC_YES) offset = MDC_INTF_DATA_OFFSET; fprintf(fp,"!data offset in bytes := %d\r\n",offset); if (XMDC_GUI == MDC_YES) MdcSplitPath(fi->opath,fi->odir,fi->ofname); MdcNewExt(fi->ofname,NULL,"i33"); fprintf(fp,"!name of data file := %s\r\n",fi->ofname); MdcNewExt(fi->ofname,NULL,FrmtExt[MDC_FRMT_INTF]); if (XMDC_GUI == MDC_YES) MdcMergePath(fi->opath,fi->odir,fi->ofname); fprintf(fp,"patient name := %s\r\n",fi->patient_name); fprintf(fp,"!patient ID := %s\r\n",fi->patient_id); i=0; t=0; while (i < MDC_MAXSTR && i < strlen(fi->patient_dob)) { if (i==4 || i==6) { mdcbufr[t++]=':'; } mdcbufr[t++]=fi->patient_dob[i++]; } mdcbufr[t]='\0'; fprintf(fp,"patient dob := %s\r\n",mdcbufr); fprintf(fp,"patient sex := %s\r\n",fi->patient_sex); fprintf(fp,"!study ID := %s\r\n",fi->study_id); fprintf(fp,"exam type := %s\r\n",fi->series_descr); fprintf(fp,"data compression := none\r\n"); fprintf(fp,"data encode := none\r\n"); fprintf(fp,"organ := %s\r\n",fi->organ_code); if (strcmp(fi->radiopharma,"Unknown") == 0) { fprintf(fp,"isotope := %s\r\n",fi->isotope_code); }else{ fprintf(fp,"isotope := %s/%s\r\n",fi->isotope_code,fi->radiopharma); } fprintf(fp,"dose := %g\r\n",fi->injected_dose); #if MDC_INTF_SUPPORT_NUD fprintf(fp,"NUD/Patient Weight [kg] := %.2f\r\n",fi->patient_weight); fprintf(fp,"NUD/imaging modality := %s\r\n",MdcGetStrModality(fi->modality)); fprintf(fp,"NUD/activity := %g\r\n",fi->injected_dose); fprintf(fp,"NUD/activity start time := %02d:%02d:%02d\r\n" ,fi->dose_time_hour ,fi->dose_time_minute ,fi->dose_time_second); fprintf(fp,"NUD/isotope half life [hours] := %f\r\n" ,fi->isotope_halflife / 3600.); #endif msg = MdcWriteGenImgData(fi); if (msg != NULL) return(msg); msg = MdcWriteWindows(fi); if (msg != NULL) return(msg); fprintf(fp,"!END OF INTERFILE :=\r\n%c",MDC_CNTRL_Z); if (ferror(fp)) return("INTF Bad write header file"); if (MDC_SINGLE_FILE && (ftell(fp) >= offset)) return("INTF Predefined data offset in bytes too small"); return(NULL); } char *MdcWriteIntfImages(FILEINFO *fi) { IMG_DATA *id; FILE *fp = fi->ofp; Uint32 i, size; Uint8 *buf; if (MDC_SINGLE_FILE == MDC_YES) fseek(fp,MDC_INTF_DATA_OFFSET,SEEK_SET); for (i=0; inumber; i++) { if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_INCR,1./(float)fi->number,NULL); id = &fi->image[i]; size = id->width * id->height; if (MDC_FORCE_INT != MDC_NO) { switch (MDC_FORCE_INT) { case BIT8_U: buf = MdcGetImgBIT8_U(fi, i); if (buf == NULL) return("INTF Bad malloc Uint8 buffer"); /* no endian swap necessary */ if (fwrite(buf,(unsigned)MdcType2Bytes(BIT8_U),size,fp) != size) { MdcFree(buf); return("INTF Bad write Uint8 image"); } break; case BIT16_S: buf = MdcGetImgBIT16_S(fi, i); if (buf == NULL) return("INTF Bad malloc Int16 buffer"); if (MDC_FILE_ENDIAN != MDC_HOST_ENDIAN) MdcMakeImgSwapped(buf,fi,i,id->width,id->height,BIT16_S); if (fwrite(buf,(unsigned)MdcType2Bytes(BIT16_S),size,fp) != size) { MdcFree(buf); return("INTF Bad write Int16 image"); } break; default: buf = MdcGetImgBIT16_S(fi, i); if (buf == NULL) return("INTF Bad malloc Int16 buffer"); if (MDC_FILE_ENDIAN != MDC_HOST_ENDIAN) MdcMakeImgSwapped(buf,fi,i,id->width,id->height,BIT16_S); if (fwrite(buf,(unsigned)MdcType2Bytes(BIT16_S),size,fp) != size) { MdcFree(buf); return("INTF Bad write Int16 image"); } } MdcFree(buf); }else if (!(MDC_QUANTIFY || MDC_CALIBRATE)) { switch ( id->type ) { case BIT1: return("INTF 1-Bit format unsupported"); break; case ASCII: return("INTF Ascii format unsupported"); break; default: if (MDC_FILE_ENDIAN != MDC_HOST_ENDIAN && id->type != BIT8_U && id->type != BIT8_S) { buf = MdcGetImgSwapped(fi,i); if (buf == NULL) return("INTF Couldn't malloc swapped image"); if (fwrite(buf,(unsigned)MdcType2Bytes(id->type),size,fp) !=size) { MdcFree(buf); return("INTF Bad write swapped image"); } MdcFree(buf); }else{ if (fwrite(id->buf,(unsigned)MdcType2Bytes(id->type),size,fp) !=size) { return("INTF Bad write image"); } } } }else{ buf = MdcGetImgFLT32( fi, i); if (buf == NULL) return("INTF Bad malloc buf"); if (MDC_FILE_ENDIAN != MDC_HOST_ENDIAN) MdcMakeImgSwapped(buf,fi,i,id->width,id->height,FLT32); if (fwrite(buf,(unsigned)MdcType2Bytes(FLT32),size,fp) != size) { MdcFree(buf); return("INTF Bad write quantified image"); } MdcFree(buf); } } return NULL; } const char *MdcWriteINTF(FILEINFO *fi) { const char *err; char tmpfname[MDC_MAX_PATH + 1]; MDC_FILE_ENDIAN = MDC_WRITE_ENDIAN; /* get filename */ if (XMDC_GUI == MDC_YES) { strcpy(tmpfname,fi->opath); }else{ if (MDC_ALIAS_NAME == MDC_YES) { MdcAliasName(fi,tmpfname); }else{ strcpy(tmpfname,fi->ifname); } MdcDefaultName(fi,MDC_FRMT_INTF,fi->ofname,tmpfname); } if (MDC_PROGRESS) MdcProgress(MDC_PROGRESS_BEGIN,0.,"Writing InterFile:"); if (MDC_VERBOSE) MdcPrntMesg("INTF Writing <%s> & <.i33> ...",fi->ofname); /* check for colored files */ if (fi->map == MDC_MAP_PRESENT) return("INTF Colored files unsupported"); /* first we write the image file */ if (XMDC_GUI == MDC_YES) { fi->ofname[0]='\0'; MdcNewExt(fi->ofname,tmpfname,"i33"); }else{ MdcNewName(fi->ofname,tmpfname,"i33"); } if (MDC_FILE_STDOUT == MDC_YES) { /* send image data to stdout (1>stdout) */ fi->ofp = stdout; }else{ if (MdcKeepFile(fi->ofname)) return("INTF Image file exists!!"); if ( (fi->ofp=fopen(fi->ofname,"wb")) == NULL) return("INTF Couldn't open image file"); } err = MdcWriteIntfImages(fi); if (err != NULL) return(err); /* write header, now we got rescale info */ if (MDC_SINGLE_FILE == MDC_NO) { MdcCloseFile(fi->ofp); if (XMDC_GUI == MDC_YES) { strcpy(fi->ofname,tmpfname); }else{ MdcDefaultName(fi,MDC_FRMT_INTF,fi->ofname,tmpfname); } } if (MDC_FILE_STDOUT == MDC_YES) { /* send header to stderr (2>stderr) */ fi->ofp = stderr; }else if (MDC_SINGLE_FILE == MDC_NO) { if (MdcKeepFile(fi->ofname)) return("INTF Header file exists!!"); if ( (fi->ofp=fopen(fi->ofname,"wb")) == NULL) return("INTF Couldn't open header file"); } MdcCheckIntfDim(fi); err = MdcWriteIntfHeader(fi); if (err != NULL) return(err); MdcCloseFile(fi->ofp); return NULL; } xmedcon-0.14.1/source/xutils.h0000644000175000017510000000544012636253503013165 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xutils.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xutils.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xutils.h,v 1.21 2015/12/22 13:59:31 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XUTILS_H__ #define __XUTILS_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcMedconQuit(GtkWidget *widget, gpointer data); void XMdcMainWidgetsInsensitive(void); void XMdcMainWidgetsResensitive(void); void XMdcWidgetCallbackDestroy(GtkWidget *window); void XMdcConfigureXMedcon(void); void XMdcAskYesNo(GtkSignalFunc YesFunc, GtkSignalFunc NoFunc, char *question); void XMdcShowWidget(GtkWidget *w); void XMdcWidgetDestroy(GtkWidget *widget, gpointer data); void XMdcSetGbcCorrection(ColorModifier *mod); Uint8 *XMdcBuildRgbImage(Uint8 *img8, Int16 type, Uint32 pixels, Uint8 *vgbc); GdkPixbuf *XMdcBuildGdkPixbuf(Uint8 *img8, Uint32 w, Uint32 h, Int16 type, Uint8 *vgbc); GdkPixbuf *XMdcBuildGdkPixbufFI(FILEINFO *fi,Uint32 i,Uint8 *vgbc); gboolean XMdcPreventDelete(GtkWidget *widget, GdkEvent *event, gpointer data); gboolean XMdcHandlerToHide(GtkWidget *widget, GdkEvent *event, gpointer data); void XMdcFreeRGB(guchar *pixdata, gpointer data); void XMdcToggleVisibility(GtkWidget *widget); void XMdcSetImageScales(void); Uint32 XMdcScaleW(Uint32 width); Uint32 XMdcScaleH(Uint32 height); #endif xmedcon-0.14.1/source/xzoom.c0000644000175000017510000002240112636253503013000 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xzoom.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : image zoom routines * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcImagesZoomIn() - Zoom image IN * * XMdcImagesZoomOut() - Zoom image OUT * * XMdcImagesZoomCallbackClicked() - Zoom Clicked callback * * XMdcImagesZoom() - Display zoomed image * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xzoom.c,v 1.29 2015/12/22 13:59:31 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #include "xmedcon.h" /**************************************************************************** D E F I N E S ****************************************************************************/ typedef struct ZoomStruct_t { int type; Uint32 nr; GdkPixbuf *im, *cur; GtkWidget *darea; }ZoomStruct; /**************************************************************************** F U N C T I O N S ****************************************************************************/ /* local routine */ static int XMdcGetZoomFactor(ZoomStruct *zoom, int z) { zoom->type += z; /* incr/decr */ /* prevent zero (= not allowed) and -1 (= 1 original) */ if (zoom->type == 0 || zoom->type == -1) { switch (z) { case XMDC_ZOOM_IN : zoom->type = 1; break; case XMDC_ZOOM_OUT: zoom->type = -2; break; default : zoom->type = 1; } } return(zoom->type); } /* local routine */ static char *XMdcGetStrZoomFactor(int type) { if (type < 0) { sprintf(xmdcstr,"[1:%d]",-type); }else{ sprintf(xmdcstr,"[%d:1]",type); } return(xmdcstr); } /* local routine */ static void XMdcSetZoomWindowTitle(GtkWidget *window, ZoomStruct *zoom) { Uint32 nr = zoom->nr + 1; sprintf(mdcbufr,"%u %s",nr,XMdcGetStrZoomFactor(zoom->type)); gtk_window_set_title(GTK_WINDOW(window),mdcbufr); } /* local routine */ static void XMdcRemoveZoomStruct(GtkWidget *window, gpointer data) { ZoomStruct *zoom = (ZoomStruct *)data; if (zoom != NULL) { if (zoom->im != NULL) g_object_unref(zoom->im); if (zoom->cur != NULL) g_object_unref(zoom->cur); MdcFree(zoom); } } /* local routine */ static gboolean XMdcImagesZoomCallbackExpose(GtkWidget *widget, GdkEventExpose *event, gpointer window) { GdkGC *gc = widget->style->fg_gc[GTK_STATE_NORMAL]; ZoomStruct *zoom; zoom = (ZoomStruct *)gtk_object_get_data(GTK_OBJECT(window),"zoomstruct"); if (event->area.width <= gdk_pixbuf_get_width(zoom->cur) && event->area.height <= gdk_pixbuf_get_height(zoom->cur)) { gdk_pixbuf_render_to_drawable(zoom->cur, widget->window, gc, event->area.x, event->area.y, event->area.x, event->area.y, event->area.width, event->area.height, sRenderSelection.Dither, 0, 0); } return(TRUE); } void XMdcImagesZoomIn(GtkWidget *window) { GdkPixbuf *new; ZoomStruct *zoom; int w, h, z; #ifdef _WIN32 gtk_widget_hide(window); #endif zoom = (ZoomStruct *)gtk_object_get_data(GTK_OBJECT(window),"zoomstruct"); z = XMdcGetZoomFactor(zoom,XMDC_ZOOM_IN); w = gdk_pixbuf_get_width(zoom->im); h = gdk_pixbuf_get_height(zoom->im); if (z < 0) { w /= -z; h /= -z; }else{ w *= z; h *= z; } gtk_window_set_policy(GTK_WINDOW(window),TRUE,TRUE,TRUE); new = gdk_pixbuf_scale_simple(zoom->im,w,h,sRenderSelection.Interp); g_object_unref(zoom->cur); zoom->cur = new; gtk_drawing_area_size(GTK_DRAWING_AREA(zoom->darea),w,h); gdk_pixbuf_render_to_drawable(zoom->cur, zoom->darea->window, zoom->darea->style->fg_gc[GTK_STATE_NORMAL], 0,0,0,0,w,h,sRenderSelection.Dither,0,0); XMdcSetZoomWindowTitle(window,zoom); gtk_window_set_policy(GTK_WINDOW(window),FALSE,FALSE,FALSE); #ifdef _WIN32 gtk_widget_show(window); #endif } void XMdcImagesZoomOut(GtkWidget *window) { GdkPixbuf *new; ZoomStruct *zoom; int w, h, z; #ifdef _WIN32 gtk_widget_hide(window); #endif zoom = (ZoomStruct *)gtk_object_get_data(GTK_OBJECT(window),"zoomstruct"); z = XMdcGetZoomFactor(zoom,XMDC_ZOOM_OUT); w = gdk_pixbuf_get_width(zoom->im); h = gdk_pixbuf_get_height(zoom->im); if (z < 0) { w /= -z; h /= -z; }else{ w *= z; h *= z; } gtk_window_set_policy(GTK_WINDOW(window),TRUE,TRUE,TRUE); new = gdk_pixbuf_scale_simple(zoom->im,w,h,sRenderSelection.Interp); g_object_unref(zoom->cur); zoom->cur = new; gtk_drawing_area_size(GTK_DRAWING_AREA(zoom->darea),w,h); gdk_pixbuf_render_to_drawable(zoom->cur, zoom->darea->window, zoom->darea->style->fg_gc[GTK_STATE_NORMAL], 0,0,0,0,w,h,sRenderSelection.Dither,0,0); XMdcSetZoomWindowTitle(window,zoom); gtk_window_set_policy(GTK_WINDOW(window),FALSE,FALSE,FALSE); #ifdef _WIN32 gtk_widget_show(window); #endif } gboolean XMdcImagesZoomCallbackClicked(GtkWidget *widget, GdkEventButton *button, GtkWidget *window) { if (button->button == 3) gtk_widget_destroy(window); if (button->button == 1) XMdcImagesZoomIn(window); if (button->button == 2) XMdcImagesZoomOut(window); return(TRUE); } void XMdcImagesZoom(GtkWidget *widget, Uint32 nr) { GtkWidget *window; GtkWidget *tblbox; GtkWidget *darea; ZoomStruct *zoom=NULL; int w, h, z, w_zoom, h_zoom; /* allocate structure */ zoom = (ZoomStruct *)malloc(sizeof(ZoomStruct)); if (zoom == NULL) { XMdcDisplayErr("Couldn't allocate zoom struct"); return; }else{ zoom->nr = my.realnumber[nr]; zoom->type = sResizeSelection.CurType; zoom->im = NULL; zoom->cur = NULL; } w = (int)XMdcScaleW(my.fi->image[zoom->nr].width); w_zoom = w; h = (int)XMdcScaleH(my.fi->image[zoom->nr].height); h_zoom = h; z = XMdcGetZoomFactor(zoom,XMDC_ZOOM_NONE); if (z < 0) { w_zoom /= -z; h_zoom /= -z; }else{ w_zoom *= z; h_zoom *= z; } /* initial pixmap must be original image; so no resize here */ my.RESIZE = MDC_NO; zoom->im = XMdcBuildGdkPixbufFI(my.fi,zoom->nr,sGbc.mod.vgbc); my.RESIZE = MDC_YES; zoom->cur = gdk_pixbuf_scale_simple(zoom->im,w,h,sRenderSelection.Interp); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_policy(GTK_WINDOW(window),TRUE,TRUE,TRUE); gtk_container_set_border_width(GTK_CONTAINER(window),1); gtk_signal_connect(GTK_OBJECT(window),"destroy", GTK_SIGNAL_FUNC(XMdcRemoveZoomStruct),zoom); gtk_signal_connect(GTK_OBJECT(window),"destroy", GTK_SIGNAL_FUNC(gtk_widget_destroy),NULL); tblbox = gtk_table_new(1,1,TRUE); gtk_container_add(GTK_CONTAINER(window),tblbox); gtk_widget_show(tblbox); darea = gtk_drawing_area_new(); zoom->darea = darea; gtk_table_attach(GTK_TABLE(tblbox),darea,0,1,0,1,GTK_FILL,GTK_FILL,0,0); gtk_widget_show(darea); gtk_widget_set_events(darea, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK); gtk_drawing_area_size(GTK_DRAWING_AREA(darea),w,h); gtk_signal_connect(GTK_OBJECT(darea),"button_press_event", GTK_SIGNAL_FUNC(XMdcImagesZoomCallbackClicked), GTK_WIDGET(window)); gtk_signal_connect(GTK_OBJECT(darea),"expose_event", GTK_SIGNAL_FUNC(XMdcImagesZoomCallbackExpose), GTK_WIDGET(window)); XMdcShowWidget(window); gdk_window_set_cursor (window->window, fleurcursor); gtk_object_set_data(GTK_OBJECT(window),"zoomstruct",zoom); XMdcSetZoomWindowTitle(window,zoom); gtk_window_set_policy(GTK_WINDOW(window),FALSE,FALSE,FALSE); } xmedcon-0.14.1/source/xwriter.c0000644000175000017510000000602712636253503013336 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xwriter.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : file writer * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcWriteFile() - Write file routine * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xwriter.c,v 1.21 2015/12/22 13:59:31 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include #include "xmedcon.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ int XMdcWriteFile(int format_to_save) { char *msg; switch (MDC_FILE_SPLIT) { case MDC_SPLIT_PER_SLICE: msg = MdcSplitSlices(my.fi,format_to_save,(int)write_counter); if (msg != NULL) { XMdcDisplayErr("File Split - %s",msg); return(MDC_NO); } break; case MDC_SPLIT_PER_FRAME: msg = MdcSplitFrames(my.fi,format_to_save,(int)write_counter); if (msg != NULL) { XMdcDisplayErr("File Split - %s",msg); return(MDC_NO); } break; default: if (MdcWriteFile(my.fi,format_to_save,(int)write_counter,NULL) != MDC_OK) { XMdcDisplayErr("Failure writing file"); write_counter-=1; return(MDC_NO); } } XMdcDisplayMesg("File successfully written"); return(MDC_YES); } xmedcon-0.14.1/source/xreset.h0000644000175000017510000000362312636253502013147 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xreset.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xreset.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xreset.h,v 1.16 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XRESET_H__ #define __XRESET_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcStructsReset(void); void XMdcViewerReset(void); void XMdcFileReset(void); void XMdcColorMapReset(int map); #endif xmedcon-0.14.1/source/m-dicm.h0000644000175000017510000000537012636253502013004 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-dicm.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-dicm.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-dicm.h,v 1.21 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_DICM_H__ #define __M_DICM_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_DICM_SIG "dicm" #define MDC_DICM_PIXEL_TYPE BIT16_U /* maximun length UID string */ #define MDC_UID_MAXSTR 64 /* some specific type UID values */ #define MDC_TYPE_UID_UNKNOWN 0 /* anything else */ #define MDC_TYPE_UID_MEDIA_INSTANCE 1 /* 0x0002:0x0003 */ #define MDC_TYPE_UID_CREATOR 2 /* 0x0002:0x0014 */ #define MDC_TYPE_UID_SOP_INSTANCE 3 /* 0x0008:0x0018 */ #define MDC_TYPE_UID_STUDY 4 /* 0x0020:0x000D */ #define MDC_TYPE_UID_SERIES 5 /* 0x0020:0x000E */ #define MDC_TYPE_UID_FRAME 6 /* 0x0020:0x0052 */ /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcCheckDICM(FILEINFO *fi); const char *MdcReadDICM(FILEINFO *fi); const char *MdcWriteDICM(FILEINFO *fi); int MdcCheckMosaic(FILEINFO *fi, MDC_DICOM_STUFF_T *dicom); #endif xmedcon-0.14.1/source/xcolgbc.h0000644000175000017510000000472512636253502013262 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xcolgbc.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xcolgbc.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xcolgbc.h,v 1.16 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XCOLGBC_H__ #define __XCOLGBC_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ gboolean XMdcColGbcCorrectExpose(GtkWidget *widget ,GdkEventExpose *event, gpointer data); void XMdcColGbcCorrectUpdate(void); void XMdcColGbcCorrectMakeIcons(void); void XMdcColGbcCorrectAddImg(GtkWidget *w); void XMdcColGbcCorrectModValue(GtkWidget *widget, SliderValueStruct *v); void XMdcColGbcCorrectResetValue(GtkWidget *widget, SliderValueStruct *v); void XMdcColGbcCorrectAddOneSlider(GtkWidget *w, int *value, GtkWidget *ic , SliderValueStruct *sv); void XMdcColGbcCorrectAddSliders(GtkWidget *w); void XMdcColGbcCorrectApply(GtkWidget *widget, gpointer data); void XMdcColGbcCorrectSel(GtkWidget *widget, Uint32 nr); #endif xmedcon-0.14.1/source/xmedcon.h0000644000175000017510000000477212636253502013300 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xmedcon.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xmedcon.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xmedcon.h,v 1.21 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XMEDCON_H__ #define __XMEDCON_H__ /**************************************************************************** H E A D E R S ****************************************************************************/ #include #include #include #include #define __M_XDUMMY_H__ 1 #include "medcon.h" #include "xicons.h" #include "xerror.h" #include "xprogbar.h" #include "xfilesel.h" #include "xmnuftry.h" #include "xdefs.h" #include "xfiles.h" #include "xreset.h" #include "xreader.h" #include "xwriter.h" #include "xoptions.h" #include "xviewer.h" #include "ximages.h" #include "xzoom.h" #include "xinfo.h" #include "xlabels.h" #include "xcolmap.h" #include "xcolgbc.h" #include "xresize.h" #include "xrender.h" #include "xpages.h" #include "xfancy.h" #include "xhelp.h" #include "xutils.h" #include "xextract.h" #include "xreslice.h" #include "xtransf.h" #include "xvifi.h" #endif xmedcon-0.14.1/source/xreslice.h0000644000175000017510000000354112636253502013452 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xreslice.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xreslice.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xreslice.h,v 1.15 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XRESLICE_H__ #define __XRESLICE_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcResliceImages(GtkWidget *widget, guint projection); #endif xmedcon-0.14.1/source/m-matrix.c0000644000175000017510000017367012636253502013400 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-matrix.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : CTI source for handling ECAT 6.4 files * * * * project : (X)MedCon by Erik Nolf * * * * Notes : Source code addapted from CTI PET Systems, Inc. * * Original code 2.6 10/19/93 Copyright 1989-1993 * * * * Changed code for swapping & the use of our data types * * with machine independency as target * * * * Put "mdc" prefix on functions and structs to prevent * * naming conflicts with other tools based on CTI code * * * * Added functions for ECAT 7 reading support * * * * Original CTI Authors listed: * * E. Phearson * * L. Davis * * Yaorong * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-matrix.c,v 1.38 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #ifndef _WIN32 #include #endif #endif #include "medcon.h" /*************************************************************************** D E F I N E S ***************************************************************************/ struct ExpMatDir { int matnum; int strtblk; int endblk; int matstat; float anatloc; }; /**************************************************************************** F U N C T I O N S ****************************************************************************/ /*********************************************************/ FILE *mdc_mat_open( fname, fmode) char *fname, *fmode; { FILE *fptr; fptr = fopen(fname, fmode); return (fptr); } /*********************************************************/ void mdc_mat_close( fptr) FILE *fptr; { MdcCloseFile( fptr); } /*********************************************************/ Int32 mdc_mat_rblk( fptr, blkno, bufr, nblks) FILE *fptr; Int32 blkno, nblks; Uint8 *bufr; { int r; fseek( fptr, (blkno-1)*MdcMatBLKSIZE, 0); r = fread( bufr, 1, (unsigned)(nblks*MdcMatBLKSIZE), fptr); if (r != (nblks*MdcMatBLKSIZE)) return(-1); return (0); } /*********************************************************/ Int32 mdc_mat_list( fptr, mlist, lmax) FILE *fptr; struct Mdc_MatDir mlist[]; Int32 lmax; { Int32 blk, num_entry, num_stored, i; Int32 nxtblk, matnum, strtblk, endblk, matstat; Int32 dirbufr[MdcMatBLKSIZE/4]; Uint8 bytebufr[MdcMatBLKSIZE]; blk = MdcMatFirstDirBlk; num_entry = 0; num_stored = 0; while(1) { mdc_mat_rblk( fptr, blk, bytebufr,1); if ( MdcHostBig() ) { MdcSWAB( (Uint8 *)bytebufr, (Uint8 *)dirbufr, MdcMatBLKSIZE); MdcSWAW( (Uint16 *)dirbufr, (Uint16 *)dirbufr, MdcMatBLKSIZE/2); }else{ memcpy(dirbufr, bytebufr, MdcMatBLKSIZE); } /* nfree = dirbufr[0]; */ nxtblk = dirbufr[1]; /* prvblk = dirbufr[2]; */ /* nused = dirbufr[3]; */ for (i=4; iframe = matnum&0xFFF; matval->plane = (matnum>>16)&0xFF; matval->gate = (matnum>>24)&0x3F; matval->data = (matnum>>30)&0x3; matval->bed = (matnum>>12)&0xF; return 0; } */ /******************************************************** new version supporting 512 planes, 1024 planes, 8 data types */ Int32 mdc_mat_numcod( frame, plane, gate, data, bed) Int32 frame, plane, gate, data, bed; { Int32 matnum8data16bed64gate1024plane512frame, loPlane, hiPlane = 0, loData, hiData = 0; hiPlane = (plane & 0x300); loPlane = (plane & 0xFF); loData = (data & 0x3); hiData = (data & 0x4); matnum8data16bed64gate1024plane512frame = ((frame & 0x1FF) | ((bed & 0xF) << 12) | ((loPlane << 16) | (hiPlane << 1)) | ((gate & 0x3F) << 24) | ((loData << 30) | (hiData << 9))); return (matnum8data16bed64gate1024plane512frame); } /******************************************************** new version supporting 512 planes, 1024 planes, 8 data types */ Int32 mdc_mat_numdoc( matnum, matval) Int32 matnum; struct Mdc_Matval *matval; { Int32 loPlane, hiPlane = 0, loData, hiData = 0; matval->frame = matnum & 0x1FF; loPlane = (matnum >> 16) & 0xFF; hiPlane = (matnum >> 1) & 0x300; matval->plane = loPlane | hiPlane; matval->gate = (matnum >> 24) & 0x3F; loData = (matnum >> 30) & 0x3; hiData = (matnum >> 9) & 0x4; matval->data = loData | hiData; matval->bed = (matnum >> 12) & 0xF; return 0; } /*********************************************************/ Int32 mdc_mat_lookup( fptr, matnum, entry) FILE *fptr; Int32 matnum; struct Mdc_MatDir *entry; { Int32 blk, i; Int32 nxtblk, matnbr, strtblk, endblk, matstat; Int32 dirbufr[MdcMatBLKSIZE/4]; Uint8 bytebufr[MdcMatBLKSIZE]; blk = MdcMatFirstDirBlk; while(1) { mdc_mat_rblk( fptr, blk, bytebufr,1); if ( MdcHostBig() ) { MdcSWAB( (Uint8 *)bytebufr, (Uint8 *)dirbufr, MdcMatBLKSIZE); MdcSWAW( (Uint16 *)dirbufr, (Uint16 *)dirbufr, MdcMatBLKSIZE/2); }else{ memcpy(dirbufr, bytebufr, MdcMatBLKSIZE); } /* nfree = dirbufr[0]; */ nxtblk = dirbufr[1]; /* prvblk = dirbufr[2]; */ /* nused = dirbufr[3]; */ for (i=4; imatnum = matnbr; entry->strtblk = strtblk; entry->endblk = endblk; entry->matstat = matstat; return (1); } } blk = nxtblk; if (blk == MdcMatFirstDirBlk) break; } return (0); } /*********************************************************/ Int32 mdc_mat_lookup7( fptr, matnum, entry) FILE *fptr; Int32 matnum; struct Mdc_MatDir *entry; { Int32 blk, i; Int32 nxtblk, matnbr, strtblk, endblk, matstat; Int32 dirbufr[MdcMatBLKSIZE/4]; Uint8 bytebufr[MdcMatBLKSIZE]; blk = MdcMatFirstDirBlk; while(1) { mdc_mat_rblk( fptr, blk, bytebufr,1); if ( ! MdcHostBig() ) { MdcSWAB( (Uint8 *)bytebufr, (Uint8 *)dirbufr, MdcMatBLKSIZE); MdcSWAW( (Uint16 *)dirbufr, (Uint16 *)dirbufr, MdcMatBLKSIZE/2); }else{ memcpy(dirbufr, bytebufr, MdcMatBLKSIZE); } /* nfree = dirbufr[0]; */ nxtblk = dirbufr[1]; /* prvblk = dirbufr[2]; */ /* nused = dirbufr[3]; */ for (i=4; imatnum = matnbr; entry->strtblk = strtblk; entry->endblk = endblk; entry->matstat = matstat; return (1); } } blk = nxtblk; if (blk == MdcMatFirstDirBlk) break; } return (0); } /*********************************************************/ Int32 mdc_mat_read_main_header( fptr, h) FILE *fptr; Mdc_Main_header *h; { Int16 b[256]; char *bb; Int32 err, i; err = mdc_mat_rblk(fptr,1,(Uint8 *)b,1);/* read main header at block 1*/ if (err) return(err); bb = (char *)b; strncpy( h->original_file_name, bb+28, 20); strncpy( h->node_id, bb+56, 10); strncpy( h->isotope_code, bb+78, 8); strncpy( h->radiopharmaceutical, bb+90, 32); strncpy( h->study_name, bb+162, 12); strncpy( h->patient_id, bb+174, 16); strncpy( h->patient_name, bb+190, 32); h->patient_sex = bb[222]; strncpy( h->patient_age, bb+223, 10); strncpy( h->patient_height, bb+233, 10); strncpy( h->patient_weight, bb+243, 10); h->patient_dexterity = bb[253]; strncpy( h->physician_name, bb+254, 32); strncpy( h->operator_name, bb+286, 32); strncpy( h->study_description, bb+318, 32); strncpy( h->facility_name, bb+356, 20); strncpy( h->user_process_code, bb+462, 10); if (MdcHostBig()) MdcSWAB( (Uint8 *)b, (Uint8 *)b, MdcMatBLKSIZE); h->sw_version = b[24]; h->data_type = b[25]; h->system_type = b[26]; h->file_type = b[27]; h->scan_start_day = b[33]; h->scan_start_month = b[34]; h->scan_start_year = b[35]; h->scan_start_hour = b[36]; h->scan_start_minute = b[37]; h->scan_start_second = b[38]; h->isotope_halflife=mdc_get_vax_float((Uint16 *)b, 43); h->gantry_tilt = mdc_get_vax_float((Uint16 *)b, 61); h->gantry_rotation = mdc_get_vax_float((Uint16 *)b, 63); h->bed_elevation = mdc_get_vax_float((Uint16 *)b, 65); h->rot_source_speed = b[67]; h->wobble_speed = b[68]; h->transm_source_type = b[69]; h->axial_fov = mdc_get_vax_float((Uint16 *)b, 70); h->transaxial_fov = mdc_get_vax_float((Uint16 *)b, 72); h->transaxial_samp_mode = b[74]; h->coin_samp_mode = b[75]; h->axial_samp_mode = b[76]; h->calibration_factor=mdc_get_vax_float((Uint16 *)b, 77); h->calibration_units = b[79]; h->compression_code = b[80]; h->acquisition_type = b[175]; h->bed_type = b[176]; h->septa_type = b[177]; h->num_planes = b[188]; h->num_frames = b[189]; h->num_gates = b[190]; h->num_bed_pos = b[191]; h->init_bed_position=mdc_get_vax_float((Uint16 *)b, 192); for (i=0; i<15; i++) h->bed_offset[i] = mdc_get_vax_float((Uint16 *)b, 194+2*i); h->plane_separation = mdc_get_vax_float((Uint16 *)b, 224); h->lwr_sctr_thres = b[226]; h->lwr_true_thres = b[227]; h->upr_true_thres = b[228]; h->collimator = mdc_get_vax_float((Uint16 *)b, 229); h->acquisition_mode = b[236]; return (0); } /*********************************************************/ Int32 mdc_mat_read_matrix_data( fptr, blk, nblks, bufr) FILE *fptr; Int32 blk, nblks; Int16 bufr[]; { Int32 error ; Mdc_Main_header h ; error = mdc_mat_read_main_header(fptr, &h) ; if(error) return(error) ; error = mdc_mat_read_mat_data(fptr, blk, nblks, (Uint8 *)bufr, h.data_type) ; return (error); } /*********************************************************/ Int32 mdc_mat_read_main_header7( fptr, h) FILE *fptr; Mdc_Main_header7 *h; { Int16 b[256]; char *bb; Int32 err, i; err = mdc_mat_rblk(fptr,1,(Uint8 *)b,1);/* read main header at block 1*/ if (err) return(err); bb = (char *)b; memcpy( h->magic_number ,bb ,14); memcpy( h->original_file_name ,bb+14 ,32); memcpy(&h->sw_version ,bb+46 , 2); MdcSWAP(h->sw_version); memcpy(&h->system_type ,bb+48 , 2); MdcSWAP(h->system_type); memcpy(&h->file_type ,bb+50 , 2); MdcSWAP(h->file_type); memcpy( h->serial_number ,bb+52 ,10); memcpy(&h->scan_start_time ,bb+62 , 4); MdcSWAP(h->scan_start_time); memcpy( h->isotope_name ,bb+66 , 8); memcpy(&h->isotope_halflife ,bb+74 , 4); MdcSWAP(h->isotope_halflife); memcpy( h->radiopharmaceutical ,bb+78 ,32); memcpy(&h->gantry_tilt ,bb+110, 4); MdcSWAP(h->gantry_tilt); memcpy(&h->gantry_rotation ,bb+114, 4); MdcSWAP(h->gantry_rotation); memcpy(&h->bed_elevation ,bb+118, 4); MdcSWAP(h->bed_elevation); memcpy(&h->intrinsic_tilt ,bb+122, 4); MdcSWAP(h->intrinsic_tilt); memcpy(&h->wobble_speed ,bb+126, 2); MdcSWAP(h->wobble_speed); memcpy(&h->transm_source_type ,bb+128, 2); MdcSWAP(h->transm_source_type); memcpy(&h->distance_scanned ,bb+130, 4); MdcSWAP(h->distance_scanned); memcpy(&h->transaxial_fov ,bb+134, 4); MdcSWAP(h->transaxial_fov); memcpy(&h->angular_compression ,bb+138, 2); MdcSWAP(h->angular_compression); memcpy(&h->coin_samp_mode ,bb+140, 2); MdcSWAP(h->coin_samp_mode); memcpy(&h->axial_samp_mode ,bb+142, 2); MdcSWAP(h->axial_samp_mode); memcpy(&h->ecat_calibration_factor,bb+144,4); MdcSWAP(h->ecat_calibration_factor); memcpy(&h->calibration_units ,bb+148, 2); MdcSWAP(h->calibration_units); memcpy(&h->calibration_units_label,bb+150,2); MdcSWAP(h->calibration_units_label); memcpy(&h->compression_code ,bb+152, 2); MdcSWAP(h->compression_code); memcpy( h->study_type ,bb+154,12); memcpy( h->patient_id ,bb+166,16); memcpy( h->patient_name ,bb+182,32); memcpy( h->patient_sex ,bb+214, 1); memcpy( h->patient_dexterity ,bb+215, 1); memcpy(&h->patient_age ,bb+216, 4); MdcSWAP(h->patient_age); memcpy(&h->patient_height ,bb+220, 4); MdcSWAP(h->patient_height); memcpy(&h->patient_weight ,bb+224, 4); MdcSWAP(h->patient_weight); memcpy(&h->patient_birth_date ,bb+228, 4); MdcSWAP(h->patient_birth_date); memcpy( h->physician_name ,bb+232,32); memcpy( h->operator_name ,bb+264,32); memcpy( h->study_description ,bb+296,32); memcpy(&h->acquisition_type ,bb+328, 2); MdcSWAP(h->acquisition_type); memcpy(&h->patient_orientation ,bb+330, 2); MdcSWAP(h->patient_orientation); memcpy( h->facility_name ,bb+332,20); memcpy(&h->num_planes ,bb+352, 2); MdcSWAP(h->num_planes); memcpy(&h->num_frames ,bb+354, 2); MdcSWAP(h->num_frames); memcpy(&h->num_gates ,bb+356, 2); MdcSWAP(h->num_gates); memcpy(&h->num_bed_pos ,bb+358, 2); MdcSWAP(h->num_bed_pos); memcpy(&h->init_bed_position ,bb+360, 4); MdcSWAP(h->init_bed_position); memcpy( h->bed_position ,bb+364,60); for (i=0; i<15; i++) MdcSWAP(h->bed_position[i]); memcpy(&h->plane_separation ,bb+424, 4); MdcSWAP(h->plane_separation); memcpy(&h->lwr_sctr_thres ,bb+428, 2); MdcSWAP(h->lwr_sctr_thres); memcpy(&h->lwr_true_thres ,bb+430, 2); MdcSWAP(h->lwr_true_thres); memcpy(&h->upr_true_thres ,bb+432, 2); MdcSWAP(h->upr_true_thres); memcpy( h->user_process_code ,bb+434,10); memcpy(&h->acquisition_mode ,bb+444, 2); MdcSWAP(h->acquisition_mode); memcpy(&h->bin_size ,bb+446, 4); MdcSWAP(h->bin_size); memcpy(&h->branching_fraction ,bb+450, 4); MdcSWAP(h->branching_fraction); memcpy(&h->dose_start_time ,bb+454, 4); MdcSWAP(h->dose_start_time); memcpy(&h->dosage ,bb+458, 4); MdcSWAP(h->dosage); memcpy(&h->well_counter_corr_factor,bb+462,4); MdcSWAP(h->well_counter_corr_factor); memcpy( h->data_units ,bb+466,32); memcpy(&h->septa_state ,bb+498, 2); MdcSWAP(h->septa_state); memcpy( h->fill_cti ,bb+500,12); return (0); } /*******************************************************************/ /* May 90, PLuk - Now reads VAX or Sun matrix files. */ Int32 mdc_mat_read_mat_data( fptr, strtblk, nblks, dptr, dtype) FILE *fptr; Int32 strtblk, nblks, dtype; Uint8 *dptr; { Int32 i, error; error = mdc_mat_rblk( fptr, strtblk, dptr, nblks); if (error) return(error); switch( dtype) { case 1: /* byte format...no translation necessary */ break; case 2: /* Vax I*2 */ if (MdcHostBig()) MdcSWAB((Uint8 *)dptr, (Uint8 *)dptr, 512*nblks); break; case 3: /* Vax I*4 */ if (MdcHostBig()) { MdcSWAB( (Uint8 *)dptr, (Uint8 *)dptr, 512*nblks); MdcSWAW( (Uint16 *)dptr, (Uint16 *)dptr, 256*nblks); } break; case 4: /* Vax R*4 */ if (MdcHostBig()) MdcSWAB( (Uint8 *)dptr, (Uint8 *)dptr, 512*nblks); for (i=0; idata_type = b[63]; h->dimension_1 = b[66]; h->dimension_2 = b[67]; h->smoothing = b[68]; h->processing_code = b[69]; h->sample_distance = mdc_get_vax_float((Uint16 *)b, 73); h->isotope_halflife = mdc_get_vax_float((Uint16 *)b, 83); h->frame_duration_sec = b[85]; h->gate_duration = mdc_get_vax_long((Uint16 *)b, 86); h->r_wave_offset = mdc_get_vax_long((Uint16 *)b, 88); h->scale_factor = mdc_get_vax_float((Uint16 *)b, 91); h->scan_min = b[96]; h->scan_max = b[97]; h->prompts = mdc_get_vax_long((Uint16 *)b, 98); h->delayed = mdc_get_vax_long((Uint16 *)b, 100); h->multiples = mdc_get_vax_long((Uint16 *)b, 102); h->net_trues = mdc_get_vax_long((Uint16 *)b, 104); for (i=0; i<16; i++) { h->cor_singles[i] = mdc_get_vax_float((Uint16 *)b, 158+2*i); h->uncor_singles[i] = mdc_get_vax_float((Uint16 *)b, 190+2*i);} h->tot_avg_cor = mdc_get_vax_float((Uint16 *)b, 222); h->tot_avg_uncor = mdc_get_vax_float((Uint16 *)b, 224); h->total_coin_rate = mdc_get_vax_long((Uint16 *)b, 226); h->frame_start_time = mdc_get_vax_long((Uint16 *)b, 228); h->frame_duration = mdc_get_vax_long((Uint16 *)b, 230); h->loss_correction_fctr = mdc_get_vax_float((Uint16 *)b, 232); for (i=0; i<8; i++) h->phy_planes[i] = mdc_get_vax_long((Uint16 *)b, 234+(2*i)); return (0); } /*********************************************************/ Int32 mdc_mat_read_scan_subheader7( fptr, blknum, h) FILE *fptr; Int32 blknum; Mdc_Scan_subheader7 *h; { Int16 b[256]; Int32 err; char *bb; err = mdc_mat_rblk( fptr, blknum, (Uint8 *)b, 1); if (err) return(err); bb = (char *)b; memcpy(&h->data_type ,bb , 2); MdcSWAP(h->data_type); memcpy(&h->num_dimensions ,bb+ 2, 2); MdcSWAP(h->num_dimensions); memcpy(&h->num_r_elements ,bb+ 4, 2); MdcSWAP(h->num_r_elements); memcpy(&h->num_angles ,bb+ 6, 2); MdcSWAP(h->num_angles); memcpy(&h->corrections_applied ,bb+ 8, 2); MdcSWAP(h->corrections_applied); memcpy(&h->num_z_elements ,bb+ 10, 2); MdcSWAP(h->num_z_elements); memcpy(&h->ring_difference ,bb+ 12, 2); MdcSWAP(h->ring_difference); memcpy(&h->x_resolution ,bb+ 14, 4); MdcSWAP(h->x_resolution); memcpy(&h->y_resolution ,bb+ 18, 4); MdcSWAP(h->y_resolution); memcpy(&h->z_resolution ,bb+ 22, 4); MdcSWAP(h->z_resolution); memcpy(&h->w_resolution ,bb+ 26, 4); MdcSWAP(h->w_resolution); return (0); } /*********************************************************/ Int32 mdc_mat_read_image_subheader( fptr, blknum, h) FILE *fptr; Int32 blknum; Mdc_Image_subheader *h; { Int16 b[256]; Int32 i, err; char *bb; err = mdc_mat_rblk( fptr, blknum, (Uint8 *)b, 1); if (err) return(err); bb = (char *)b; strncpy( h->annotation, bb+420, 40); if (MdcHostBig()) MdcSWAB( (Uint8 *)b, (Uint8 *)b, MdcMatBLKSIZE); h->data_type = b[63]; h->num_dimensions = b[64]; h->dimension_1 = b[66]; h->dimension_2 = b[67]; h->x_origin = mdc_get_vax_float((Uint16 *)b, 80); h->y_origin = mdc_get_vax_float((Uint16 *)b, 82); h->recon_scale = mdc_get_vax_float((Uint16 *)b, 84); h->quant_scale = mdc_get_vax_float((Uint16 *)b, 86); h->image_min = b[88]; h->image_max = b[89]; h->pixel_size = mdc_get_vax_float((Uint16 *)b, 92); h->slice_width = mdc_get_vax_float((Uint16 *)b, 94); h->frame_duration = mdc_get_vax_long((Uint16 *)b, 96); h->frame_start_time = mdc_get_vax_long((Uint16 *)b, 98); h->slice_location = b[100]; h->recon_start_hour = b[101]; h->recon_start_minute = b[102]; h->recon_start_sec = b[103]; h->gate_duration = mdc_get_vax_long((Uint16 *)b, 104); h->filter_code = b[118]; h->scan_matrix_num = mdc_get_vax_long((Uint16 *)b, 119); h->norm_matrix_num = mdc_get_vax_long((Uint16 *)b, 121); h->atten_cor_matrix_num = mdc_get_vax_long((Uint16 *)b, 123); h->image_rotation = mdc_get_vax_float((Uint16 *)b, 148); h->plane_eff_corr_fctr = mdc_get_vax_float((Uint16 *)b, 150); h->decay_corr_fctr = mdc_get_vax_float((Uint16 *)b, 152); h->loss_corr_fctr = mdc_get_vax_float((Uint16 *)b, 154); h->intrinsic_tilt = mdc_get_vax_float((Uint16 *)b, 156); h->processing_code = b[188]; h->quant_units = b[190]; h->recon_start_day = b[191]; h->recon_start_month = b[192]; h->recon_start_year = b[193]; h->ecat_calibration_fctr = mdc_get_vax_float((Uint16 *)b, 194); h->well_counter_cal_fctr = mdc_get_vax_float((Uint16 *)b, 196); for (i=0; i<6; i++) h->filter_params[i] = mdc_get_vax_float((Uint16 *)b, 198+2*i); return (0); } /*********************************************************/ Int32 mdc_mat_read_image_subheader7( fptr, blknum, h) FILE *fptr; Int32 blknum; Mdc_Image_subheader7 *h; { Int16 b[256]; Int32 i, err; char *bb; err = mdc_mat_rblk( fptr, blknum, (Uint8 *)b, 1); if (err) return(err); bb = (char *)b; memcpy(&h->data_type ,bb , 2); MdcSWAP(h->data_type); memcpy(&h->num_dimensions ,bb+ 2, 2); MdcSWAP(h->num_dimensions); memcpy(&h->x_dimension ,bb+ 4, 2); MdcSWAP(h->x_dimension); memcpy(&h->y_dimension ,bb+ 6, 2); MdcSWAP(h->y_dimension); memcpy(&h->z_dimension ,bb+ 8, 2); MdcSWAP(h->z_dimension); memcpy(&h->x_offset ,bb+ 10, 4); MdcSWAP(h->x_offset); memcpy(&h->y_offset ,bb+ 14, 4); MdcSWAP(h->y_offset); memcpy(&h->z_offset ,bb+ 18, 4); MdcSWAP(h->z_offset); memcpy(&h->recon_zoom ,bb+ 22, 4); MdcSWAP(h->recon_zoom); memcpy(&h->scale_factor ,bb+ 26, 4); MdcSWAP(h->scale_factor); memcpy(&h->image_min ,bb+ 30, 2); MdcSWAP(h->image_min); memcpy(&h->image_max ,bb+ 32, 2); MdcSWAP(h->image_max); memcpy(&h->x_pixel_size ,bb+ 34, 4); MdcSWAP(h->x_pixel_size); memcpy(&h->y_pixel_size ,bb+ 38, 4); MdcSWAP(h->y_pixel_size); memcpy(&h->z_pixel_size ,bb+ 42, 4); MdcSWAP(h->z_pixel_size); memcpy(&h->frame_duration ,bb+ 46, 4); MdcSWAP(h->frame_duration); memcpy(&h->frame_start_time ,bb+ 50, 4); MdcSWAP(h->frame_start_time); memcpy(&h->filter_code ,bb+ 54, 2); MdcSWAP(h->filter_code); memcpy(&h->x_resolution ,bb+ 56, 4); MdcSWAP(h->x_resolution); memcpy(&h->y_resolution ,bb+ 60, 4); MdcSWAP(h->y_resolution); memcpy(&h->z_resolution ,bb+ 64, 4); MdcSWAP(h->z_resolution); memcpy(&h->num_r_elements ,bb+ 68, 4); MdcSWAP(h->num_r_elements); memcpy(&h->num_angles ,bb+ 72, 4); MdcSWAP(h->num_angles); memcpy(&h->z_rotation_angle ,bb+ 76, 4); MdcSWAP(h->z_rotation_angle); memcpy(&h->decay_corr_fctr ,bb+ 80, 4); MdcSWAP(h->decay_corr_fctr); memcpy(&h->processing_code ,bb+ 84, 4); MdcSWAP(h->processing_code); memcpy(&h->gate_duration ,bb+ 88, 4); MdcSWAP(h->gate_duration); memcpy(&h->r_wave_offset ,bb+ 92, 4); MdcSWAP(h->r_wave_offset); memcpy(&h->num_accepted_beats ,bb+ 96, 4); MdcSWAP(h->num_accepted_beats); memcpy(&h->filter_cutoff_frequency,bb+100, 4); MdcSWAP(h->filter_cutoff_frequency); memcpy(&h->filter_resolution ,bb+104, 4); MdcSWAP(h->filter_resolution); memcpy(&h->filter_ramp_slope ,bb+108, 4); MdcSWAP(h->filter_ramp_slope); memcpy(&h->filter_order ,bb+112, 2); MdcSWAP(h->filter_order); memcpy(&h->filter_scatter_fraction,bb+114, 4); MdcSWAP(h->filter_scatter_fraction); memcpy(&h->filter_scatter_slope ,bb+118, 4); MdcSWAP(h->filter_scatter_slope); memcpy( h->annotation ,bb+122,40); memcpy(&h->mt_1_1 ,bb+162, 4); MdcSWAP(h->mt_1_1); memcpy(&h->mt_1_2 ,bb+166, 4); MdcSWAP(h->mt_1_2); memcpy(&h->mt_1_3 ,bb+170, 4); MdcSWAP(h->mt_1_3); memcpy(&h->mt_2_1 ,bb+174, 4); MdcSWAP(h->mt_2_1); memcpy(&h->mt_2_2 ,bb+178, 4); MdcSWAP(h->mt_2_2); memcpy(&h->mt_2_3 ,bb+182, 4); MdcSWAP(h->mt_2_3); memcpy(&h->mt_3_1 ,bb+186, 4); MdcSWAP(h->mt_3_1); memcpy(&h->mt_3_2 ,bb+190, 4); MdcSWAP(h->mt_3_2); memcpy(&h->mt_3_3 ,bb+194, 4); MdcSWAP(h->mt_3_3); memcpy(&h->rfilter_cutoff ,bb+198, 4); MdcSWAP(h->rfilter_cutoff); memcpy(&h->rfilter_resolution ,bb+202, 4); MdcSWAP(h->rfilter_resolution); memcpy(&h->rfilter_code ,bb+206, 2); MdcSWAP(h->rfilter_code); memcpy(&h->rfilter_order ,bb+208, 2); MdcSWAP(h->rfilter_order); memcpy(&h->zfilter_cutoff ,bb+210, 4); MdcSWAP(h->zfilter_cutoff); memcpy(&h->zfilter_resolution ,bb+214, 4); MdcSWAP(h->zfilter_resolution); memcpy(&h->zfilter_code ,bb+218, 2); MdcSWAP(h->zfilter_code); memcpy(&h->zfilter_order ,bb+220, 2); MdcSWAP(h->zfilter_order); memcpy(&h->mt_1_4 ,bb+222, 4); MdcSWAP(h->mt_1_4); memcpy(&h->mt_2_4 ,bb+226, 4); MdcSWAP(h->mt_2_4); memcpy(&h->mt_3_4 ,bb+230, 4); MdcSWAP(h->mt_3_4); memcpy(&h->scatter_type ,bb+234, 2); MdcSWAP(h->scatter_type); memcpy(&h->recon_type ,bb+236, 2); MdcSWAP(h->recon_type); memcpy(&h->recon_views ,bb+238, 2); MdcSWAP(h->recon_views); memcpy( h->fill_cti ,bb+240,174); for (i=0; i<87; i++) MdcSWAP(h->fill_cti[i]); memcpy( h->fill_user ,bb+414,96); for (i=0; i<48; i++) MdcSWAP(h->fill_user[i]); return (0); } /*********************************************************/ float mdc_get_vax_float( bufr, off) Uint16 bufr[]; Int32 off; { Uint16 t1, t2; union {Uint32 t3; float t4;} test; if (bufr[off]==0 && bufr[off+1]==0) return(0.0); t1 = bufr[off] & 0x80ff; t2=(((bufr[off])&0x7f00)+0xff00)&0x7f00; test.t3 = (t1+t2)<<16; test.t3 =test.t3+bufr[off+1]; return(test.t4); } /*********************************************************/ Int32 mdc_get_vax_long( bufr, off) Uint16 bufr[]; Int32 off; { return ((bufr[off+1]<<16)+bufr[off]); } Mdc_Mat_dir mdc_mat_read_dir( fptr, selector) FILE *fptr; Uint8 *selector; { Int32 i, n, blk, nxtblk, ndblks, bufr[128]; Mdc_Mat_dir dir; blk = MdcMatFirstDirBlk; nxtblk = 0; for (ndblks=0; nxtblk != MdcMatFirstDirBlk; ndblks++) { mdc_mat_rblk( fptr, blk, (Uint8 *)bufr, 1); if (MdcHostBig()) { MdcSWAB( (Uint8 *)bufr, (Uint8 *)bufr, 8); MdcSWAW( (Uint16 *)bufr, (Uint16 *)bufr, 4); } nxtblk = bufr[1]; blk = nxtblk; } dir = (Mdc_Mat_dir) malloc( sizeof(struct mdc_matdir)); dir->nmats = 0; dir->nmax = 31 * ndblks; dir->entry = (struct Mdc_MatDir *) malloc( 31*ndblks*sizeof( struct Mdc_MatDir)); for (n=0, nxtblk=0, blk=MdcMatFirstDirBlk; nxtblk != MdcMatFirstDirBlk; blk = nxtblk) { mdc_mat_rblk( fptr, blk, (Uint8 *)bufr, 1); if (MdcHostBig()) { MdcSWAB( (Uint8 *)bufr, (Uint8 *)bufr, 512); MdcSWAW( (Uint16 *)bufr, (Uint16 *)bufr, 256); } nxtblk = bufr[1]; for (i=4; ientry[n].matnum = bufr[i++]; dir->entry[n].strtblk = bufr[i++]; dir->entry[n].endblk = bufr[i++]; dir->entry[n].matstat = bufr[i++]; if (dir->entry[n].matnum != 0) dir->nmats++; } } return dir; } /*********************************************************/ Int32 mdc_mat_wblk( fptr, blkno, bufr, nblks) FILE *fptr; Int32 blkno, nblks; Uint8 *bufr; { Int32 err; /* seek to position in file */ err=fseek( fptr, (blkno-1)*MdcMatBLKSIZE, 0); if (err) return(-1); /* write matrix data */ err=fwrite( bufr, 1, (unsigned)nblks*MdcMatBLKSIZE, fptr); if (err != nblks*MdcMatBLKSIZE) return(-1); if (ferror(fptr)) return (-1); return (0); } FILE *mdc_mat_create( fname, mhead) char *fname; Mdc_Main_header *mhead; { FILE *fptr; Int32 i, *bufr; fptr = mdc_mat_open( fname, "wb+"); if (!fptr) return fptr; mdc_mat_write_main_header( fptr, mhead); bufr = (Int32 *) malloc( MdcMatBLKSIZE); for (i=0; i<128; i++) bufr[i] = 0; bufr[0] = 31; bufr[1] = 2; if (MdcHostBig()) { MdcSWAW( (Uint16 *)bufr, (Uint16 *)bufr, 256); MdcSWAB( (Uint8 *)bufr, (Uint8 *)bufr, 512); } mdc_mat_wblk( fptr, MdcMatFirstDirBlk, (Uint8 *)bufr, 1); free( bufr); return (fptr); } Int32 mdc_mat_enter( fptr, matnum, nblks) FILE *fptr; Int32 matnum, nblks; { Int32 dirblk, dirbufr[128+4], i, nxtblk, busy, oldsize; dirblk = MdcMatFirstDirBlk; mdc_mat_rblk( fptr, dirblk, (Uint8 *)dirbufr, 1); if (MdcHostBig()) { MdcSWAB( (Uint8 *)dirbufr, (Uint8 *)dirbufr, 512); MdcSWAW( (Uint16 *)dirbufr, (Uint16 *)dirbufr, 256); } busy = 1; while (busy) { nxtblk = dirblk+1; for (i=4; i<128; i+=4) { if (dirbufr[i] == 0) { busy = 0; break; } else if (dirbufr[i] == matnum) { oldsize = dirbufr[i+2]-dirbufr[i+1]+1; if (oldsize < nblks) { dirbufr[i] = 0xFFFFFFFF; if (MdcHostBig()) { MdcSWAW( (Uint16 *)dirbufr, (Uint16 *)dirbufr, 256); MdcSWAB( (Uint8 *)dirbufr, (Uint8 *)dirbufr, 512); } mdc_mat_wblk( fptr, dirblk, (Uint8 *)dirbufr, 1); if (MdcHostBig()) { MdcSWAB( (Uint8 *)dirbufr, (Uint8 *)dirbufr, 512); MdcSWAW( (Uint16 *)dirbufr, (Uint16 *)dirbufr, 256); } nxtblk = dirbufr[i+2]+1; } else { nxtblk = dirbufr[i+1]; dirbufr[0]++; dirbufr[3]--; busy = 0; break; } } else nxtblk = dirbufr[i+2]+1; } if (!busy) break; if (dirbufr[1] != MdcMatFirstDirBlk) { dirblk = dirbufr[1]; mdc_mat_rblk( fptr, dirblk, (Uint8 *)dirbufr, 1); if (MdcHostBig()) { MdcSWAB( (Uint8 *)dirbufr, (Uint8 *)dirbufr, 512); MdcSWAW( (Uint16 *)dirbufr, (Uint16 *)dirbufr, 256); } } else { dirbufr[1] = nxtblk; if (MdcHostBig()) { MdcSWAW( (Uint16 *)dirbufr, (Uint16 *)dirbufr, 256); MdcSWAB( (Uint8 *)dirbufr, (Uint8 *)dirbufr, 512); } mdc_mat_wblk( fptr, dirblk, (Uint8 *)dirbufr, 1); dirbufr[0] = 31; dirbufr[1] = MdcMatFirstDirBlk; dirbufr[2] = dirblk; dirbufr[3] = 0; dirblk = nxtblk; for (i=4; i<128; i++) dirbufr[i] = 0; } } dirbufr[i] = matnum; dirbufr[i+1] = nxtblk; dirbufr[i+2] = nxtblk + nblks; dirbufr[i+3] = 1; dirbufr[0]--; dirbufr[3]++; if (MdcHostBig()) { MdcSWAW( (Uint16 *)dirbufr, (Uint16 *)dirbufr, 256); MdcSWAB( (Uint8 *)dirbufr, (Uint8 *)dirbufr, 512); } mdc_mat_wblk( fptr, dirblk, (Uint8 *)dirbufr, 1); return (nxtblk); } Int32 mdc_mat_write_image( fptr, matnum, header, data, data_size) FILE *fptr; Int32 matnum; Mdc_Image_subheader *header; Uint16 *data; Int32 data_size; { Int32 nxtblk, size, error ; size = (data_size+511)/512; nxtblk = mdc_mat_enter( fptr, matnum, size); mdc_mat_write_image_subheader( fptr, nxtblk, header); error = mdc_write_matrix_data(fptr, nxtblk+1, size, (Uint8 *)data, header->data_type) ; return(error) ; } Int32 mdc_mat_write_scan( fptr, matnum, header, data, data_size) FILE *fptr; Int32 matnum; Mdc_Scan_subheader *header; Uint16 *data; Int32 data_size; { Int32 nxtblk, size, error ; size = (data_size+511)/512; nxtblk = mdc_mat_enter( fptr, matnum, size); mdc_mat_write_scan_subheader( fptr, nxtblk, header); error = mdc_write_matrix_data(fptr, nxtblk+1, size, (Uint8 *)data, header->data_type) ; return(error) ; } Int32 mdc_mat_write_attn( fptr, matnum, header, data, data_size) FILE *fptr; Int32 matnum; Mdc_Attn_subheader *header; float *data; Int32 data_size; { Int32 nxtblk, size, error ; size = (data_size+511)/512; nxtblk = mdc_mat_enter( fptr, matnum, size); mdc_mat_write_attn_subheader( fptr, nxtblk, header); error = mdc_write_matrix_data (fptr, nxtblk+1, size, (Uint8 *)data, header->data_type) ; return(error) ; } Int32 mdc_mat_write_norm( fptr, matnum, header, data, data_size) FILE *fptr; Int32 matnum; Mdc_Norm_subheader *header; float *data; Int32 data_size; { Int32 nxtblk, size, error ; size = (data_size+511)/512; nxtblk = mdc_mat_enter( fptr, matnum, size); mdc_mat_write_norm_subheader( fptr, nxtblk, header); error = mdc_write_matrix_data(fptr, nxtblk+1, size, (Uint8 *)data, header->data_type) ; return(error) ; } Int32 mdc_mat_write_idata( fptr, blk, data, size) FILE *fptr; Int32 blk, size; Uint8 *data; { Uint8 bufr[512]; Int32 i, nbytes, nblks; nblks = (size+511)/512; for (i=0; i ranges[1][0]) return (0); if (ranges[0][1] != -1) if (m.plane < ranges[0][1] || m.plane > ranges[1][1]) return (0); if (ranges[0][2] != -1) if (m.gate < ranges[0][2] || m.gate > ranges[1][2]) return (0); if (ranges[0][3] != -1) if (m.data < ranges[0][3] || m.data > ranges[1][3]) return (0); if (ranges[0][4] != -1) if (m.bed < ranges[0][4] || m.bed > ranges[1][4]) return (0); return (matnum); } Int32 mdc_decode_selector( s1, ranges) char *s1; Int32 ranges[2][5]; { char xword[16]; Int32 i; mdc_fix_selector( s1, s1); for (i=0;i<5;i++) /* set all ranges to all (-1) */ { ranges[0][i]=ranges[1][i]=-1; s1 = mdc_nex_word( s1, xword); if (xword[0] == '*') continue; else if (strchr(xword,':')) sscanf(xword,"%d:%d",&ranges[0][i],&ranges[1][i]); else { sscanf(xword,"%d",&ranges[0][i]); ranges[1][i]=ranges[0][i]; }; } return 0; } Int32 mdc_str_find( s1, s2) char *s1, *s2; { Int32 i, j, k; for (i=0;s1[i];i++) { for (j=i,k=0; s2[k]!='\0' && s1[j]==s2[k]; j++, k++) ; if (s2[k]=='\0') return (i); } return (-1); } Int32 mdc_str_replace( s1, s2, s3, s4) char *s1, *s2, *s3, *s4; { Int32 nf=0, n; *s1 = '\0'; while (1) { if ((n=mdc_str_find(s2, s3))==-1) { strcat(s1, s2); return (nf); } else { strncat(s1, s2, (unsigned)n); strcat(s1, s4); s2+= n+strlen(s3); nf++; } } } Int32 mdc_string_replace( s1, s2, s3, s4) char *s1, *s2, *s3, *s4; { char temp[256]; strcpy(temp, s2); while (mdc_str_replace(s1, temp, s3, s4) > 0) strcpy(temp, s1); return 0; } Int32 mdc_fix_selector( s1, s2) char *s1, *s2; { char temp[256]; mdc_string_replace(temp, s2, "," , " "); mdc_string_replace(s1, temp, "..", ":"); mdc_string_replace(temp, s1, ".", ":"); mdc_string_replace(s1, temp, "-", ":"); mdc_string_replace(temp, s1, "**", "*"); mdc_string_replace(s1, temp, " ", " "); mdc_string_replace(temp, s1, " :", ":"); mdc_string_replace(s1, temp, ": ", ":"); return 0; } char* mdc_nex_word(s, w) char *s, *w; { while (*s && *s!=' ') *w++=*s++; *w='\0'; if (*s) s++; return (s); } /********************************************************/ /* HOSTFTOVAXF */ /********************************************************/ Int32 mdc_hostftovaxf(float f_orig, Uint16 number[]) { /* convert from host float to vax float */ union { Uint16 t[2]; float t4; } test ; Uint16 exp; number[0] = 0; number[1] = 0; test.t4 = f_orig; if (test.t4 == 0.0) return 0; if (!MdcHostBig()) MdcSWAW((Uint16 *)test.t, (Uint16 *)test.t,2); number[1] = test.t[1]; exp = ((test.t[0] & 0x7f00) + 0x0100) & 0x7f00; test.t[0] = (test.t[0] & 0x80ff) + exp; number[0] = test.t[0]; return 0; } /*********************************************************/ Int32 mdc_mat_write_main_header( fptr, header) FILE *fptr; Mdc_Main_header *header; { Uint8 *bbufr; Int16 bufr[256]; Int32 err,i; for (i=0; i<256; i++) bufr[i] = 0; bbufr = (Uint8 *) bufr; bufr[24] = header->sw_version; bufr[25] = header->data_type; bufr[26] = header->system_type; bufr[27] = header->file_type; bufr[33] = header->scan_start_day; bufr[34] = header->scan_start_month; bufr[35] = header->scan_start_year; bufr[36] = header->scan_start_hour; bufr[37] = header->scan_start_minute; bufr[38] = header->scan_start_second; mdc_hostftovaxf (header->isotope_halflife, (Uint16 *)&bufr[43]); mdc_hostftovaxf (header->gantry_tilt, (Uint16 *)&bufr[61]); mdc_hostftovaxf (header->gantry_rotation, (Uint16 *)&bufr[63]); mdc_hostftovaxf (header->bed_elevation, (Uint16 *)&bufr[65]); bufr[67] = header->rot_source_speed; bufr[68] = header->wobble_speed; bufr[69] = header->transm_source_type; mdc_hostftovaxf (header->axial_fov, (Uint16 *)&bufr[70]); mdc_hostftovaxf (header->transaxial_fov, (Uint16 *)&bufr[72]); bufr[74] = header->transaxial_samp_mode; bufr[75] = header->coin_samp_mode; bufr[76] = header->axial_samp_mode; mdc_hostftovaxf (header->calibration_factor,(Uint16 *)&bufr[77]); bufr[79] = header->calibration_units; bufr[80] = header->compression_code; bufr[175] = header->acquisition_type; bufr[176] = header->bed_type; bufr[177] = header->septa_type; bufr[188] = header->num_planes; bufr[189] = header->num_frames; bufr[190] = header->num_gates; bufr[191] = header->num_bed_pos; mdc_hostftovaxf (header->init_bed_position,(Uint16 *)&bufr[192]); for (i=0; i<15; i++) { mdc_hostftovaxf (header->bed_offset[i],(Uint16 *)&bufr[194+2*i]); } mdc_hostftovaxf (header->plane_separation,(Uint16 *)&bufr[224]); bufr[226] = header->lwr_sctr_thres; bufr[227] = header->lwr_true_thres; bufr[228] = header->upr_true_thres; mdc_hostftovaxf (header->collimator,(Uint16 *)&bufr[229]); bufr[236] = header->acquisition_mode; if (MdcHostBig()) MdcSWAB( (Uint8 *)bufr, (Uint8 *)bufr, MdcMatBLKSIZE); memcpy( bbufr+28, header->original_file_name, 20); /* write the node_id - character string */ memcpy( bbufr+56, header->node_id, 10); /* write the isotope code - char string */ memcpy( bbufr+78, header->isotope_code, 8); /* write the radiopharmaceutical - char string */ memcpy( bbufr+90, header->radiopharmaceutical, 32); /* study_name - char string */ memcpy( bbufr+162, header->study_name, 12); /* patient_id - char string */ memcpy( bbufr+174, header->patient_id, 16); /* patient_name - char string */ memcpy( bbufr+190, header->patient_name, 32); /* patient_sex - char */ bbufr[222] = header->patient_sex; /* patient_age - char string */ memcpy( bbufr+223, header->patient_age, 10); /* patient_height - char string */ memcpy( bbufr+233, header->patient_height, 10); /* patient_weight - char string */ memcpy( bbufr+243, header->patient_weight, 10); /* patient_dexterity - char */ bbufr[253] = header->patient_dexterity; /* physician_name - char string */ memcpy( bbufr+254, header->physician_name, 32); /* operator_name - char string */ memcpy( bbufr+286, header->operator_name, 32); /* study_description - char string */ memcpy( bbufr+318, header->study_description, 32); /* facility_name */ memcpy( bbufr+356, header->facility_name, 20); /* user_process_code - char string */ memcpy( bbufr+462, header->user_process_code, 10); err = mdc_mat_wblk( fptr, 1, (Uint8 *)bufr, 1); /* write main header at block 1 */ if (err) return(err); return (0); } /*********************************************************/ Int32 mdc_mat_write_image_subheader( fptr, blknum, header) FILE *fptr; Int32 blknum; Mdc_Image_subheader *header; { Uint8 *bbufr; Int16 bufr[256]; Int32 i, err; for (i=0; i<256; i++) bufr[i] = 0; bbufr = (Uint8 *) bufr; /* transfer subheader information */ bufr[63] = header->data_type; bufr[64] = header->num_dimensions; bufr[66] = header->dimension_1; bufr[67] = header->dimension_2; mdc_hostftovaxf(header->x_origin,(Uint16 *)&bufr[80]); mdc_hostftovaxf(header->y_origin,(Uint16 *)&bufr[82]); mdc_hostftovaxf(header->recon_scale,(Uint16 *)&bufr[84]); mdc_hostftovaxf(header->quant_scale,(Uint16 *)&bufr[86]); bufr[88] = header->image_min; bufr[89] = header->image_max; mdc_hostftovaxf(header->pixel_size,(Uint16 *)&bufr[92]); mdc_hostftovaxf(header->slice_width,(Uint16 *)&bufr[94]); mdc_hostltovaxl(header->frame_duration,(Uint16 *)&bufr[96]); mdc_hostltovaxl(header->frame_start_time,(Uint16 *)&bufr[98]); bufr[100] = header->slice_location; bufr[101] = header->recon_start_hour; bufr[102] = header->recon_start_minute; bufr[103] = header->recon_start_sec; mdc_hostltovaxl(header->gate_duration,(Uint16 *)&bufr[104]); bufr[118] = header->filter_code; mdc_hostltovaxl(header->scan_matrix_num,(Uint16 *)&bufr[119]); mdc_hostltovaxl(header->norm_matrix_num,(Uint16 *)&bufr[121]); mdc_hostltovaxl(header->atten_cor_matrix_num,(Uint16 *)&bufr[123]); mdc_hostftovaxf(header->image_rotation,(Uint16 *)&bufr[148]); mdc_hostftovaxf(header->plane_eff_corr_fctr,(Uint16 *)&bufr[150]); mdc_hostftovaxf(header->decay_corr_fctr,(Uint16 *)&bufr[152]); mdc_hostftovaxf(header->loss_corr_fctr,(Uint16 *)&bufr[154]); mdc_hostftovaxf(header->intrinsic_tilt,(Uint16 *)&bufr[156]); bufr[188] = header->processing_code; bufr[190] = header->quant_units; bufr[191] = header->recon_start_day; bufr[192] = header->recon_start_month; bufr[193] = header->recon_start_year; mdc_hostftovaxf(header->ecat_calibration_fctr,(Uint16 *)&bufr[194]); mdc_hostftovaxf(header->well_counter_cal_fctr,(Uint16 *)&bufr[196]); for (i=0; i<6; i++) mdc_hostftovaxf(header->filter_params[i],(Uint16 *)&bufr[198+2*i]); /* swap the bytes */ if (MdcHostBig()) MdcSWAB( (Uint8 *)bufr, (Uint8 *)bufr, MdcMatBLKSIZE); strcpy ((char *)(bbufr+420), header->annotation); /* write to matrix file */ err = mdc_mat_wblk( fptr, blknum, bbufr, 1); if (err) return(err); return(0); } /*********************************************************/ Int32 mdc_hostltovaxl( in, out) Int32 in; Uint16 out[2]; { out[0]=(in&0x0000FFFF); out[1]=(in&0xFFFF0000)>>16; return 0; } /*********************************************************/ Int32 mdc_mat_write_scan_subheader( fptr, blknum, header) FILE *fptr; Int32 blknum; Mdc_Scan_subheader *header; { Int16 bufr[256]; Int32 i, err; for (i=0; i<256; bufr[i++]=0); bufr[0] = 256; bufr[1] = 1; bufr[2] = 22; bufr[3] = -1; bufr[4] = 25; bufr[5] = 62; bufr[6] = 79; bufr[7] = 106; bufr[24] = 37; bufr[25] = -1; bufr[61] = 17; bufr[62] = -1; bufr[78] = 27; bufr[79] = -1; bufr[105] = 52; bufr[106] = -1; bufr[63] = header->data_type; bufr[66] = header->dimension_1; /* x dimension */ bufr[67] = header->dimension_2; /* y_dimension */ bufr[68] = header->smoothing; bufr[69] = header->processing_code; mdc_hostftovaxf(header->sample_distance,(Uint16 *)&bufr[73]); mdc_hostftovaxf(header->isotope_halflife,(Uint16 *)&bufr[83]); bufr[85] = header->frame_duration_sec; mdc_hostltovaxl(header->gate_duration,(Uint16 *)&bufr[86]); mdc_hostltovaxl(header->r_wave_offset,(Uint16 *)&bufr[88]); mdc_hostftovaxf(header->scale_factor,(Uint16 *)&bufr[91]); bufr[96] = header->scan_min; bufr[97] = header->scan_max; mdc_hostltovaxl(header->prompts,(Uint16 *)&bufr[98]); mdc_hostltovaxl(header->delayed,(Uint16 *)&bufr[100]); mdc_hostltovaxl(header->multiples,(Uint16 *)&bufr[102]); mdc_hostltovaxl(header->net_trues,(Uint16 *)&bufr[104]); for (i=0; i<16; i++) { mdc_hostftovaxf(header->cor_singles[i],(Uint16 *)&bufr[158+2*i]); mdc_hostftovaxf(header->uncor_singles[i],(Uint16 *)&bufr[190+2*i]); }; mdc_hostftovaxf(header->tot_avg_cor,(Uint16 *)&bufr[222]); mdc_hostftovaxf(header->tot_avg_uncor,(Uint16 *)&bufr[224]); mdc_hostltovaxl(header->total_coin_rate,(Uint16 *)&bufr[226]); /* total coin rate */ mdc_hostltovaxl(header->frame_start_time,(Uint16 *)&bufr[228]); mdc_hostltovaxl(header->frame_duration,(Uint16 *)&bufr[230]); mdc_hostftovaxf(header->loss_correction_fctr,(Uint16 *)&bufr[232]); for (i=0; i<8; i++) mdc_hostltovaxl(header->phy_planes[i],(Uint16 *)&bufr[234+2*i]); if (MdcHostBig()) MdcSWAB( (Uint8 *)bufr, (Uint8 *)bufr, MdcMatBLKSIZE); err = mdc_mat_wblk( fptr, blknum, (Uint8 *)bufr, 1); return (err); } Int32 mdc_mat_write_attn_subheader( fptr, blknum, header) FILE *fptr; Int32 blknum; Mdc_Attn_subheader *header; { Int16 bufr[256]; Int32 i,err; for (i=0; i<256; bufr[i++]=0); bufr[0] = 256; bufr[1] = 1; bufr[2] = 22; bufr[3] = -1; bufr[4] = 25; bufr[5] = 62; bufr[6] = 79; bufr[7] = 106; bufr[24] = 37; bufr[25] = -1; bufr[61] = 17; bufr[62] = -1; bufr[78] = 27; bufr[79] = -1; bufr[105] = 52; bufr[106] = -1; bufr[63] = header->data_type; bufr[64] = header->attenuation_type; bufr[66] = header->dimension_1; bufr[67] = header->dimension_2; mdc_hostftovaxf( header->scale_factor,(Uint16 *)&bufr[91]); mdc_hostftovaxf( header->x_origin,(Uint16 *)&bufr[93]); mdc_hostftovaxf( header->y_origin,(Uint16 *)&bufr[95]); mdc_hostftovaxf( header->x_radius,(Uint16 *)&bufr[97]); mdc_hostftovaxf( header->y_radius,(Uint16 *)&bufr[99]); mdc_hostftovaxf( header->tilt_angle,(Uint16 *)&bufr[101]); mdc_hostftovaxf( header->attenuation_coeff,(Uint16 *)&bufr[103]); mdc_hostftovaxf( header->sample_distance,(Uint16 *)&bufr[105]); if (MdcHostBig()) MdcSWAB( (Uint8 *)bufr, (Uint8 *)bufr, 512); err = mdc_mat_wblk( fptr, blknum, (Uint8 *)bufr, 1); return (err); } Int32 mdc_mat_write_norm_subheader( fptr, blknum, header) FILE *fptr; Int32 blknum; Mdc_Norm_subheader *header; { Int16 bufr[256]; Int32 i,err; for (i=0; i<256; bufr[i++]=0); bufr[0] = 256; bufr[1] = 1; bufr[2] = 22; bufr[3] = -1; bufr[4] = 25; bufr[5] = 62; bufr[6] = 79; bufr[7] = 106; bufr[24] = 37; bufr[25] = -1; bufr[61] = 17; bufr[62] = -1; bufr[78] = 27; bufr[79] = -1; bufr[105] = 52; bufr[106] = -1; bufr[63] = header->data_type; bufr[66] = header->dimension_1; bufr[67] = header->dimension_2; mdc_hostftovaxf( header->scale_factor,(Uint16 *)&bufr[91]); bufr[93] = header->norm_hour; bufr[94] = header->norm_minute; bufr[95] = header->norm_second; bufr[96] = header->norm_day; bufr[97] = header->norm_month; bufr[98] = header->norm_year; mdc_hostftovaxf( header->fov_source_width,(Uint16 *)&bufr[99]); mdc_hostftovaxf( header->ecat_calib_factor,(Uint16 *)&bufr[101]); if (MdcHostBig()) MdcSWAB( (Uint8 *)bufr, (Uint8 *)bufr, 512); err = mdc_mat_wblk( fptr, blknum, (Uint8 *)bufr, 1); return (err); } Int32 mdc_mat_read_attn_subheader( fptr, blknum, header) FILE *fptr; Int32 blknum; Mdc_Attn_subheader *header; { Int16 bufr[256]; Int32 err; err = mdc_mat_rblk( fptr, blknum, (Uint8 *)bufr, 1); if (err) return(err); if (MdcHostBig()) MdcSWAB( (Uint8 *)bufr, (Uint8 *)bufr, MdcMatBLKSIZE); header->data_type = bufr[63]; header->attenuation_type = bufr[64]; header->dimension_1 = bufr[66]; header->dimension_2 = bufr[67]; header->scale_factor = mdc_get_vax_float((Uint16 *)bufr, 91); header->x_origin = mdc_get_vax_float((Uint16 *)bufr, 93); header->y_origin = mdc_get_vax_float((Uint16 *)bufr, 95); header->x_radius = mdc_get_vax_float((Uint16 *)bufr, 97); header->y_radius = mdc_get_vax_float((Uint16 *)bufr, 99); header->tilt_angle = mdc_get_vax_float((Uint16 *)bufr, 101); header->attenuation_coeff = mdc_get_vax_float((Uint16 *)bufr, 103); header->sample_distance = mdc_get_vax_float((Uint16 *)bufr, 105); return (0); } Int32 mdc_mat_read_attn_subheader7( fptr, blknum, h) FILE *fptr; Int32 blknum; Mdc_Attn_subheader7 *h; { Int16 b[256]; Int32 err, i; char *bb; err = mdc_mat_rblk( fptr, blknum, (Uint8 *)b, 1); if (err) return(err); bb = (char *)b; memcpy(&h->data_type ,bb , 2); MdcSWAP(h->data_type); memcpy(&h->num_dimensions ,bb+ 2, 2); MdcSWAP(h->num_dimensions); memcpy(&h->attenuation_type ,bb+ 4, 2); MdcSWAP(h->attenuation_type); memcpy(&h->num_r_elements ,bb+ 6, 2); MdcSWAP(h->num_r_elements); memcpy(&h->num_angles ,bb+ 8, 2); MdcSWAP(h->num_angles); memcpy(&h->num_z_elements ,bb+ 10, 2); MdcSWAP(h->num_z_elements); memcpy(&h->ring_difference ,bb+ 12, 2); MdcSWAP(h->ring_difference); memcpy(&h->x_resolution ,bb+ 14, 4); MdcSWAP(h->x_resolution); memcpy(&h->y_resolution ,bb+ 18, 4); MdcSWAP(h->y_resolution); memcpy(&h->z_resolution ,bb+ 22, 4); MdcSWAP(h->z_resolution); memcpy(&h->w_resolution ,bb+ 26, 4); MdcSWAP(h->w_resolution); memcpy(&h->scale_factor ,bb+ 30, 4); MdcSWAP(h->scale_factor); memcpy(&h->x_offset ,bb+ 34, 4); MdcSWAP(h->x_offset); memcpy(&h->y_offset ,bb+ 38, 4); MdcSWAP(h->y_offset); memcpy(&h->x_radius ,bb+ 42, 4); MdcSWAP(h->x_radius); memcpy(&h->y_radius ,bb+ 46, 4); MdcSWAP(h->y_radius); memcpy(&h->tilt_angle ,bb+ 50, 4); MdcSWAP(h->tilt_angle); memcpy(&h->attenuation_coeff ,bb+ 54, 4); MdcSWAP(h->attenuation_coeff); memcpy(&h->attenuation_min ,bb+ 58, 4); MdcSWAP(h->attenuation_min); memcpy(&h->attenuation_max ,bb+ 62, 4); MdcSWAP(h->attenuation_max); memcpy(&h->skull_thickness ,bb+ 66, 4); MdcSWAP(h->skull_thickness); memcpy(&h->num_xtra_atten_coeff ,bb+ 70, 2); MdcSWAP(h->num_xtra_atten_coeff); memcpy(&h->xtra_atten_coeff ,bb+ 72, 32); for (i=0; i<8; i++) MdcSWAP(h->xtra_atten_coeff[i]); memcpy(&h->edge_finding_threshold,bb+104, 4); MdcSWAP(h->edge_finding_threshold); memcpy(&h->storage_order ,bb+108, 2); MdcSWAP(h->storage_order); memcpy(&h->span ,bb+110, 2); MdcSWAP(h->span); memcpy(&h->z_elements ,bb+112,128); for (i=0; i<64; i++) MdcSWAP(h->z_elements[i]); memcpy(&h->fill_unused ,bb+240,172); for (i=0; i<86; i++) MdcSWAP(h->fill_unused[i]); memcpy(&h->fill_user ,bb+412,100); for (i=0; i<50; i++) MdcSWAP(h->fill_user[i]); return (0); } Int32 mdc_mat_read_norm_subheader( fptr, blknum, header) FILE *fptr; Int32 blknum; Mdc_Norm_subheader *header; { Int16 bufr[256]; Int32 err; err = mdc_mat_rblk( fptr, blknum, (Uint8 *)bufr, 1); if (err) return(err); if (MdcHostBig()) MdcSWAB( (Uint8 *)bufr, (Uint8 *)bufr, MdcMatBLKSIZE); header->data_type = bufr[63]; header->dimension_1 = bufr[66]; header->dimension_2 = bufr[67]; header->scale_factor = mdc_get_vax_float((Uint16 *)bufr, 91); header->norm_hour = bufr[93]; header->norm_minute = bufr[94]; header->norm_second = bufr[95]; header->norm_day = bufr[96]; header->norm_month = bufr[97]; header->norm_year = bufr[98]; header->fov_source_width = mdc_get_vax_float((Uint16 *)bufr, 99); header->ecat_calib_factor = mdc_get_vax_float((Uint16 *)bufr, 101); return (0); } /* Following function was copied from CTI-source file 'matrix_extra.c' */ /* and slightly modified ... */ Int32 mdc_write_matrix_data(fptr, strtblk, nblks, dptr, dtype) FILE *fptr; Int32 strtblk, nblks, dtype; Uint8 *dptr; { Int32 err; switch (dtype) { case 1: /* byte format...no * translation necessary */ err = mdc_mat_wblk(fptr, strtblk, dptr, nblks); break; case 2: /* Vax I*2 */ err = mdc_mat_write_idata(fptr, strtblk, (Uint8 *)dptr, 512 * nblks); break; case 4: /* Vax R*4 */ err = mdc_mat_write_fdata(fptr, strtblk, (float *)dptr, 512 * nblks); break; case 5: /* IEEE R*4 */ err = mdc_mat_wblk(fptr, strtblk, dptr, nblks); break; case 6: /* 68K I*2 */ err = mdc_mat_wblk(fptr, strtblk, dptr, nblks); break; case 7: /* 68K I*4 */ err = mdc_mat_wblk(fptr, strtblk, dptr, nblks); break; default: /* something * else...treat as Vax * I*2 */ err = mdc_mat_write_idata(fptr, strtblk, (Uint8 *)dptr, 512 * nblks); break; } return (err); } /* code from mat_get_spec.c */ Int32 mdc_mat_get_spec (char *file, Int32 *num_frames, Int32 *num_planes, Int32 *num_gates, Int32 *num_bed) { struct Mdc_MatDir matrixlist[5000]; FILE *fptr; Int32 status, num_matrices, i; struct Mdc_Matval matnum; /* initialization */ status = 0; *num_frames = 0; *num_planes = 0; *num_gates = 0; *num_bed = 0; /* open the specified file */ fptr = mdc_mat_open (file, "r"); if (fptr != NULL) { /* get the matrix entries */ num_matrices = mdc_mat_list( fptr, matrixlist, 5000); for (i=0; i *num_frames) (*num_frames)++; if (matnum.plane > *num_planes) (*num_planes)++; if (matnum.gate > *num_gates) (*num_gates)++; if (matnum.bed > *num_bed) (*num_bed)++; } /* bed is zero based in the matrix number, but all numbers returned */ /* from this function will be one based */ (*num_bed)++; mdc_mat_close (fptr); } else status = 1; return(status); } /* code from sort_order.c */ static int mdc_compare_anatloc(const void *vi, const void *vj) { struct ExpMatDir *i, *j; i = (struct ExpMatDir *)vi; j = (struct ExpMatDir *)vj; if (i->anatloc < j->anatloc) return (-1); if (i->anatloc > j->anatloc) return (1); return (0); } /* matrix list by anatomical position */ void mdc_anatomical_sort (struct Mdc_MatDir matrix_list[], Int32 num_matrices, Mdc_Main_header *mhead, Int32 num_bed_pos) { struct Mdc_Matval matval; Int32 i, plane, bed; float bed_pos[16], plane_separation; struct ExpMatDir exp_matlist[5000]; bed_pos[0] = 0.0; for (i=1; i < num_bed_pos; i++) bed_pos[i] = mhead->bed_offset[i-1]; plane_separation = mhead->plane_separation; /* if plane separation not filled in main header, use plane number to sort */ if (plane_separation == 0.0) plane_separation = 1.0; for (i=0; i < num_matrices; i++) { mdc_mat_numdoc (matrix_list[i].matnum, &matval); plane = matval.plane; bed = matval.bed; exp_matlist[i].matnum = matrix_list[i].matnum; exp_matlist[i].strtblk = matrix_list[i].strtblk; exp_matlist[i].endblk = matrix_list[i].endblk; exp_matlist[i].matstat = matrix_list[i].matstat; exp_matlist[i].anatloc = bed_pos[bed]+(plane-1)*plane_separation; } qsort(exp_matlist,(unsigned)num_matrices ,sizeof(struct ExpMatDir) ,mdc_compare_anatloc); for (i=0; i < num_matrices; i++) { matrix_list[i].matnum = exp_matlist[i].matnum; matrix_list[i].strtblk = exp_matlist[i].strtblk; matrix_list[i].endblk = exp_matlist[i].endblk; matrix_list[i].matstat = exp_matlist[i].matstat; } } static int mdc_compmatdir(const void *vi, const void *vj) { struct Mdc_MatDir *i, *j; i = (struct Mdc_MatDir *)vi; j = (struct Mdc_MatDir *)vj; return((i->matnum - j->matnum)); } void mdc_matnum_sort(struct Mdc_MatDir mlist[], Int32 num_entry) { qsort(mlist,(unsigned)num_entry, sizeof(struct Mdc_MatDir), mdc_compmatdir); } /* sort by planes varying first */ void mdc_plane_sort (struct Mdc_MatDir matrix_list[], Int32 num_matrices) { struct Mdc_Matval matval; Int32 i, frame, plane, bed; struct ExpMatDir exp_matlist[5000]; for (i=0; i < num_matrices; i++) { mdc_mat_numdoc (matrix_list[i].matnum, &matval); plane = matval.plane; frame = matval.frame; bed = matval.bed; exp_matlist[i].matnum = matrix_list[i].matnum; exp_matlist[i].strtblk = matrix_list[i].strtblk; exp_matlist[i].endblk = matrix_list[i].endblk; exp_matlist[i].matstat = matrix_list[i].matstat; exp_matlist[i].anatloc = (float)(frame*1000 + plane*10 + bed); } qsort (exp_matlist,(unsigned)num_matrices ,sizeof(struct ExpMatDir) ,mdc_compare_anatloc); for (i=0; i < num_matrices; i++) { matrix_list[i].matnum = exp_matlist[i].matnum; matrix_list[i].strtblk = exp_matlist[i].strtblk; matrix_list[i].endblk = exp_matlist[i].endblk; matrix_list[i].matstat = exp_matlist[i].matstat; } } xmedcon-0.14.1/source/Makefile.in0000644000175000017510000011160712637622763013545 00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = medcon$(EXEEXT) $(am__EXEEXT_1) subdir = source DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(srcdir)/m-depend.h.in $(top_srcdir)/mkinstalldirs \ $(srcdir)/m-config.h.in $(top_srcdir)/depcomp \ $(include_HEADERS) ChangeLog ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = m-depend.h CONFIG_CLEAN_FILES = m-config.h CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(configheadersdir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = am_libmdc_la_OBJECTS = m-init.lo m-vifi.lo m-color.lo m-debug.lo \ m-error.lo m-fancy.lo m-files.lo m-split.lo m-stack.lo \ m-transf.lo m-getopt.lo m-algori.lo m-global.lo m-pixels.lo \ m-rslice.lo m-xtract.lo m-progress.lo m-qmedian.lo \ m-structs.lo m-raw.lo libmdc_la_OBJECTS = $(am_libmdc_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libmdc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libmdc_la_LDFLAGS) $(LDFLAGS) -o $@ @DO_GUI_TRUE@am__EXEEXT_1 = xmedcon$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) am_medcon_OBJECTS = medcon.$(OBJEXT) medcon_OBJECTS = $(am_medcon_OBJECTS) medcon_DEPENDENCIES = libmdc.la medcon_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(medcon_LDFLAGS) $(LDFLAGS) -o $@ am_xmedcon_OBJECTS = xcolmap.$(OBJEXT) xcolgbc.$(OBJEXT) \ xdefs.$(OBJEXT) xicons.$(OBJEXT) xerror.$(OBJEXT) \ xextract.$(OBJEXT) xfancy.$(OBJEXT) xfiles.$(OBJEXT) \ xfilesel.$(OBJEXT) xhelp.$(OBJEXT) ximages.$(OBJEXT) \ xinfo.$(OBJEXT) xlabels.$(OBJEXT) xmedcon.$(OBJEXT) \ xmnuftry.$(OBJEXT) xoptions.$(OBJEXT) xpages.$(OBJEXT) \ xprogbar.$(OBJEXT) xreader.$(OBJEXT) xrender.$(OBJEXT) \ xreset.$(OBJEXT) xresize.$(OBJEXT) xreslice.$(OBJEXT) \ xtransf.$(OBJEXT) xutils.$(OBJEXT) xviewer.$(OBJEXT) \ xvifi.$(OBJEXT) xwriter.$(OBJEXT) xzoom.$(OBJEXT) xmedcon_OBJECTS = $(am_xmedcon_OBJECTS) @PLATFORM_WIN32_FALSE@xmedcon_DEPENDENCIES = libmdc.la @PLATFORM_WIN32_TRUE@xmedcon_DEPENDENCIES = $(APPICON_OBJ) libmdc.la xmedcon_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(xmedcon_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libmdc_la_SOURCES) $(EXTRA_libmdc_la_SOURCES) \ $(medcon_SOURCES) $(xmedcon_SOURCES) DIST_SOURCES = $(libmdc_la_SOURCES) $(EXTRA_libmdc_la_SOURCES) \ $(medcon_SOURCES) $(xmedcon_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DATA = $(configheaders_DATA) HEADERS = $(include_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)m-depend.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DECOMPRESS = @DECOMPRESS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_ACR = @ENABLE_ACR@ ENABLE_ANLZ = @ENABLE_ANLZ@ ENABLE_CONC = @ENABLE_CONC@ ENABLE_DICM = @ENABLE_DICM@ ENABLE_ECAT = @ENABLE_ECAT@ ENABLE_GIF = @ENABLE_GIF@ ENABLE_INTF = @ENABLE_INTF@ ENABLE_INW = @ENABLE_INW@ ENABLE_NIFTI = @ENABLE_NIFTI@ ENABLE_PNG = @ENABLE_PNG@ ENABLE_TPC = @ENABLE_TPC@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIBMDCETC = @GLIBMDCETC@ GLIBSUPPORTED = @GLIBSUPPORTED@ GREP = @GREP@ GTKONE = @GTKONE@ GTKSUPPORTED = @GTKSUPPORTED@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NIFTI_CFLAGS = @NIFTI_CFLAGS@ NIFTI_LDFLAGS = @NIFTI_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PNG_CFLAGS = @PNG_CFLAGS@ PNG_LDFLAGS = @PNG_LDFLAGS@ PNG_LIBS = @PNG_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TPC_CFLAGS = @TPC_CFLAGS@ TPC_LDFLAGS = @TPC_LDFLAGS@ VERSION = @VERSION@ XMDCETC = @XMDCETC@ XMEDCON_DATE = @XMEDCON_DATE@ XMEDCON_GLIB_CFLAGS = @XMEDCON_GLIB_CFLAGS@ XMEDCON_GLIB_LIBS = @XMEDCON_GLIB_LIBS@ XMEDCON_GTK_CFLAGS = @XMEDCON_GTK_CFLAGS@ XMEDCON_GTK_LIBS = @XMEDCON_GTK_LIBS@ XMEDCON_LIBVERS = @XMEDCON_LIBVERS@ XMEDCON_MAJOR = @XMEDCON_MAJOR@ XMEDCON_MICRO = @XMEDCON_MICRO@ XMEDCON_MINOR = @XMEDCON_MINOR@ XMEDCON_PRGR = @XMEDCON_PRGR@ XMEDCON_VERSION = @XMEDCON_VERSION@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LDFLAGS = @ZLIB_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_sizeof_int = @ac_cv_sizeof_int@ ac_cv_sizeof_long = @ac_cv_sizeof_long@ ac_cv_sizeof_long_long = @ac_cv_sizeof_long_long@ ac_cv_sizeof_short = @ac_cv_sizeof_short@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mdc_cv_bigendian = @mdc_cv_bigendian@ mdc_cv_enable_lnglng = @mdc_cv_enable_lnglng@ mdc_cv_glibsupport = @mdc_cv_glibsupport@ mdc_cv_gui = @mdc_cv_gui@ mdc_cv_include_acr = @mdc_cv_include_acr@ mdc_cv_include_anlz = @mdc_cv_include_anlz@ mdc_cv_include_conc = @mdc_cv_include_conc@ mdc_cv_include_dicm = @mdc_cv_include_dicm@ mdc_cv_include_ecat = @mdc_cv_include_ecat@ mdc_cv_include_gif = @mdc_cv_include_gif@ mdc_cv_include_intf = @mdc_cv_include_intf@ mdc_cv_include_inw = @mdc_cv_include_inw@ mdc_cv_include_nifti = @mdc_cv_include_nifti@ mdc_cv_include_png = @mdc_cv_include_png@ mdc_cv_include_tpc = @mdc_cv_include_tpc@ mdc_cv_ljpg = @mdc_cv_ljpg@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = gnu LIBVERSION = 2:1:0 @DO_GUI_TRUE@XMEDCON = xmedcon medcon_SOURCES = medcon.c medcon_LDADD = libmdc.la medcon_LDFLAGS = $(XMEDCON_GLIB_LIBS) $(XMEDCON_GTK_LIBS) -lm xmedcon_SOURCES = \ xcolmap.c \ xcolmap.h \ xcolgbc.c \ xcolgbc.h \ xdefs.c \ xdefs.h \ xicons.c \ xicons.h \ xerror.c \ xerror.h \ xextract.c \ xextract.h \ xfancy.c \ xfancy.h \ xfiles.c \ xfiles.h \ xfilesel.c \ xfilesel.h \ xhelp.c \ xhelp.h \ ximages.c \ ximages.h \ xinfo.c \ xinfo.h \ xlabels.c \ xlabels.h \ xmedcon.c \ xmedcon.h \ xmnuftry.c \ xmnuftry.h \ xoptions.c \ xoptions.h \ xpages.c \ xpages.h \ xprogbar.c \ xprogbar.h \ xreader.c \ xreader.h \ xrender.c \ xrender.h \ xreset.c \ xreset.h \ xresize.c \ xresize.h \ xreslice.c \ xreslice.h \ xtransf.c \ xtransf.h \ xutils.c \ xutils.h \ xviewer.c \ xviewer.h \ xvifi.c \ xvifi.h \ xwriter.c \ xwriter.h \ xzoom.c \ xzoom.h @PLATFORM_WIN32_TRUE@APPICON_OBJ = appicon.o @PLATFORM_WIN32_FALSE@xmedcon_LDADD = libmdc.la @PLATFORM_WIN32_TRUE@xmedcon_LDADD = $(APPICON_OBJ) libmdc.la @PLATFORM_WIN32_FALSE@xmedcon_LDFLAGS = $(GDK_PIXBUF_LIBS) -lm @PLATFORM_WIN32_TRUE@xmedcon_LDFLAGS = -mwindows $(GDK_PIXBUF_LIBS) -lm ALL_FRMTS_SOURCES = \ m-acr.c \ m-gif.c \ m-inw.c \ m-anlz.c \ m-conc.c \ m-matrix.c \ m-ecat64.c \ m-ecat72.c \ m-intf.c \ m-dicm.c \ m-png.c \ m-nifti.c ZLIB_LIB = @ZLIB_LDFLAGS@ @DO_ACR_TRUE@ACR_OBJ = m-acr.lo @DO_GIF_TRUE@GIF_OBJ = m-gif.lo @DO_INW_TRUE@INW_OBJ = m-inw.lo @DO_ANLZ_TRUE@ANLZ_OBJ = m-anlz.lo @DO_CONC_TRUE@CONC_OBJ = m-conc.lo @DO_ECAT_TRUE@ECAT_OBJ = m-matrix.lo m-ecat64.lo m-ecat72.lo @DO_INTF_TRUE@INTF_OBJ = m-intf.lo @DO_DICM_TRUE@DICM_OBJ = m-dicm.lo @DO_DICM_TRUE@DICM_DIR = ../libs/dicom @DO_DICM_TRUE@DICM_INC = -I$(DICM_DIR) @DO_DICM_TRUE@DICM_LIB = $(DICM_DIR)/libdicom.la @DO_PNG_TRUE@PNG_OBJ = m-png.lo @DO_PNG_TRUE@PNG_LIB = @PNG_LDFLAGS@ @DO_PNG_TRUE@PNG_INC = @PNG_CFLAGS@ @DO_NIFTI_TRUE@NIFTI_OBJ = m-nifti.lo @DO_NIFTI_TRUE@NIFTI_LIB = @NIFTI_LDFLAGS@ @DO_NIFTI_TRUE@NIFTI_INC = @NIFTI_CFLAGS@ @DO_TPC_TRUE@TPC_LIB = @TPC_LDFLAGS@ @DO_TPC_TRUE@TPC_INC = @TPC_CFLAGS@ @DO_LJPG_TRUE@LJPG_DIR = ../libs/ljpg @DO_LJPG_TRUE@LJPG_LIB = $(LJPG_DIR)/libljpg.la ENABLED_FRMTS_OBJS = \ $(ACR_OBJ) \ $(GIF_OBJ) \ $(INW_OBJ) \ $(ANLZ_OBJ) \ $(CONC_OBJ) \ $(ECAT_OBJ) \ $(INTF_OBJ) \ $(DICM_OBJ) \ $(PNG_OBJ) \ $(NIFTI_OBJ) lib_LTLIBRARIES = libmdc.la @PLATFORM_WIN32_TRUE@no_undefined = -no-undefined libmdc_la_SOURCES = \ m-init.c \ m-vifi.c \ m-color.c \ m-debug.c \ m-error.c \ m-fancy.c \ m-files.c \ m-split.c \ m-stack.c \ m-transf.c \ m-getopt.c \ m-algori.c \ m-global.c \ m-pixels.c \ m-rslice.c \ m-xtract.c \ m-progress.c \ m-qmedian.c \ m-structs.c \ m-raw.c libmdc_la_LDFLAGS = $(no_undefined) -version-info $(LIBVERSION) -lm libmdc_la_LIBADD = $(ENABLED_FRMTS_OBJS) \ $(DICM_LIB) $(LJPG_LIB) \ $(ZLIB_LIB) $(PNG_LIB) $(NIFTI_LIB) \ $(TPC_LIB) $(XMEDCON_GLIB_LIBS) $(XMEDCON_GTK_LIBS) libmdc_la_DEPENDENCIES = $(ENABLED_FRMTS_OBJS) EXTRA_libmdc_la_SOURCES = $(ALL_FRMTS_SOURCES) include_HEADERS = \ medcon.h \ m-init.h \ m-defs.h \ m-vifi.h \ m-color.h \ m-debug.h \ m-error.h \ m-fancy.h \ m-files.h \ m-split.h \ m-stack.h \ m-transf.h \ m-getopt.h \ m-algori.h \ m-global.h \ m-pixels.h \ m-rslice.h \ m-xtract.h \ m-progress.h \ m-qmedian.h \ m-structs.h \ m-raw.h \ m-acr.h \ m-gif.h \ m-inw.h \ m-anlz.h \ m-conc.h \ m-matrix.h \ m-ecat64.h \ m-ecat72.h \ m-intf.h \ m-dicm.h \ m-png.h \ m-nifti.h configheadersdir = $(prefix)/include configheaders_DATA = m-depend.h m-config.h AM_CPPFLAGS = $(DICM_INC) $(PNG_INC) $(NIFTI_INC) $(TPC_INC) \ $(GDK_PIXBUF_CFLAGS) $(XMEDCON_GLIB_CFLAGS) \ $(XMEDCON_GTK_CFLAGS) $(ZLIB_CFLAGS) AM_CFLAGS = EXTRA_DIST = appicon.rc all: m-depend.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu source/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu source/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): m-depend.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/m-depend.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status source/m-depend.h $(srcdir)/m-depend.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f m-depend.h stamp-h1 m-config.h: $(top_builddir)/config.status $(srcdir)/m-config.h.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libmdc.la: $(libmdc_la_OBJECTS) $(libmdc_la_DEPENDENCIES) $(EXTRA_libmdc_la_DEPENDENCIES) $(AM_V_CCLD)$(libmdc_la_LINK) -rpath $(libdir) $(libmdc_la_OBJECTS) $(libmdc_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list medcon$(EXEEXT): $(medcon_OBJECTS) $(medcon_DEPENDENCIES) $(EXTRA_medcon_DEPENDENCIES) @rm -f medcon$(EXEEXT) $(AM_V_CCLD)$(medcon_LINK) $(medcon_OBJECTS) $(medcon_LDADD) $(LIBS) xmedcon$(EXEEXT): $(xmedcon_OBJECTS) $(xmedcon_DEPENDENCIES) $(EXTRA_xmedcon_DEPENDENCIES) @rm -f xmedcon$(EXEEXT) $(AM_V_CCLD)$(xmedcon_LINK) $(xmedcon_OBJECTS) $(xmedcon_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-acr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-algori.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-anlz.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-color.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-conc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-debug.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-dicm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-ecat64.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-ecat72.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-error.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-fancy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-files.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-getopt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-gif.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-global.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-init.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-intf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-inw.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-matrix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-nifti.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-pixels.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-png.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-progress.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-qmedian.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-raw.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-rslice.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-split.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-stack.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-structs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-transf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-vifi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-xtract.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/medcon.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xcolgbc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xcolmap.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdefs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xerror.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xextract.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfancy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfiles.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfilesel.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xhelp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xicons.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ximages.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xinfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xlabels.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmedcon.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmnuftry.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xoptions.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xpages.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xprogbar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xreader.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xrender.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xreset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xresize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xreslice.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xtransf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xutils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xviewer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xvifi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xwriter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xzoom.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-configheadersDATA: $(configheaders_DATA) @$(NORMAL_INSTALL) @list='$(configheaders_DATA)'; test -n "$(configheadersdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(configheadersdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(configheadersdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(configheadersdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(configheadersdir)" || exit $$?; \ done uninstall-configheadersDATA: @$(NORMAL_UNINSTALL) @list='$(configheaders_DATA)'; test -n "$(configheadersdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(configheadersdir)'; $(am__uninstall_files_from_dir) install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) $(HEADERS) \ m-depend.h install-binPROGRAMS: install-libLTLIBRARIES installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(configheadersdir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-configheadersDATA install-data-local \ install-includeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-configheadersDATA \ uninstall-includeHEADERS uninstall-libLTLIBRARIES \ uninstall-local .MAKE: all install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-hdr \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-configheadersDATA install-data install-data-am \ install-data-local install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am \ install-includeHEADERS install-info install-info-am \ install-libLTLIBRARIES install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-configheadersDATA uninstall-includeHEADERS \ uninstall-libLTLIBRARIES uninstall-local @PLATFORM_WIN32_TRUE@$(APPICON_OBJ): $(APPICON_OBJ:.o=.rc) @PLATFORM_WIN32_TRUE@ windres -i $(APPICON_OBJ:.o=.rc) -o $(APPICON_OBJ) @OS_WIN32_TRUE@install-libtool-import-lib: @OS_WIN32_TRUE@ if test -f .libs/libmdc.dll.a ; then $(INSTALL) .libs/libmdc.dll.a $(DESTDIR)$(libdir) ; fi @OS_WIN32_TRUE@uninstall-libtool-import-lib: @OS_WIN32_TRUE@ if test -f $(DESTDIR)$(libdir)/libmdc.dll.a ; then rm $(DESTDIR)$(libdir)/libmdc.dll.a ; fi @OS_WIN32_FALSE@install-libtool-import-lib: @OS_WIN32_FALSE@uninstall-libtool-import-lib: install-data-local: install-libtool-import-lib uninstall-local: uninstall-libtool-import-lib # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xmedcon-0.14.1/source/xutils.c0000644000175000017510000003055012636253503013160 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xutils.c * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : utility routines * * * * project : (X)MedCon by Erik Nolf * * * * Functions : XMdcMedconQuit() - Quit XMedCon main program * * XMdcMainWidgetsInsensitive()- Make them insensitive * * XMdcMainWidgetsResensitive()- Make them sensitive * * XMdcWidgetCallbackDestroy() - General Destroy callback * * XMdcConfigureXMedcon() - Parse configuration file * * XMdcAskYesNo() - Ask a Yes/No question * * XMdcShowWidget() - Our show the widget routine* * XMdcWidgetDestroy() - Destroy widget = NULL * * XMdcSetGbcCorrection() - Set GBC corrected values * * XMdcBuildRgbImage() - Build an RGB image * * XMdcBuildGdkPixbuf() - Build GdkPixbuf out img8 * * XMdcBuildGdkPixbufFI() - Build GdkPixbuf out FI img * * XMdcPreventDelete() - Prevent delete event * * XMdcHandlerToHide() - Hide widget (no delete) * * XMdcFreeRGB() - Free RGB image * * XMdcToggleVisibility() - Toggle widget visibility * * XMdcSetImageScales() - Set width & height scale * * XMdcScaleW() - Scale image width * * XMdcScaleH() - Scale image height * * * * Note : Algoritme for gamma/brightness/contrast correction in * * function XMdcSetGbcCorrection() copied from library * * Imlib by Rasterman * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xutils.c,v 1.37 2015/12/22 13:59:31 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ /**************************************************************************** H E A D E R S ****************************************************************************/ #include "m-depend.h" #include #include #ifdef HAVE_STDLIB_H #include #endif #include "xmedcon.h" /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcMedconQuit(GtkWidget *widget, gpointer data) { XMdcFileReset(); XMdcFreeMyStuff(); gtk_exit(MDC_OK); } void XMdcMainWidgetsInsensitive(void) { if (my.viewwindow != NULL) gtk_widget_set_sensitive(my.viewwindow,FALSE); if (my.mainwindow != NULL) gtk_widget_set_sensitive(my.mainwindow,FALSE); } void XMdcMainWidgetsResensitive(void) { if (my.viewwindow != NULL) gtk_widget_set_sensitive(my.viewwindow,TRUE); if (my.mainwindow != NULL) gtk_widget_set_sensitive(my.mainwindow,TRUE); } void XMdcWidgetCallbackDestroy(GtkWidget *window) { gtk_widget_destroy(window); window = NULL; XMdcMainWidgetsResensitive(); } void XMdcConfigureXMedcon(void) { char *h; MdcDebugPrint("XMDCRC = %s",XMDCRC); MdcDebugPrint("XMDCHELP = %s",XMDCHELP); XMEDCONLUT = getenv("XMEDCONLUT"); XMEDCONRPI = getenv("XMEDCONRPI"); #ifdef _WIN32 /* try windows Program Files path */ sprintf(xmdcstr,"c:\\program files\\xmedcon\\etc\\xmedconrc"); if (MdcFileExists(xmdcstr)) { MdcDebugPrint("rc file found in \"Program Files\""); gtk_rc_parse(xmdcstr); return; } #else /* try unixes HOME environment variable */ h = getenv("HOME"); if (h != NULL) { sprintf(xmdcstr,"%s/.xmedconrc",h); if (MdcFileExists(xmdcstr)) { MdcDebugPrint("rc file found in HOME = %s",xmdcstr); gtk_rc_parse(xmdcstr); return; } } #endif /* try XMEDCONRC environment variable */ h = getenv("XMEDCONRC"); if (h != NULL) { if (MdcFileExists(h)) { MdcDebugPrint("rc file found in XMEDCONRC = %s",h); gtk_rc_parse(h); return; } } /* try hardcoded install path */ if (MdcFileExists(XMDCRC)) { MdcDebugPrint("rc file found in XMDCRC = %s",XMDCRC); gtk_rc_parse(XMDCRC); } } void XMdcAskYesNo(GtkSignalFunc YesFunc, GtkSignalFunc NoFunc, char *question) { GtkWidget *dialog; GtkWidget *label; GtkWidget *button; if (YesFunc == (GtkSignalFunc)NULL ) return; dialog = gtk_dialog_new(); gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area),0); gtk_signal_connect(GTK_OBJECT(dialog),"destroy", GTK_SIGNAL_FUNC(gtk_widget_destroy),NULL); gtk_widget_set_uposition(dialog,100,100); gtk_window_set_title(GTK_WINDOW(dialog), "Question"); gtk_container_set_border_width(GTK_CONTAINER(dialog),0); label = gtk_label_new(question); gtk_misc_set_padding(GTK_MISC(label),30,5); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), label, TRUE, TRUE, 0); gtk_widget_show(label); button=gtk_button_new_with_label("Yes"); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), button,TRUE,TRUE,0); gtk_signal_connect_object(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(dialog)); gtk_signal_connect(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(YesFunc),NULL); gtk_signal_connect_object(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(dialog)); gtk_widget_show(button); button=gtk_button_new_with_label("No"); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), button,TRUE,TRUE,0); if (NoFunc == (GtkSignalFunc)NULL) { gtk_signal_connect_object(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(dialog)); }else{ gtk_signal_connect_object(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(dialog)); gtk_signal_connect(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(NoFunc),NULL); gtk_signal_connect_object(GTK_OBJECT(button),"clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(dialog)); } gtk_widget_show(button); XMdcShowWidget(dialog); } void XMdcShowWidget(GtkWidget *w) { gtk_window_position(GTK_WINDOW(w), GTK_WIN_POS_MOUSE); gtk_widget_show(w); } void XMdcWidgetDestroy(GtkWidget *widget, gpointer data) { MdcDebugPrint("XMdcDestroyWidget()"); if (data != NULL) { gtk_widget_destroy(GTK_WIDGET(data)); data = NULL; } } void XMdcSetGbcCorrection(ColorModifier *mod) { double g, b, c, ii, v; Uint32 i; g = ((double)mod->gamma) / 256.; b = ((double)mod->brightness) / 256.; c = ((double)mod->contrast) / 256.; if (g < 0.01) g = 0.01; for (i = 0; i < 256; i++) { ii = ((double)i) / 256.; v = ((ii - 0.5) * c) + 0.5 + (b - 1.); if (v > 0) { v = pow(((ii - 0.5) * c) + 0.5 + (b - 1.), 1. / g) * 256.; }else{ v = 0.; } if (v > 255.) { v = 255.; }else if (v < 0.) { v = 0.; } mod->vgbc[i] = (guchar)v; } } Uint8 *XMdcBuildRgbImage(Uint8 *img8, Int16 type, Uint32 pixels, Uint8 *vgbc) { Uint8 *imgRGB, rr, gg, bb; Uint32 pix; imgRGB = (Uint8 *)malloc(pixels * 3); if (imgRGB == NULL) return(NULL); for (pix=0; pix < pixels; pix++) { if (type == COLRGB) { rr = img8[pix * 3 + 0]; gg = img8[pix * 3 + 1]; bb = img8[pix * 3 + 2]; }else{ rr = my.fi->palette[img8[pix] * 3 + 0]; gg = my.fi->palette[img8[pix] * 3 + 1]; bb = my.fi->palette[img8[pix] * 3 + 2]; } imgRGB[pix * 3 + 0] = vgbc[rr]; imgRGB[pix * 3 + 1] = vgbc[gg]; imgRGB[pix * 3 + 2] = vgbc[bb]; } return(imgRGB); } GdkPixbuf *XMdcBuildGdkPixbuf(Uint8 *img8, Uint32 w, Uint32 h, Int16 type, Uint8 *vgbc) { GdkPixbuf *imtmp, *im; Uint8 *imgRGB; Uint32 pixels = w * h; gint rw, rh; imgRGB = XMdcBuildRgbImage(img8, type, pixels, vgbc); if (imgRGB == NULL) return(NULL); rw = (gint)w; rh = (gint)h; imtmp = gdk_pixbuf_new_from_data(imgRGB,GDK_COLORSPACE_RGB,FALSE,8,rw,rh ,(int)(3*w),XMdcFreeRGB,NULL); if (imtmp == NULL) { MdcFree(imgRGB); return(NULL); } rw = (gint)XMdcScaleW(w); rh = (gint)XMdcScaleH(h); if ((rw != w) || (rh != h)) { im = gdk_pixbuf_scale_simple(imtmp,rw,rh,sRenderSelection.Interp); g_object_unref(imtmp); }else{ im = imtmp; } return(im); } GdkPixbuf *XMdcBuildGdkPixbufFI(FILEINFO *fi,Uint32 i,Uint8 *vgbc) { GdkPixbuf *im; Uint8 *img8; Uint32 w, h; Int16 t; w = fi->image[i].width; h = fi->image[i].height; t = fi->image[i].type; img8 = MdcGetDisplayImage(fi,i); if (img8 == NULL) XMdcDisplayFatalErr(MDC_BAD_ALLOC,"Couldn't create byte image"); im = XMdcBuildGdkPixbuf(img8, w, h, t, vgbc); MdcFree(img8); if (im == NULL) { XMdcDisplayFatalErr(MDC_BAD_ALLOC,"Couldn't create GdkPixbuf"); } return(im); } gboolean XMdcPreventDelete(GtkWidget *widget, GdkEvent *event, gpointer data) { return(TRUE); } gboolean XMdcHandlerToHide(GtkWidget *widget, GdkEvent *event, gpointer data) { gtk_widget_hide(widget); return(TRUE); } void XMdcFreeRGB(guchar *pixdata, gpointer data) { MdcFree(pixdata); } void XMdcToggleVisibility(GtkWidget *widget) { if (GTK_WIDGET_VISIBLE(widget)) { gtk_widget_hide(widget); }else{ gtk_widget_show(widget); } } void XMdcSetImageScales(void) { float ratio_width, ratio_height; my.scale_width = 1.; my.scale_height = 1.; /* scale to real world sizes */ if (my.fi->pixdim[1] > my.fi->pixdim[2]) { /* width > height -> height is unit */ my.scale_width = my.fi->pixdim[1] / my.fi->pixdim[2]; }else if (my.fi->pixdim[2] > my.fi->pixdim[1]) { /* height > width -> width is unit */ my.scale_height = my.fi->pixdim[2] / my.fi->pixdim[1]; } /* fit to screen sizes */ ratio_width = ((float)my.fi->mwidth * my.scale_width) / ((float)gdk_screen_width() - (1.2 * (float)XMDC_FREE_BORDER)); ratio_height = ((float)my.fi->mheight * my.scale_height) / ((float)gdk_screen_height() - (1.2 * (float)XMDC_FREE_BORDER)); if ((ratio_width <= 1.) && (ratio_height <= 1.)) return; /* both fit */ /* needs resizing */ if (ratio_width > ratio_height) { /* fit via width */ my.scale_width /= ratio_width; my.scale_height /= ratio_width; }else{ /* fit via height */ my.scale_width /= ratio_height; my.scale_height /= ratio_height; } } Uint32 XMdcScaleW(Uint32 width) { Uint32 new_width = width; if (my.scale_width != 1.) { new_width = (Uint32)((float)width * my.scale_width); } return(XMdcResize(new_width)); } Uint32 XMdcScaleH(Uint32 height) { Uint32 new_height = height; if (my.scale_height != 1.) { new_height = (Uint32)((float)height * my.scale_height); } return(XMdcResize(new_height)); } xmedcon-0.14.1/source/m-intf.h0000644000175000017510000001201112636253502013016 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: m-intf.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : m-intf.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: m-intf.h,v 1.33 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __M_INTF_H__ #define __M_INTF_H__ /**************************************************************************** D E F I N E S ****************************************************************************/ #define MDC_INTF_SIG "interfile" #define MDC_INTF_SUPP_VERS "3.3" #define MDC_INTF_SUPP_DATE "1996:09:24" #define MDC_INTF_MAXKEYCHARS 256 #define MDC_INTF_UNKNOWN 0 #define MDC_CNTRL_Z 0x0a1a /* the data types */ #define MDC_INTF_STATIC 1 #define MDC_INTF_DYNAMIC 2 #define MDC_INTF_GATED 3 #define MDC_INTF_TOMOGRAPH 4 #define MDC_INTF_CURVE 5 #define MDC_INTF_ROI 6 #define MDC_INTF_GSPECT 7 #define MDC_INTF_DIALECT_PET 10 /* the process status */ #define MDC_INTF_ACQUIRED 1 #define MDC_INTF_RECONSTRUCTED 2 typedef struct MdcInterFile_t { Int8 DIALECT; int dim_num, dim_found; /* for handling dialect */ int data_type, process_status, pixel_type; Uint32 width, height, images_per_dimension, time_slots; Uint32 data_offset, data_blocks, imagesize, number_images; Uint32 energy_windows, frame_groups, time_windows, detector_heads; float pixel_xsize, pixel_ysize; float slice_thickness, centre_centre_separation; /* in [pixels] official */ float slice_thickness_mm; /* in [mm] dialect */ float study_duration, image_duration, image_pause, group_pause, ext_rot; float procent_cycles_acquired; float rescale_slope, rescale_intercept; Int8 patient_rot, patient_orient, slice_orient; } MDC_INTERFILE; /**************************************************************************** F U N C T I O N S ****************************************************************************/ int MdcCheckINTF(FILEINFO *fi); int MdcGetIntfKey(FILE *fp); void MdcInitIntf(MDC_INTERFILE *intf); int MdcIsEmptyKeyValue(void); int MdcIntfIsString(char *string, int key); int MdcIsArrayKey(void); int MdcGetMaxIntArrayKey(void); int MdcGetIntKey(void); int MdcGetYesNoKey(void); double MdcGetFloatKey(void); void MdcGetStrKey(char *str); void MdcGetSubStrKey(char *str, int n); void MdcGetDateKey(char *str); void MdcGetSplitDateKey(Int16 *year, Int16 *month, Int16 *day); void MdcGetSplitTimeKey(Int16 *hour, Int16 *minute, Int16 *second); int MdcGetDataType(void); int MdcGetProcessStatus(void); int MdcGetPatRotation(void); int MdcGetPatOrientation(void); int MdcGetSliceOrient(void); int MdcGetPatSlOrient(MDC_INTERFILE *intf); int MdcGetPixelType(void); int MdcGetRotation(void); int MdcGetMotion(void); int MdcGetGSpectNesting(void); int MdcSpecifyPixelType(MDC_INTERFILE *intf); char *MdcHandleIntfDialect(FILEINFO *fi, MDC_INTERFILE *intf); char *MdcReadIntfHeader(FILEINFO *fi, MDC_INTERFILE *intf); char *MdcReadIntfImages(FILEINFO *fi, MDC_INTERFILE *intf); const char *MdcReadINTF(FILEINFO *fi); char *MdcType2Intf(int type); char *MdcGetProgramDate(void); char *MdcSetPatRotation(int patient_slice_orient); char *MdcSetPatOrientation(int patient_slice_orient); char *MdcCheckIntfDim(FILEINFO *fi); char *MdcWriteGenImgData(FILEINFO *fi); char *MdcWriteWindows(FILEINFO *fi); char *MdcWriteMatrixInfo(FILEINFO *fi, Uint32 img); char *MdcWriteIntfStatic(FILEINFO *fi); char *MdcWriteIntfDynamic(FILEINFO *fi); char *MdcWriteIntfTomo(FILEINFO *fi); char *MdcWriteIntfGated(FILEINFO *fi); char *MdcWriteIntfGSPECT(FILEINFO *fi); char *MdcWriteIntfHeader(FILEINFO *fi); char *MdcWriteIntfImages(FILEINFO *fi); const char *MdcWriteINTF(FILEINFO *fi); #endif xmedcon-0.14.1/source/xlabels.h0000644000175000017510000000455212636253502013271 00000000000000/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * filename: xlabels.h * * * * UTIL C-source: Medical Image Conversion Utility * * * * purpose : xlabels.c header file * * * * project : (X)MedCon by Erik Nolf * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* $Id: xlabels.h,v 1.18 2015/12/22 13:59:30 enlf Exp $ */ /* Copyright (C) 1997-2016 by Erik Nolf This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __XLABELS_H__ #define __XLABELS_H__ /**************************************************************************** F U N C T I O N S ****************************************************************************/ void XMdcGetEcatLabelNumbers(Uint32 realnumber, Uint32 *plane, Uint32 *frame, Uint32 *gate, Uint32 *bed); char *XMdcGetImageLabelIndex(Uint32 nr); char *XMdcGetImageLabelTimes(Uint32 nr); void XMdcPrintImageLabelIndex(GtkWidget *widget, Uint32 nr); void XMdcPrintImageLabelTimes(GtkWidget *widget, Uint32 nr); void XMdcLabelSelCallbackApply(GtkWidget *widget, gpointer data); void XMdcUnsensitiveColNumFrames(GtkWidget *widget, gpointer data); void XMdcSensitiveColNumFrames(GtkWidget *widget, gpointer data); void XMdcLabelSel(void); #endif xmedcon-0.14.1/NEWS0000644000175000017510000000000107354034472010652 00000000000000 xmedcon-0.14.1/config.guess0000755000175000017510000013077111203650747012512 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2008-09-28' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown if [ "${UNAME_SYSTEM}" = "Linux" ] ; then eval $set_cc_for_build cat << EOF > $dummy.c #include #ifdef __UCLIBC__ # ifdef __UCLIBC_CONFIG_VERSION__ LIBC=uclibc __UCLIBC_CONFIG_VERSION__ # else LIBC=uclibc # endif #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep LIBC= | sed -e 's: ::g'` fi # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd | genuineintel) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo cris-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo frv-unknown-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld" exit ;; esac # This should get integrated into the C code below, but now we hack if [ "$LIBC" != "gnu" ] ; then echo "$TENTATIVE" && exit 0 ; fi # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: xmedcon-0.14.1/macros/0000755000175000017510000000000012637632716011535 500000000000000xmedcon-0.14.1/macros/Makefile.am0000644000175000017510000000212212161564241013473 00000000000000## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## filename: Makefile.am ## ## ## ## UTIL Make : Medical Image Conversion Utility ## ## ## ## purpose : macros subdir Makefile template (automake) ## ## ## ## project : (X)MedCon by Erik Nolf ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## $Id: Makefile.am,v 1.3 2013/06/23 12:22:57 enlf Exp $ AUTOMAKE_OPTIONS = gnu m4datadir = $(datadir)/aclocal m4data_DATA = xmedcon.m4 noinst_MACROS = \ gdk-pixbuf.m4 \ glib.m4 \ gtk.m4 \ libtool.m4 \ lt~obsolete.m4 \ ltoptions.m4 \ ltsugar.m4 \ ltversion.m4 EXTRA_DIST = README $(m4data_DATA) $(noinst_MACROS) xmedcon-0.14.1/macros/gtk.m40000644000175000017510000002013710715162134012472 00000000000000# Configure paths for GTK+ # Owen Taylor 97-11-3 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS dnl AC_DEFUN([AM_PATH_GTK], [dnl dnl Get the cflags and libraries from the gtk-config script dnl AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], gtk_config_prefix="$withval", gtk_config_prefix="") AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], , enable_gtktest=yes) for module in . $4 do case "$module" in gthread) gtk_config_args="$gtk_config_args gthread" ;; esac done if test x$gtk_config_exec_prefix != x ; then gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" if test x${GTK_CONFIG+set} != xset ; then GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config fi fi if test x$gtk_config_prefix != x ; then gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" if test x${GTK_CONFIG+set} != xset ; then GTK_CONFIG=$gtk_config_prefix/bin/gtk-config fi fi AC_PATH_PROG(GTK_CONFIG, gtk-config, no) min_gtk_version=ifelse([$1], ,0.99.7,$1) AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) no_gtk="" if test "$GTK_CONFIG" = "no" ; then no_gtk=yes else GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_gtktest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$GTK_LIBS $LIBS" dnl dnl Now check if the installed GTK is sufficiently new. (Also sanity dnl checks the results of gtk-config to some extent dnl rm -f conf.gtktest AC_TRY_RUN([ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.gtktest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_gtk_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gtk_version"); exit(1); } if ((gtk_major_version != $gtk_config_major_version) || (gtk_minor_version != $gtk_config_minor_version) || (gtk_micro_version != $gtk_config_micro_version)) { printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, gtk_major_version, gtk_minor_version, gtk_micro_version); printf ("*** was found! If gtk-config was correct, then it is best\n"); printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); printf("*** before re-running configure\n"); } #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) else if ((gtk_major_version != GTK_MAJOR_VERSION) || (gtk_minor_version != GTK_MINOR_VERSION) || (gtk_micro_version != GTK_MICRO_VERSION)) { printf("*** GTK+ header files (version %d.%d.%d) do not match\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", gtk_major_version, gtk_minor_version, gtk_micro_version); } #endif /* defined (GTK_MAJOR_VERSION) ... */ else { if ((gtk_major_version > major) || ((gtk_major_version == major) && (gtk_minor_version > minor)) || ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", gtk_major_version, gtk_minor_version, gtk_micro_version); printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); printf("*** correct copy of gtk-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_gtk" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$GTK_CONFIG" = "no" ; then echo "*** The gtk-config script installed by GTK could not be found" echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the GTK_CONFIG environment variable to the" echo "*** full path to gtk-config." else if test -f conf.gtktest ; then : else echo "*** Could not run GTK test program, checking why..." CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" AC_TRY_LINK([ #include #include ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK or finding the wrong" echo "*** version of GTK. If it is not finding GTK, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" echo "***" echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" echo "*** came with the system with the command" echo "***" echo "*** rpm --erase --nodeps gtk gtk-devel" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GTK was incorrectly installed" echo "*** or that you have moved GTK since it was installed. In the latter case, you" echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GTK_CFLAGS="" GTK_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) rm -f conf.gtktest ]) xmedcon-0.14.1/macros/xmedcon.m40000644000175000017510000001453310715162134013345 00000000000000# Configure paths for (X)MedCon library # fix by Hannes Hofmann 2007-06-28 for more than 3 version numbers # stolen from Elliot Lee 2000-01-10 # stolen from Raph Levien 98-11-18 # stolen from Manish Singh 98-9-30 # stolen back from Frank Belew # stolen from Manish Singh # Shamelessly stolen from Owen Taylor dnl AM_PATH_XMEDCON([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for XMEDCON, and define XMEDCON_CFLAGS and XMEDCON_LIBS dnl AC_DEFUN([AM_PATH_XMEDCON], [dnl dnl Get the cflags and libraries from the xmedcon-config script dnl AC_ARG_WITH(xmedcon-prefix,[ --with-xmedcon-prefix=PFX Prefix where XMEDCON is installed (optional)], xmedcon_prefix="$withval", xmedcon_prefix="") AC_ARG_WITH(xmedcon-exec-prefix,[ --with-xmedcon-exec-prefix=PFX Exec prefix where XMEDCON is installed (optional)], xmedcon_exec_prefix="$withval", xmedcon_exec_prefix="") AC_ARG_ENABLE(xmedcontest, [ --disable-xmedcontest Do not try to compile and run a test XMEDCON program], , enable_xmedcontest=yes) if test x$xmedcon_exec_prefix != x ; then xmedcon_args="$xmedcon_args --exec-prefix=$xmedcon_exec_prefix" if test x${XMEDCON_CONFIG+set} = xset ; then XMEDCON_CONFIG=$xmedcon_exec_prefix/xmedcon-config fi fi if test x$xmedcon_prefix != x ; then xmedcon_args="$xmedcon_args --prefix=$xmedcon_prefix" if test x${XMEDCON_CONFIG+set} = xset ; then XMEDCON_CONFIG=$xmedcon_prefix/bin/xmedcon-config fi fi AC_PATH_PROG(XMEDCON_CONFIG, xmedcon-config, no) min_xmedcon_version=ifelse([$1], ,0.5.2,$1) AC_MSG_CHECKING(for XMEDCON - version >= $min_xmedcon_version) no_xmedcon="" if test "$XMEDCON_CONFIG" = "no" ; then no_xmedcon=yes else XMEDCON_CFLAGS=`$XMEDCON_CONFIG $xmedconconf_args --cflags` XMEDCON_LIBS=`$XMEDCON_CONFIG $xmedconconf_args --libs` xmedcon_major_version=`$XMEDCON_CONFIG $xmedcon_args --version | \ sed 's/^\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` xmedcon_minor_version=`$XMEDCON_CONFIG $xmedcon_args --version | \ sed 's/^\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` xmedcon_micro_version=`$XMEDCON_CONFIG $xmedcon_config_args --version | \ sed 's/^\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` if test "x$enable_xmedcontest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $XMEDCON_CFLAGS" LIBS="$LIBS $XMEDCON_LIBS" dnl dnl Now check if the installed XMEDCON is sufficiently new. (Also sanity dnl checks the results of xmedcon-config to some extent dnl rm -f conf.xmedcontest AC_TRY_RUN([ #include #include #include #include char* my_strdup (char *str) { char *new_str; if (str) { new_str = (char *) malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str; } int main () { int major, minor, micro; char *tmp_version; system ("touch conf.xmedcontest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = my_strdup("$min_xmedcon_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_xmedcon_version"); exit(1); } if (($xmedcon_major_version > major) || (($xmedcon_major_version == major) && ($xmedcon_minor_version > minor)) || (($xmedcon_major_version == major) && ($xmedcon_minor_version == minor) && ($xmedcon_micro_version >= micro))) { return 0; } else { printf("\n*** 'xmedcon-config --version' returned %d.%d.%d, but the minimum version\n", $xmedcon_major_version, $xmedcon_minor_version, $xmedcon_micro_version); printf("*** of XMEDCON required is %d.%d.%d. If xmedcon-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If xmedcon-config was wrong, set the environment variable XMEDCON_CONFIG\n"); printf("*** to point to the correct copy of xmedcon-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } } ],, no_xmedcon=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_xmedcon" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$XMEDCON_CONFIG" = "no" ; then echo "*** The xmedcon-config script installed by XMEDCON could not be found" echo "*** If XMEDCON was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the XMEDCON_CONFIG environment variable to the" echo "*** full path to xmedcon-config." else if test -f conf.xmedcontest ; then : else echo "*** Could not run XMEDCON test program, checking why..." CFLAGS="$CFLAGS $XMEDCON_CFLAGS" LIBS="$LIBS $XMEDCON_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding XMEDCON or finding the wrong" echo "*** version of XMEDCON. If it is not finding XMEDCON, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means XMEDCON was incorrectly installed" echo "*** or that you have moved XMEDCON since it was installed. In the latter case, you" echo "*** may want to edit the xmedcon-config script: $XMEDCON_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi XMEDCON_CFLAGS="" XMEDCON_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(XMEDCON_CFLAGS) AC_SUBST(XMEDCON_LIBS) rm -f conf.xmedcontest ]) xmedcon-0.14.1/macros/ChangeLog0000644000175000017510000000000011152103414013170 00000000000000xmedcon-0.14.1/macros/ltoptions.m40000644000175000017510000003426212637622445013757 00000000000000# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 8 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option '$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl 'shared' nor 'disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], [_LT_WITH_AIX_SONAME([aix])]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the 'shared' and # 'disable-shared' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the 'static' and # 'disable-static' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the 'fast-install' # and 'disable-fast-install' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_AIX_SONAME([DEFAULT]) # ---------------------------------- # implement the --with-aix-soname flag, and support the `aix-soname=aix' # and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT # is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. m4_define([_LT_WITH_AIX_SONAME], [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[[5-9]]*,yes) AC_MSG_CHECKING([which variant of shared library versioning to provide]) AC_ARG_WITH([aix-soname], [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], [case $withval in aix|svr4|both) ;; *) AC_MSG_ERROR([Unknown argument to --with-aix-soname]) ;; esac lt_cv_with_aix_soname=$with_aix_soname], [AC_CACHE_VAL([lt_cv_with_aix_soname], [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) with_aix_soname=$lt_cv_with_aix_soname]) AC_MSG_RESULT([$with_aix_soname]) if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac _LT_DECL([], [shared_archive_member_spec], [0], [Shared archive member basename, for filename based shared library versioning on AIX])dnl ])# _LT_WITH_AIX_SONAME LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the 'pic-only' and 'no-pic' # LT_INIT options. # MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac], [pic_mode=m4_default([$1], [default])]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) xmedcon-0.14.1/macros/README0000644000175000017510000000246712162416404012331 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: README # # # # UTILITY text: Medical Image Conversion Utility # # # # purpose : the macros `you-should-read' file # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: README,v 1.5 2013/06/25 22:43:16 enlf Exp $ a) 'xmedcon.m4' This is (X)MedCon's macro for dependent projects which use autotools configure. This file is installed somewhere down ${prefix}/share. b) 'glib.m4', 'gtk.m4' & 'gdk-pixbuf.m4' These macro files are provided to regenerate autotools files on systems without Gtk+ related resources. Don't forget to run: $> aclocal -I macros c) 'libtool.m4' & 'lt...m4' files These macros are added by autotools for local libtool functionality. The files in (b) and (c) are *not copied* to the system during install. xmedcon-0.14.1/macros/libtool.m40000644000175000017510000112570012637622445013367 00000000000000# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . ]) # serial 58 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_PREPARE_CC_BASENAME # ----------------------- m4_defun([_LT_PREPARE_CC_BASENAME], [ # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in @S|@*""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } ])# _LT_PREPARE_CC_BASENAME # _LT_CC_BASENAME(CC) # ------------------- # It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, # but that macro is also expanded into generated libtool script, which # arranges for $SED and $ECHO to be set by different means. m4_defun([_LT_CC_BASENAME], [m4_require([_LT_PREPARE_CC_BASENAME])dnl AC_REQUIRE([_LT_DECL_SED])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl func_cc_basename $1 cc_basename=$func_cc_basename_result ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl m4_require([_LT_CMD_TRUNCATE])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from 'configure', and 'config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # 'config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain=$ac_aux_dir/ltmain.sh ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the 'libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to 'config.status' so that its # declaration there will have the same value as in 'configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags='_LT_TAGS'dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into 'config.status', and then the shell code to quote escape them in # for loops in 'config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # '#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test 0 = "$lt_write_fail" && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ '$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test 0 != $[#] do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try '$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try '$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test yes = "$silent" && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 _LT_COPYING _LT_LIBTOOL_TAGS # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE _LT_PREPARE_MUNGE_PATH_LIST _LT_PREPARE_CC_BASENAME # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS=$save_LDFLAGS ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[[012]][[,.]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test yes = "$lt_cv_ld_force_load"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" m4_if([$1], [CXX], [ if test yes != "$lt_cv_apple_cc_single_mod"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script that will find a shell with a builtin # printf (that we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case $ECHO in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [Search for dependent libraries within DIR (or the compiler's sysroot if not specified).])], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([$with_sysroot]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and where our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test yes = "[$]$2"; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS ]) if test yes = "[$]$2"; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n "$lt_cv_sys_max_cmd_len"; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes = "$cross_compiling"; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen=shl_load], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen=dlopen], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) ]) ]) ]) ]) ]) ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links=nottested if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test no = "$hard_links"; then AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", [Define to the sub-directory where libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then # We can hardcode non-existent directories. if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_PREPARE_MUNGE_PATH_LIST # --------------------------- # Make sure func_munge_path_list() is defined correctly. m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], [[# func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x@S|@2 in x) ;; *:) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" ;; x:*) eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; *::*) eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" ;; *) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; esac } ]])# _LT_PREPARE_PATH_LIST # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown AC_ARG_VAR([LT_SYS_LIBRARY_PATH], [User-defined run-time library search path.]) case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a[(]lib.so.V[)]' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi # Handle Gentoo/FreeBSD as it was Linux case $host_vendor in gentoo) version_type=linux ;; *) version_type=freebsd-$objformat ;; esac case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; linux) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' need_lib_prefix=no need_version=no ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], [Detected run-time system search path for libraries]) _LT_DECL([], [configure_time_lt_sys_library_path], [2], [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program that can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$1"; then lt_cv_path_MAGIC_CMD=$ac_dir/"$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac]) MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program that can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test no = "$withval" || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], [if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi]) rm -f conftest.i conftest2.i conftest.out]) ])# _LT_PATH_DD # _LT_CMD_TRUNCATE # ---------------- # find command to truncate a binary pipe m4_defun([_LT_CMD_TRUNCATE], [m4_require([_LT_PATH_DD]) AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], [printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) _LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], [Command to truncate a binary pipe]) ])# _LT_CMD_TRUNCATE # _LT_CHECK_MAGIC_METHOD # ---------------------- # how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_MAGIC_METHOD], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) AC_CACHE_CHECK([how to recognize dependent libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[[4-9]]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[[45]]*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi]) if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # _LT_DLL_DEF_P([FILE]) # --------------------- # True iff FILE is a Windows DLL '.def' file. # Keep in sync with func_dll_def_p in the libtool script AC_DEFUN([_LT_DLL_DEF_P], [dnl test DEF = "`$SED -n dnl -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl -e q dnl Only consider the first "real" line $1`" dnl ])# _LT_DLL_DEF_P # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM=-lm) ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test yes = "$GCC"; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], [Transform the output of nm into a list of symbols to manually relocate]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([nm_interface], [lt_cv_nm_interface], [1], [The name lister interface]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test yes = "$GCC"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS=$save_LDFLAGS]) if test yes = "$lt_cv_irix_exported_symbol"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(ld_shlibs, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; osf3*) if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test yes = "$GCC"; then wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test yes,yes = "$GCC,$enable_shared"; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting $shlibpath_var if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC=$CC AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report what library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC=$lt_save_CC ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(GCC, $1)=$GXX _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case @S|@2 in .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)=$prev$p else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)=$p else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)=$p else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test no = "$F77"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_F77"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$G77 _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_F77" AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test no = "$FC"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_FC"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_FC" AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code=$lt_simple_compile_test_code # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f "$lt_ac_sed" && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test 10 -lt "$lt_ac_count" && break lt_ac_count=`expr $lt_ac_count + 1` if test "$lt_ac_count" -gt "$lt_ac_max"; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine what file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS xmedcon-0.14.1/macros/glib.m40000644000175000017510000002037410715162134012625 00000000000000# Configure paths for GLIB # Owen Taylor 97-11-3 dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or dnl gthread is specified in MODULES, pass to glib-config dnl AC_DEFUN([AM_PATH_GLIB], [dnl dnl Get the cflags and libraries from the glib-config script dnl AC_ARG_WITH(glib-prefix,[ --with-glib-prefix=PFX Prefix where GLIB is installed (optional)], glib_config_prefix="$withval", glib_config_prefix="") AC_ARG_WITH(glib-exec-prefix,[ --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)], glib_config_exec_prefix="$withval", glib_config_exec_prefix="") AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and run a test GLIB program], , enable_glibtest=yes) if test x$glib_config_exec_prefix != x ; then glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix" if test x${GLIB_CONFIG+set} != xset ; then GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config fi fi if test x$glib_config_prefix != x ; then glib_config_args="$glib_config_args --prefix=$glib_config_prefix" if test x${GLIB_CONFIG+set} != xset ; then GLIB_CONFIG=$glib_config_prefix/bin/glib-config fi fi for module in . $4 do case "$module" in gmodule) glib_config_args="$glib_config_args gmodule" ;; gthread) glib_config_args="$glib_config_args gthread" ;; esac done AC_PATH_PROG(GLIB_CONFIG, glib-config, no) min_glib_version=ifelse([$1], ,0.99.7,$1) AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) no_glib="" if test "$GLIB_CONFIG" = "no" ; then no_glib=yes else GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags` GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs` glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_glibtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$GLIB_LIBS $LIBS" dnl dnl Now check if the installed GLIB is sufficiently new. (Also sanity dnl checks the results of glib-config to some extent dnl rm -f conf.glibtest AC_TRY_RUN([ #include #include #include int main () { int major, minor, micro; char *tmp_version; system ("touch conf.glibtest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = g_strdup("$min_glib_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_glib_version"); exit(1); } if ((glib_major_version != $glib_config_major_version) || (glib_minor_version != $glib_config_minor_version) || (glib_micro_version != $glib_config_micro_version)) { printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, glib_major_version, glib_minor_version, glib_micro_version); printf ("*** was found! If glib-config was correct, then it is best\n"); printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n"); printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n"); printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n"); printf("*** before re-running configure\n"); } else if ((glib_major_version != GLIB_MAJOR_VERSION) || (glib_minor_version != GLIB_MINOR_VERSION) || (glib_micro_version != GLIB_MICRO_VERSION)) { printf("*** GLIB header files (version %d.%d.%d) do not match\n", GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); printf("*** library (version %d.%d.%d)\n", glib_major_version, glib_minor_version, glib_micro_version); } else { if ((glib_major_version > major) || ((glib_major_version == major) && (glib_minor_version > minor)) || ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) { return 0; } else { printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", glib_major_version, glib_minor_version, glib_micro_version); printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", major, minor, micro); printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the glib-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n"); printf("*** correct copy of glib-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } ],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_glib" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$GLIB_CONFIG" = "no" ; then echo "*** The glib-config script installed by GLIB could not be found" echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the GLIB_CONFIG environment variable to the" echo "*** full path to glib-config." else if test -f conf.glibtest ; then : else echo "*** Could not run GLIB test program, checking why..." CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$LIBS $GLIB_LIBS" AC_TRY_LINK([ #include #include ], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GLIB or finding the wrong" echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" echo "***" echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" echo "*** came with the system with the command" echo "***" echo "*** rpm --erase --nodeps gtk gtk-devel" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GLIB was incorrectly installed" echo "*** or that you have moved GLIB since it was installed. In the latter case, you" echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GLIB_CFLAGS="" GLIB_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) rm -f conf.glibtest ]) xmedcon-0.14.1/macros/lt~obsolete.m40000644000175000017510000001377412637622445014303 00000000000000# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software # Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) xmedcon-0.14.1/macros/ltsugar.m40000644000175000017510000001044012637622445013375 00000000000000# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59, which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) xmedcon-0.14.1/macros/ltversion.m40000644000175000017510000000127312637622445013745 00000000000000# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 4179 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.6]) m4_define([LT_PACKAGE_REVISION], [2.4.6]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.6' macro_revision='2.4.6' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) xmedcon-0.14.1/macros/gdk-pixbuf.m40000644000175000017510000001511410715162134013744 00000000000000# Configure paths for gdk-pixbuf # Elliot Lee 2000-01-10 # stolen from Raph Levien 98-11-18 # stolen from Manish Singh 98-9-30 # stolen back from Frank Belew # stolen from Manish Singh # Shamelessly stolen from Owen Taylor dnl AM_PATH_GDK_PIXBUF([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for GDK_PIXBUF, and define GDK_PIXBUF_CFLAGS and GDK_PIXBUF_LIBS dnl AC_DEFUN([AM_PATH_GDK_PIXBUF], [dnl dnl Get the cflags and libraries from the gdk-pixbuf-config script dnl AC_ARG_WITH(gdk-pixbuf-prefix,[ --with-gdk-pixbuf-prefix=PFX Prefix where GDK_PIXBUF is installed (optional)], gdk_pixbuf_prefix="$withval", gdk_pixbuf_prefix="") AC_ARG_WITH(gdk-pixbuf-exec-prefix,[ --with-gdk-pixbuf-exec-prefix=PFX Exec prefix where GDK_PIXBUF is installed (optional)], gdk_pixbuf_exec_prefix="$withval", gdk_pixbuf_exec_prefix="") AC_ARG_ENABLE(gdk_pixbuftest, [ --disable-gdk_pixbuftest Do not try to compile and run a test GDK_PIXBUF program], , enable_gdk_pixbuftest=yes) if test x$gdk_pixbuf_exec_prefix != x ; then gdk_pixbuf_args="$gdk_pixbuf_args --exec-prefix=$gdk_pixbuf_exec_prefix" if test x${GDK_PIXBUF_CONFIG+set} = xset ; then GDK_PIXBUF_CONFIG=$gdk_pixbuf_exec_prefix/gdk-pixbuf-config fi fi if test x$gdk_pixbuf_prefix != x ; then gdk_pixbuf_args="$gdk_pixbuf_args --prefix=$gdk_pixbuf_prefix" if test x${GDK_PIXBUF_CONFIG+set} = xset ; then GDK_PIXBUF_CONFIG=$gdk_pixbuf_prefix/bin/gdk-pixbuf-config fi fi AC_PATH_PROG(GDK_PIXBUF_CONFIG, gdk-pixbuf-config, no) min_gdk_pixbuf_version=ifelse([$1], ,0.2.5,$1) AC_MSG_CHECKING(for GDK_PIXBUF - version >= $min_gdk_pixbuf_version) no_gdk_pixbuf="" if test "$GDK_PIXBUF_CONFIG" = "no" ; then no_gdk_pixbuf=yes else GDK_PIXBUF_CFLAGS=`$GDK_PIXBUF_CONFIG $gdk_pixbufconf_args --cflags` GDK_PIXBUF_LIBS=`$GDK_PIXBUF_CONFIG $gdk_pixbufconf_args --libs` gdk_pixbuf_major_version=`$GDK_PIXBUF_CONFIG $gdk_pixbuf_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` gdk_pixbuf_minor_version=`$GDK_PIXBUF_CONFIG $gdk_pixbuf_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` gdk_pixbuf_micro_version=`$GDK_PIXBUF_CONFIG $gdk_pixbuf_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_gdk_pixbuftest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GDK_PIXBUF_CFLAGS" LIBS="$LIBS $GDK_PIXBUF_LIBS" dnl dnl Now check if the installed GDK_PIXBUF is sufficiently new. (Also sanity dnl checks the results of gdk-pixbuf-config to some extent dnl rm -f conf.gdk_pixbuftest AC_TRY_RUN([ #include #include #include #include char* my_strdup (char *str) { char *new_str; if (str) { new_str = malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str; } int main () { int major, minor, micro; char *tmp_version; system ("touch conf.gdk_pixbuftest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = my_strdup("$min_gdk_pixbuf_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_gdk_pixbuf_version"); exit(1); } if (($gdk_pixbuf_major_version > major) || (($gdk_pixbuf_major_version == major) && ($gdk_pixbuf_minor_version > minor)) || (($gdk_pixbuf_major_version == major) && ($gdk_pixbuf_minor_version == minor) && ($gdk_pixbuf_micro_version >= micro))) { return 0; } else { printf("\n*** 'gdk-pixbuf-config --version' returned %d.%d.%d, but the minimum version\n", $gdk_pixbuf_major_version, $gdk_pixbuf_minor_version, $gdk_pixbuf_micro_version); printf("*** of GDK_PIXBUF required is %d.%d.%d. If gdk-pixbuf-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If gdk-pixbuf-config was wrong, set the environment variable GDK_PIXBUF_CONFIG\n"); printf("*** to point to the correct copy of gdk-pixbuf-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } } ],, no_gdk_pixbuf=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_gdk_pixbuf" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$GDK_PIXBUF_CONFIG" = "no" ; then echo "*** The gdk-pixbuf-config script installed by GDK_PIXBUF could not be found" echo "*** If GDK_PIXBUF was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the GDK_PIXBUF_CONFIG environment variable to the" echo "*** full path to gdk-pixbuf-config." else if test -f conf.gdk_pixbuftest ; then : else echo "*** Could not run GDK_PIXBUF test program, checking why..." CFLAGS="$CFLAGS $GDK_PIXBUF_CFLAGS" LIBS="$LIBS $GDK_PIXBUF_LIBS" AC_TRY_LINK([ #include #include ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GDK_PIXBUF or finding the wrong" echo "*** version of GDK_PIXBUF. If it is not finding GDK_PIXBUF, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means GDK_PIXBUF was incorrectly installed" echo "*** or that you have moved GDK_PIXBUF since it was installed. In the latter case, you" echo "*** may want to edit the gdk-pixbuf-config script: $GDK_PIXBUF_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi GDK_PIXBUF_CFLAGS="" GDK_PIXBUF_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(GDK_PIXBUF_CFLAGS) AC_SUBST(GDK_PIXBUF_LIBS) rm -f conf.gdk_pixbuftest ]) xmedcon-0.14.1/macros/Makefile.in0000644000175000017510000003772312637622763013537 00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = macros DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ChangeLog README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/source/m-depend.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(m4datadir)" DATA = $(m4data_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DECOMPRESS = @DECOMPRESS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_ACR = @ENABLE_ACR@ ENABLE_ANLZ = @ENABLE_ANLZ@ ENABLE_CONC = @ENABLE_CONC@ ENABLE_DICM = @ENABLE_DICM@ ENABLE_ECAT = @ENABLE_ECAT@ ENABLE_GIF = @ENABLE_GIF@ ENABLE_INTF = @ENABLE_INTF@ ENABLE_INW = @ENABLE_INW@ ENABLE_NIFTI = @ENABLE_NIFTI@ ENABLE_PNG = @ENABLE_PNG@ ENABLE_TPC = @ENABLE_TPC@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIBMDCETC = @GLIBMDCETC@ GLIBSUPPORTED = @GLIBSUPPORTED@ GREP = @GREP@ GTKONE = @GTKONE@ GTKSUPPORTED = @GTKSUPPORTED@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NIFTI_CFLAGS = @NIFTI_CFLAGS@ NIFTI_LDFLAGS = @NIFTI_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PNG_CFLAGS = @PNG_CFLAGS@ PNG_LDFLAGS = @PNG_LDFLAGS@ PNG_LIBS = @PNG_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TPC_CFLAGS = @TPC_CFLAGS@ TPC_LDFLAGS = @TPC_LDFLAGS@ VERSION = @VERSION@ XMDCETC = @XMDCETC@ XMEDCON_DATE = @XMEDCON_DATE@ XMEDCON_GLIB_CFLAGS = @XMEDCON_GLIB_CFLAGS@ XMEDCON_GLIB_LIBS = @XMEDCON_GLIB_LIBS@ XMEDCON_GTK_CFLAGS = @XMEDCON_GTK_CFLAGS@ XMEDCON_GTK_LIBS = @XMEDCON_GTK_LIBS@ XMEDCON_LIBVERS = @XMEDCON_LIBVERS@ XMEDCON_MAJOR = @XMEDCON_MAJOR@ XMEDCON_MICRO = @XMEDCON_MICRO@ XMEDCON_MINOR = @XMEDCON_MINOR@ XMEDCON_PRGR = @XMEDCON_PRGR@ XMEDCON_VERSION = @XMEDCON_VERSION@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LDFLAGS = @ZLIB_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_sizeof_int = @ac_cv_sizeof_int@ ac_cv_sizeof_long = @ac_cv_sizeof_long@ ac_cv_sizeof_long_long = @ac_cv_sizeof_long_long@ ac_cv_sizeof_short = @ac_cv_sizeof_short@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mdc_cv_bigendian = @mdc_cv_bigendian@ mdc_cv_enable_lnglng = @mdc_cv_enable_lnglng@ mdc_cv_glibsupport = @mdc_cv_glibsupport@ mdc_cv_gui = @mdc_cv_gui@ mdc_cv_include_acr = @mdc_cv_include_acr@ mdc_cv_include_anlz = @mdc_cv_include_anlz@ mdc_cv_include_conc = @mdc_cv_include_conc@ mdc_cv_include_dicm = @mdc_cv_include_dicm@ mdc_cv_include_ecat = @mdc_cv_include_ecat@ mdc_cv_include_gif = @mdc_cv_include_gif@ mdc_cv_include_intf = @mdc_cv_include_intf@ mdc_cv_include_inw = @mdc_cv_include_inw@ mdc_cv_include_nifti = @mdc_cv_include_nifti@ mdc_cv_include_png = @mdc_cv_include_png@ mdc_cv_include_tpc = @mdc_cv_include_tpc@ mdc_cv_ljpg = @mdc_cv_ljpg@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = gnu m4datadir = $(datadir)/aclocal m4data_DATA = xmedcon.m4 noinst_MACROS = \ gdk-pixbuf.m4 \ glib.m4 \ gtk.m4 \ libtool.m4 \ lt~obsolete.m4 \ ltoptions.m4 \ ltsugar.m4 \ ltversion.m4 EXTRA_DIST = README $(m4data_DATA) $(noinst_MACROS) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu macros/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu macros/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-m4dataDATA: $(m4data_DATA) @$(NORMAL_INSTALL) @list='$(m4data_DATA)'; test -n "$(m4datadir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(m4datadir)'"; \ $(MKDIR_P) "$(DESTDIR)$(m4datadir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(m4datadir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(m4datadir)" || exit $$?; \ done uninstall-m4dataDATA: @$(NORMAL_UNINSTALL) @list='$(m4data_DATA)'; test -n "$(m4datadir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(m4datadir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(m4datadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-m4dataDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-m4dataDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am \ install-m4dataDATA install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am uninstall-m4dataDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xmedcon-0.14.1/etc/0000755000175000017510000000000012637632716011024 500000000000000xmedcon-0.14.1/etc/Makefile.am0000644000175000017510000000236212637623762013004 00000000000000## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## filename: Makefile.am ## ## ## ## UTIL Make : Medical Image Conversion Utility ## ## ## ## purpose : gtk subdir Makefile template (automake) ## ## ## ## project : (X)MedCon by Erik Nolf ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## $Id: Makefile.am,v 1.12 2015/12/26 23:51:14 enlf Exp $ AUTOMAKE_OPTIONS = gnu RC_FILES = \ xmedconrc \ xmedconrc.linux \ xmedconrc.mswin ICONS = xmedcon.ico xmedcon.png GTK_DIST = README $(RC_FILES) $(ICONS) sysconfdir = $(prefix)/etc sysconf_DATA = xmedconrc appdatadir = $(datadir)/appdata dist_appdata_DATA = xmedcon.appdata.xml EXTRA_DIST = \ $(GTK_DIST) \ xmedcon.appdata.xml \ xmedcon.spec DISTCLEANFILES = \ xmedcon-*.info \ xmedcon-*.iss \ xmedcon-*.ebuild xmedcon-0.14.1/etc/xmedcon.spec0000644000175000017510000000536212637632713013260 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: xmedcon.spec.in # # # # UTILITY text: Medical Image Conversion Utility # # # # purpose : the RPM package spec template # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: xmedcon.spec.in,v 1.7 2015/12/26 15:03:50 enlf Exp $ # Name: xmedcon Version: 0.14.1 Release: 1 BuildRoot: %{_tmppath}/%{name}-%{version}-root Summary: a medical image conversion utility and library License: (L)GPL Group: Applications/Graphics Source: http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz URL: http://xmedcon.sourceforge.net Packager: Erik Nolf Requires: gtk2 BuildRequires: gtk2-devel %description This project stands for Medical Image Conversion and is released under the GNU's (L)GPL license. It bundles the C sourcecode, a library, a flexible command-line utility and a graphical front-end based on the amazing Gtk+ toolkit. Its main purpose is image conversion while preserving valuable medical study information. The currently supported formats are: Acr/Nema 2.0, Analyze (SPM), Concorde/uPET, DICOM 3.0, CTI ECAT 6/7, InterFile 3.3 and PNG or Gif87a/89a towards desktop applications. %package devel Summary: static libraries and header files for (X)MedCon development Group: Development/Libraries Requires: xmedcon = %{version} %description devel The xmedcon-devel package contains the header files and static libraries necessary for developing programs that make use of the (X)MedCon library (libmdc). %prep %setup -q %build %configure make %install rm -rf ${RPM_BUILD_ROOT} %makeinstall %clean rm -rf ${RPM_BUILD_ROOT} %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %defattr(-, root, root) %doc ChangeLog COPYING COPYING.LIB README REMARKS AUTHORS %{_libdir}/*so.* %{_libdir}/*.la %{_bindir}/* %{_sysconfdir}/* %{_mandir}/man1/* %{_datadir}/appdata/* %files devel %doc README COPYING COPYING.LIB %defattr(-,root,root) %{_mandir}/man3/* %{_mandir}/man4/* %{_includedir}/* %{_libdir}/*.a %{_libdir}/*.so %{_datadir}/aclocal/* %changelog * Sat Dec 26 2015 Erik Nolf - added xmedcon.appdata.xml to %files section * Fri May 08 2009 Erik Nolf - removed line with hardcoded sysconfdir value * Sat Nov 20 2004 Erik Nolf - multi-lib; bin & devel packages; install in /usr xmedcon-0.14.1/etc/xmedconrc.mswin0000644000175000017510000001053012051256122013763 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: xmedconrc.mswin # # # # CONFIG File : Medical Image Conversion Utility # # # # purpose : the Gtk+ resource file for MS Windows systems # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: xmedconrc.mswin,v 1.3 2012/11/15 21:19:14 enlf Exp $ # Note: When (X)MedCon is installed, this becomes the system wide resource # file. You could copy it to your ${HOME}/.xmedconrc for personal # configurations. Though you better keep the fixed font as fixed. # # DEFAULT WINDOWS SETTINGS (green/yellow/gray colors + fixed = courier font) # style "DefaultStyle" { font = "-*-ms sans serif-medium-r-normal--*-110-*-*-*-*-*-*" #font = "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" #font = "-*-lucida-medium-r-normal-*-12-*-*-*-*-*-iso8859-1" bg[NORMAL] = { 0.84, 0.84, 0.84 } } style "FixedStyle" = "DefaultStyle" { font = "-*-courier new-medium-r-normal--*-110-*-*-*-*-iso8859-1" #font = "-misc-courier-medium-r-normal--*-100-*-*-*-*-*-*" } style "Window" = "DefaultStyle" { } style "Button" = "DefaultStyle" { fg[NORMAL] = { 0.0, 0.0, 1.0 } fg[PRELIGHT] = { 1.0, 1.0, 0.0 } bg[PRELIGHT] = { 0.0, 0.75, 0.0 } fg[ACTIVE] = { 0.0, 0.0, 1.0 } bg[ACTIVE] = { 0.0, 0.75, 0.0 } } style "NormalLabel" = "DefaultStyle" { fg[NORMAL] = { 0.0, 0.0, 1.0 } fg[PRELIGHT] = { 1.0, 1.0, 0.0 } bg[PRELIGHT] = { 0.0, 0.75, 0.0 } fg[ACTIVE] = { 0.0, 0.0, 1.0 } bg[ACTIVE] = { 0.0, 0.75, 0.0 } } style "BarLabel" = "FixedStyle" { fg[NORMAL] = { 0.0, 0.0, 1.0 } fg[PRELIGHT] = { 1.0, 1.0, 0.0 } bg[PRELIGHT] = { 0.0, 0.75, 0.0 } fg[ACTIVE] = { 0.0, 0.0, 1.0 } bg[ACTIVE] = { 0.0, 0.75, 0.0 } } style "FixedLabel" = "FixedStyle" { fg[NORMAL] = { 0.0, 0.0, 0.0 } fg[PRELIGHT] = { 1.0, 1.0, 0.0 } bg[PRELIGHT] = { 0.0, 0.75, 0.0 } fg[ACTIVE] = { 0.0, 0.0, 1.0 } bg[ACTIVE] = { 0.0, 0.75, 0.0 } } style "Frame" = "DefaultStyle" { fg[NORMAL] = { 0.0, 0.0, 1.0 } } style "Menu" = "DefaultStyle" { fg[NORMAL] = { 0.0, 0.0, 1.0 } fg[PRELIGHT] = { 1.0, 1.0, 0.0 } bg[PRELIGHT] = { 0.0, 0.75, 0.0 } fg[ACTIVE] = { 0.0, 0.0, 1.0 } bg[ACTIVE] = { 0.0, 0.75, 0.0 } } style "ToggleButton" = "FixedStyle" { fg[NORMAL] = { 0.0, 0.0, 0.0 } fg[ACTIVE] = { 0.0, 0.0, 0.0 } bg[ACTIVE] = { 0.0, 0.75, 0.0 } fg[PRELIGHT] = { 1.0, 1.0, 0.0 } bg[PRELIGHT] = { 0.0, 0.75, 0.0 } } style "FixedText" = "FixedStyle" { } # These set the widget types to use the styles defined above. # The widget types are listed in the class hierarchy, but could probably be # just listed in this document for the users reference. widget_class "GtkWidget" style "DefaultStyle" widget_class "GtkWindow" style "Window" widget_class "GtkDialog" style "Window" widget_class "GtkFileSelection" style "Window" widget_class "*GtkCheckButton*" style "ToggleButton" widget_class "*GtkRadioButton*" style "ToggleButton" widget_class "*GtkButton*" style "Button" widget_class "*GtkLabel*" style "NormalLabel" widget_class "*GtkFrame*" style "Frame" widget_class "*GtkAspectFrame*" style "Frame" widget_class "*Menu*" style "Menu" widget_class "*Selection*" style "DefaultStyle" widget_class "*GtkText" style "FixedText" widget_class "*GtkNotebook" style "DefaultStyle" widget "*FixedLabel*" style "FixedLabel" widget "*BarLabel*" style "BarLabel" widget "*GtkCheckButton*" style "ToggleButton" widget "*GtkRadioButton*" style "ToggleButton" widget "*GtkText*" style "FixedText" xmedcon-0.14.1/etc/xmedcon.spec.in0000644000175000017510000000536712637526126013672 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: xmedcon.spec.in # # # # UTILITY text: Medical Image Conversion Utility # # # # purpose : the RPM package spec template # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: xmedcon.spec.in,v 1.7 2015/12/26 15:03:50 enlf Exp $ # Name: @PACKAGE@ Version: @VERSION@ Release: 1 BuildRoot: %{_tmppath}/%{name}-%{version}-root Summary: a medical image conversion utility and library License: (L)GPL Group: Applications/Graphics Source: http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz URL: http://xmedcon.sourceforge.net Packager: Erik Nolf Requires: gtk2 BuildRequires: gtk2-devel %description This project stands for Medical Image Conversion and is released under the GNU's (L)GPL license. It bundles the C sourcecode, a library, a flexible command-line utility and a graphical front-end based on the amazing Gtk+ toolkit. Its main purpose is image conversion while preserving valuable medical study information. The currently supported formats are: Acr/Nema 2.0, Analyze (SPM), Concorde/uPET, DICOM 3.0, CTI ECAT 6/7, InterFile 3.3 and PNG or Gif87a/89a towards desktop applications. %package devel Summary: static libraries and header files for (X)MedCon development Group: Development/Libraries Requires: xmedcon = %{version} %description devel The xmedcon-devel package contains the header files and static libraries necessary for developing programs that make use of the (X)MedCon library (libmdc). %prep %setup -q %build %configure make %install rm -rf ${RPM_BUILD_ROOT} %makeinstall %clean rm -rf ${RPM_BUILD_ROOT} %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %defattr(-, root, root) %doc ChangeLog COPYING COPYING.LIB README REMARKS AUTHORS %{_libdir}/*so.* %{_libdir}/*.la %{_bindir}/* %{_sysconfdir}/* %{_mandir}/man1/* %{_datadir}/appdata/* %files devel %doc README COPYING COPYING.LIB %defattr(-,root,root) %{_mandir}/man3/* %{_mandir}/man4/* %{_includedir}/* %{_libdir}/*.a %{_libdir}/*.so %{_datadir}/aclocal/* %changelog * Sat Dec 26 2015 Erik Nolf - added xmedcon.appdata.xml to %files section * Fri May 08 2009 Erik Nolf - removed line with hardcoded sysconfdir value * Sat Nov 20 2004 Erik Nolf - multi-lib; bin & devel packages; install in /usr xmedcon-0.14.1/etc/ChangeLog0000644000175000017510000000000011152103413012456 00000000000000xmedcon-0.14.1/etc/xmedconrc0000644000175000017510000001047610717415077012655 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: xmedconrc # # # # CONFIG File : Medical Image Conversion Utility # # # # purpose : the general Gtk+ resource file # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: xmedconrc,v 1.4 2007/11/16 22:31:27 enlf Exp $ # Note: When (X)MedCon is installed, this becomes the system wide resource # file. You could copy it to your ${HOME}/.xmedconrc for personal # configurations. Though you better keep the fixed font as fixed. # # DEFAULT UNIX SETTINGS (green/yellow/gray color style) # style "DefaultStyle" { #font = "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" font = "-*-lucida-medium-r-normal-*-12-*-*-*-*-*-iso8859-1" bg[NORMAL] = { 0.84, 0.84, 0.84 } } style "FixedStyle" = "DefaultStyle" { #font = "-misc-fixed-medium-r-normal--*-120-*-*-*-*-*-*" font = "-adobe-courier-medium-r-normal-*-*-100-*-*-*-*-*-*" #font = "-*-fixed-medium-r-semicondensed-*-*-120-*-*-*-*-iso8859-1" } style "Window" = "DefaultStyle" { } style "Button" = "DefaultStyle" { fg[NORMAL] = { 0.0, 0.0, 1.0 } fg[PRELIGHT] = { 1.0, 1.0, 0.0 } bg[PRELIGHT] = { 0.0, 0.75, 0.0 } fg[ACTIVE] = { 0.0, 0.0, 1.0 } bg[ACTIVE] = { 0.0, 0.75, 0.0 } } style "NormalLabel" = "DefaultStyle" { fg[NORMAL] = { 0.0, 0.0, 1.0 } fg[PRELIGHT] = { 1.0, 1.0, 0.0 } bg[PRELIGHT] = { 0.0, 0.75, 0.0 } fg[ACTIVE] = { 0.0, 0.0, 1.0 } bg[ACTIVE] = { 0.0, 0.75, 0.0 } } style "BarLabel" = "FixedStyle" { fg[NORMAL] = { 0.0, 0.0, 1.0 } fg[PRELIGHT] = { 1.0, 1.0, 0.0 } bg[PRELIGHT] = { 0.0, 0.75, 0.0 } fg[ACTIVE] = { 0.0, 0.0, 1.0 } bg[ACTIVE] = { 0.0, 0.75, 0.0 } } style "FixedLabel" = "FixedStyle" { fg[NORMAL] = { 0.0, 0.0, 0.0 } fg[PRELIGHT] = { 1.0, 1.0, 0.0 } bg[PRELIGHT] = { 0.0, 0.75, 0.0 } fg[ACTIVE] = { 0.0, 0.0, 1.0 } bg[ACTIVE] = { 0.0, 0.75, 0.0 } } style "Frame" = "DefaultStyle" { fg[NORMAL] = { 0.0, 0.0, 1.0 } } style "Menu" = "DefaultStyle" { fg[NORMAL] = { 0.0, 0.0, 1.0 } fg[PRELIGHT] = { 1.0, 1.0, 0.0 } bg[PRELIGHT] = { 0.0, 0.75, 0.0 } fg[ACTIVE] = { 0.0, 0.0, 1.0 } bg[ACTIVE] = { 0.0, 0.75, 0.0 } } style "ToggleButton" = "FixedStyle" { fg[NORMAL] = { 0.0, 0.0, 0.0 } fg[ACTIVE] = { 0.0, 0.0, 0.0 } bg[ACTIVE] = { 0.0, 0.75, 0.0 } fg[PRELIGHT] = { 1.0, 1.0, 0.0 } bg[PRELIGHT] = { 0.0, 0.75, 0.0 } } style "FixedText" = "FixedStyle" { } # These set the widget types to use the styles defined above. # The widget types are listed in the class hierarchy, but could probably be # just listed in this document for the users reference. widget_class "GtkWidget" style "DefaultStyle" widget_class "GtkWindow" style "Window" widget_class "GtkDialog" style "Window" widget_class "GtkFileSelection" style "Window" widget_class "*GtkCheckButton*" style "ToggleButton" widget_class "*GtkRadioButton*" style "ToggleButton" widget_class "*GtkButton*" style "Button" widget_class "*GtkLabel*" style "NormalLabel" widget_class "*GtkFrame*" style "Frame" widget_class "*GtkAspectFrame*" style "Frame" widget_class "*Menu*" style "Menu" widget_class "*Selection*" style "DefaultStyle" widget_class "*GtkText" style "FixedText" widget_class "*GtkNotebook" style "DefaultStyle" widget "*FixedLabel*" style "FixedLabel" widget "*BarLabel*" style "BarLabel" widget "*GtkCheckButton*" style "ToggleButton" widget "*GtkRadioButton*" style "ToggleButton" widget "*GtkText*" style "FixedText" xmedcon-0.14.1/etc/xmedconrc.linux0000644000175000017510000001041310717415077014002 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: xmedconrc.linux # # # # CONFIG File : Medical Image Conversion Utility # # # # purpose : the Gtk+ resource file for Linux systems # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: xmedconrc.linux,v 1.4 2007/11/16 22:31:27 enlf Exp $ # Note: When (X)MedCon is installed, this becomes the system wide resource # file. You could copy it to your ${HOME}/.xmedconrc for personal # configurations. Though you better keep the fixed font as fixed. # # LINUX SETTING (green/yellow/grey colors disabled for GNOME environment) # style "DefaultStyle" { #font = "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" #font = "-*-lucida-medium-r-normal-*-12-*-*-*-*-*-iso8859-1" #bg[NORMAL] = { 0.84, 0.84, 0.84 } } style "FixedStyle" = "DefaultStyle" { #font = "-misc-fixed-medium-r-normal--*-120-*-*-*-*-*-*" font = "-adobe-courier-medium-r-normal-*-*-100-*-*-*-*-*-*" } style "Window" = "DefaultStyle" { } style "Button" = "DefaultStyle" { #fg[NORMAL] = { 0.0, 0.0, 1.0 } #fg[PRELIGHT] = { 1.0, 1.0, 0.0 } #bg[PRELIGHT] = { 0.0, 0.75, 0.0 } #fg[ACTIVE] = { 0.0, 0.0, 1.0 } #bg[ACTIVE] = { 0.0, 0.75, 0.0 } } style "NormalLabel" = "DefaultStyle" { fg[NORMAL] = { 0.0, 0.0, 0.0 } #fg[PRELIGHT] = { 1.0, 1.0, 0.0 } #bg[PRELIGHT] = { 0.0, 0.75, 0.0 } #fg[ACTIVE] = { 0.0, 0.0, 1.0 } #bg[ACTIVE] = { 0.0, 0.75, 0.0 } } style "BarLabel" = "FixedStyle" { #fg[NORMAL] = { 0.0, 0.0, 1.0 } #fg[PRELIGHT] = { 1.0, 1.0, 0.0 } #bg[PRELIGHT] = { 0.0, 0.75, 0.0 } #fg[ACTIVE] = { 0.0, 0.0, 1.0 } #bg[ACTIVE] = { 0.0, 0.75, 0.0 } } style "FixedLabel" = "FixedStyle" { fg[NORMAL] = { 0.0, 0.0, 0.0 } #fg[PRELIGHT] = { 1.0, 1.0, 0.0 } #bg[PRELIGHT] = { 0.0, 0.75, 0.0 } #fg[ACTIVE] = { 0.0, 0.0, 1.0 } #bg[ACTIVE] = { 0.0, 0.75, 0.0 } } style "Frame" = "DefaultStyle" { fg[NORMAL] = { 0.0, 0.0, 1.0 } } style "Menu" = "DefaultStyle" { #fg[NORMAL] = { 0.0, 0.0, 1.0 } #fg[PRELIGHT] = { 1.0, 1.0, 0.0 } #bg[PRELIGHT] = { 0.0, 0.75, 0.0 } #fg[ACTIVE] = { 0.0, 0.0, 1.0 } #bg[ACTIVE] = { 0.0, 0.75, 0.0 } } style "ToggleButton" = "FixedStyle" { fg[NORMAL] = { 0.0, 0.0, 0.0 } #fg[ACTIVE] = { 0.0, 0.0, 0.0 } bg[ACTIVE] = { 0.0, 0.75, 0.0 } #fg[PRELIGHT] = { 1.0, 1.0, 0.0 } #bg[PRELIGHT] = { 0.0, 0.75, 0.0 } } style "FixedText" = "FixedStyle" { } # These set the widget types to use the styles defined above. # The widget types are listed in the class hierarchy, but could probably be # just listed in this document for the users reference. widget_class "GtkWidget" style "DefaultStyle" widget_class "GtkWindow" style "Window" widget_class "GtkDialog" style "Window" widget_class "GtkFileSelection" style "Window" widget_class "*GtkCheckButton*" style "ToggleButton" widget_class "*GtkRadioButton*" style "ToggleButton" widget_class "*GtkButton*" style "Button" widget_class "*GtkLabel*" style "NormalLabel" widget_class "*GtkFrame*" style "Frame" widget_class "*GtkAspectFrame*" style "Frame" widget_class "*Menu*" style "Menu" widget_class "*Selection*" style "DefaultStyle" widget_class "*GtkText" style "FixedText" widget_class "*GtkNotebook" style "DefaultStyle" widget "*FixedLabel*" style "FixedLabel" widget "*BarLabel*" style "BarLabel" widget "*GtkCheckButton*" style "ToggleButton" widget "*GtkRadioButton*" style "ToggleButton" widget "*GtkText*" style "FixedText" xmedcon-0.14.1/etc/xmedcon.ebuild.in0000644000175000017510000000256312637631763014203 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: xmedcon.ebuild.in # # # # UTILITY text: Medical Image Conversion Utility # # # # purpose : our Gentoo's portage ebuild template # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: xmedcon.ebuild.in,v 1.12 2015/12/27 00:42:27 enlf Exp $ # EAPI=5 DESCRIPTION="Medical Image Conversion Utility" HOMEPAGE="http://${PN}.sourceforge.net" SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2" LICENSE="GPL-2 LGPL-2" SLOT="0" #KEYWORDS="alpha amd64 arm hppa ia64 mips ppc ppc64 sparc x86" KEYWORDS="x86 ~amd64" IUSE="png gtk" DEPEND="=x11-libs/gtk+-2* png? ( >=media-libs/libpng-1.2.1 ) dev-util/pkgconfig" src_configure() { econf $(use_enable gtk gui) $(use_enable png) } src_compile() { emake } src_install() { emake DESTDIR="${D}" install dodoc AUTHORS COPYING* INSTALL NEWS README REMARKS } xmedcon-0.14.1/etc/README0000644000175000017510000000250207765171271011623 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: README # # # # UTILITY text: Medical Image Conversion Utility # # # # purpose : the etc `you-should-read' file # # # # project : (X)MedCon by Erik Nolf # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: README,v 1.2 2003/12/08 21:52:57 enlf Exp $ a) The Gtk+ Resource File This directory contains the XMedCon Gtk+ resource file `xmedconrc'. You could copy the `xmedconrc' file to ${HOME}/.xmedconrc for personal widget fonts and color configurations or set an environment variable XMEDCONRC with an absolute path to the rcfile in use. b) Package Management Templates xmedcon.spec.in: RPM package creation (http://www.rpm.org) xmedcon.info.in: FINK package creation (http://fink.sourceforge.net) xmedcon.iss.in : Inno Setup installer (http://www.jrsoftware.org/isinfo.htm) xmedcon-0.14.1/etc/xmedcon.ico0000644000175000017510000000727607447363343013111 0000000000000000(0`RUR)()kikcacBAB! !JIJ141sus! 9) !0R,R)0Z1(J1Tb^hg8[-*p7̘'bu_W@ʹyY\j -YW=~$ؑA+R_0f*4"] `jEA N IP+ @l+BDH<3$p+ :b_?,BvIENDB`xmedcon-0.14.1/etc/xmedcon.appdata.xml0000644000175000017510000000226012240237677014531 00000000000000 xmedcon.desktop CC0 Xmedcon A medical image conversion utility and library

This project stands for Medical Image Conversion and is released under the GNU's (L)GPL license. It bundles the C source code, a library, a flexible command-line utility and a graphical front-end based on the amazing Gtk+ toolkit.

Its main purpose is image conversion while preserving valuable medical study information. The currently supported formats are: Acr/Nema 2.0, Analyze (SPM), Concorde/uPET, DICOM 3.0, CTI ECAT 6/7, InterFile 3.3 and PNG or Gif87a/89a towards desktop applications.

http://xmedcon.sourceforge.net/images/screenshot.png http://xmedcon.sourceforge.net// enlf_at_users.sourceforge.net
xmedcon-0.14.1/etc/xmedcon.info.in0000644000175000017510000000364210130102136013636 00000000000000# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # filename: xmedcon.info.in # # # # UTILITY text: Medical Image Conversion Utility # # # # purpose : the FINK package info template # # # # project : (X)MedCon by Erik Nolf # # # # credits : contributed by Andy Loening # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # $Id: xmedcon.info.in,v 1.3 2004/10/03 22:59:42 enlf Exp $ # Package: @PACKAGE@ Version: @VERSION@ Revision: 1 Source: mirror:sourceforge:xmedcon/%n-%v.tar.gz Source-MD5: Depends: gtk+-shlibs, libpng3-shlibs, gdk-pixbuf-shlibs BuildDepends: gtk+, libpng3, gdk-pixbuf InstallScript: make install PREFIX=%p DESTDIR=%d ConfigureParams: --with-png-prefix=%p #DocFiles: README COPYING AUTHORS Description: a medical image conversion utility and library DescDetail: << This project stands for Medical Image Conversion and is released under the GNU's (L)GPL license. It bundles the C sourcecode, a library, a flexible command-line utility and a graphical front-end based on the amazing Gtk+ toolkit. Its main purpose is image conversion while preserving valuable medical study information. The currently supported formats are: Acr/Nema 2.0, Analyze (SPM), Concorde/uPET, DICOM 3.0, CTI ECAT 6/7, InterFile 3.3 and PNG or Gif87a/89a towards desktop applications. << License: GPL/LGPL Homepage: http://xmedcon.sourceforge.net/ Maintainer: Erik Nolf xmedcon-0.14.1/etc/Makefile.in0000644000175000017510000004262212637624063013013 00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = etc DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(srcdir)/xmedcon.spec.in \ $(srcdir)/xmedcon.iss.in $(srcdir)/xmedcon.info.in \ $(srcdir)/xmedcon.ebuild.in $(dist_appdata_DATA) ChangeLog \ README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/source/m-depend.h CONFIG_CLEAN_FILES = xmedcon.spec CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(appdatadir)" "$(DESTDIR)$(sysconfdir)" DATA = $(dist_appdata_DATA) $(sysconf_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DECOMPRESS = @DECOMPRESS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_ACR = @ENABLE_ACR@ ENABLE_ANLZ = @ENABLE_ANLZ@ ENABLE_CONC = @ENABLE_CONC@ ENABLE_DICM = @ENABLE_DICM@ ENABLE_ECAT = @ENABLE_ECAT@ ENABLE_GIF = @ENABLE_GIF@ ENABLE_INTF = @ENABLE_INTF@ ENABLE_INW = @ENABLE_INW@ ENABLE_NIFTI = @ENABLE_NIFTI@ ENABLE_PNG = @ENABLE_PNG@ ENABLE_TPC = @ENABLE_TPC@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIBMDCETC = @GLIBMDCETC@ GLIBSUPPORTED = @GLIBSUPPORTED@ GREP = @GREP@ GTKONE = @GTKONE@ GTKSUPPORTED = @GTKSUPPORTED@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NIFTI_CFLAGS = @NIFTI_CFLAGS@ NIFTI_LDFLAGS = @NIFTI_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PNG_CFLAGS = @PNG_CFLAGS@ PNG_LDFLAGS = @PNG_LDFLAGS@ PNG_LIBS = @PNG_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TPC_CFLAGS = @TPC_CFLAGS@ TPC_LDFLAGS = @TPC_LDFLAGS@ VERSION = @VERSION@ XMDCETC = @XMDCETC@ XMEDCON_DATE = @XMEDCON_DATE@ XMEDCON_GLIB_CFLAGS = @XMEDCON_GLIB_CFLAGS@ XMEDCON_GLIB_LIBS = @XMEDCON_GLIB_LIBS@ XMEDCON_GTK_CFLAGS = @XMEDCON_GTK_CFLAGS@ XMEDCON_GTK_LIBS = @XMEDCON_GTK_LIBS@ XMEDCON_LIBVERS = @XMEDCON_LIBVERS@ XMEDCON_MAJOR = @XMEDCON_MAJOR@ XMEDCON_MICRO = @XMEDCON_MICRO@ XMEDCON_MINOR = @XMEDCON_MINOR@ XMEDCON_PRGR = @XMEDCON_PRGR@ XMEDCON_VERSION = @XMEDCON_VERSION@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LDFLAGS = @ZLIB_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_sizeof_int = @ac_cv_sizeof_int@ ac_cv_sizeof_long = @ac_cv_sizeof_long@ ac_cv_sizeof_long_long = @ac_cv_sizeof_long_long@ ac_cv_sizeof_short = @ac_cv_sizeof_short@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mdc_cv_bigendian = @mdc_cv_bigendian@ mdc_cv_enable_lnglng = @mdc_cv_enable_lnglng@ mdc_cv_glibsupport = @mdc_cv_glibsupport@ mdc_cv_gui = @mdc_cv_gui@ mdc_cv_include_acr = @mdc_cv_include_acr@ mdc_cv_include_anlz = @mdc_cv_include_anlz@ mdc_cv_include_conc = @mdc_cv_include_conc@ mdc_cv_include_dicm = @mdc_cv_include_dicm@ mdc_cv_include_ecat = @mdc_cv_include_ecat@ mdc_cv_include_gif = @mdc_cv_include_gif@ mdc_cv_include_intf = @mdc_cv_include_intf@ mdc_cv_include_inw = @mdc_cv_include_inw@ mdc_cv_include_nifti = @mdc_cv_include_nifti@ mdc_cv_include_png = @mdc_cv_include_png@ mdc_cv_include_tpc = @mdc_cv_include_tpc@ mdc_cv_ljpg = @mdc_cv_ljpg@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = $(prefix)/etc target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = gnu RC_FILES = \ xmedconrc \ xmedconrc.linux \ xmedconrc.mswin ICONS = xmedcon.ico xmedcon.png GTK_DIST = README $(RC_FILES) $(ICONS) sysconf_DATA = xmedconrc appdatadir = $(datadir)/appdata dist_appdata_DATA = xmedcon.appdata.xml EXTRA_DIST = \ $(GTK_DIST) \ xmedcon.appdata.xml \ xmedcon.spec DISTCLEANFILES = \ xmedcon-*.info \ xmedcon-*.iss \ xmedcon-*.ebuild all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu etc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu etc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): xmedcon.spec: $(top_builddir)/config.status $(srcdir)/xmedcon.spec.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-dist_appdataDATA: $(dist_appdata_DATA) @$(NORMAL_INSTALL) @list='$(dist_appdata_DATA)'; test -n "$(appdatadir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(appdatadir)'"; \ $(MKDIR_P) "$(DESTDIR)$(appdatadir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(appdatadir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(appdatadir)" || exit $$?; \ done uninstall-dist_appdataDATA: @$(NORMAL_UNINSTALL) @list='$(dist_appdata_DATA)'; test -n "$(appdatadir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(appdatadir)'; $(am__uninstall_files_from_dir) install-sysconfDATA: $(sysconf_DATA) @$(NORMAL_INSTALL) @list='$(sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sysconfdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sysconfdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(sysconfdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(sysconfdir)" || exit $$?; \ done uninstall-sysconfDATA: @$(NORMAL_UNINSTALL) @list='$(sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sysconfdir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(appdatadir)" "$(DESTDIR)$(sysconfdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dist_appdataDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-sysconfDATA install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-dist_appdataDATA uninstall-sysconfDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-dist_appdataDATA install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ install-sysconfDATA installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am uninstall-dist_appdataDATA \ uninstall-sysconfDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xmedcon-0.14.1/missing0000755000175000017510000001533112637622446011572 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2012-06-26.16; # UTC # Copyright (C) 1996-2013 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'automa4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: xmedcon-0.14.1/Makefile.in0000644000175000017510000007157112637622762012251 00000000000000# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \ $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) mkinstalldirs \ $(srcdir)/xmedcon-config.in COPYING COPYING.LIB config.guess \ config.sub depcomp install-sh missing ltmain.sh ltconfig ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/libtool.m4 \ $(top_srcdir)/macros/ltoptions.m4 \ $(top_srcdir)/macros/ltsugar.m4 \ $(top_srcdir)/macros/ltversion.m4 \ $(top_srcdir)/macros/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/source/m-depend.h CONFIG_CLEAN_FILES = xmedcon-config CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(bindir)" SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 $(distdir).zip GZIP_ENV = --best DIST_TARGETS = dist-bzip2 dist-gzip dist-zip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DECOMPRESS = @DECOMPRESS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENABLE_ACR = @ENABLE_ACR@ ENABLE_ANLZ = @ENABLE_ANLZ@ ENABLE_CONC = @ENABLE_CONC@ ENABLE_DICM = @ENABLE_DICM@ ENABLE_ECAT = @ENABLE_ECAT@ ENABLE_GIF = @ENABLE_GIF@ ENABLE_INTF = @ENABLE_INTF@ ENABLE_INW = @ENABLE_INW@ ENABLE_NIFTI = @ENABLE_NIFTI@ ENABLE_PNG = @ENABLE_PNG@ ENABLE_TPC = @ENABLE_TPC@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GLIBMDCETC = @GLIBMDCETC@ GLIBSUPPORTED = @GLIBSUPPORTED@ GREP = @GREP@ GTKONE = @GTKONE@ GTKSUPPORTED = @GTKSUPPORTED@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NIFTI_CFLAGS = @NIFTI_CFLAGS@ NIFTI_LDFLAGS = @NIFTI_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PNG_CFLAGS = @PNG_CFLAGS@ PNG_LDFLAGS = @PNG_LDFLAGS@ PNG_LIBS = @PNG_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TPC_CFLAGS = @TPC_CFLAGS@ TPC_LDFLAGS = @TPC_LDFLAGS@ VERSION = @VERSION@ XMDCETC = @XMDCETC@ XMEDCON_DATE = @XMEDCON_DATE@ XMEDCON_GLIB_CFLAGS = @XMEDCON_GLIB_CFLAGS@ XMEDCON_GLIB_LIBS = @XMEDCON_GLIB_LIBS@ XMEDCON_GTK_CFLAGS = @XMEDCON_GTK_CFLAGS@ XMEDCON_GTK_LIBS = @XMEDCON_GTK_LIBS@ XMEDCON_LIBVERS = @XMEDCON_LIBVERS@ XMEDCON_MAJOR = @XMEDCON_MAJOR@ XMEDCON_MICRO = @XMEDCON_MICRO@ XMEDCON_MINOR = @XMEDCON_MINOR@ XMEDCON_PRGR = @XMEDCON_PRGR@ XMEDCON_VERSION = @XMEDCON_VERSION@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_LDFLAGS = @ZLIB_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_cv_sizeof_int = @ac_cv_sizeof_int@ ac_cv_sizeof_long = @ac_cv_sizeof_long@ ac_cv_sizeof_long_long = @ac_cv_sizeof_long_long@ ac_cv_sizeof_short = @ac_cv_sizeof_short@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mdc_cv_bigendian = @mdc_cv_bigendian@ mdc_cv_enable_lnglng = @mdc_cv_enable_lnglng@ mdc_cv_glibsupport = @mdc_cv_glibsupport@ mdc_cv_gui = @mdc_cv_gui@ mdc_cv_include_acr = @mdc_cv_include_acr@ mdc_cv_include_anlz = @mdc_cv_include_anlz@ mdc_cv_include_conc = @mdc_cv_include_conc@ mdc_cv_include_dicm = @mdc_cv_include_dicm@ mdc_cv_include_ecat = @mdc_cv_include_ecat@ mdc_cv_include_gif = @mdc_cv_include_gif@ mdc_cv_include_intf = @mdc_cv_include_intf@ mdc_cv_include_inw = @mdc_cv_include_inw@ mdc_cv_include_nifti = @mdc_cv_include_nifti@ mdc_cv_include_png = @mdc_cv_include_png@ mdc_cv_include_tpc = @mdc_cv_include_tpc@ mdc_cv_ljpg = @mdc_cv_ljpg@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = gnu dist-bzip2 dist-zip ACLOCAL_AMFLAGS = -I macros SUBDIRS = libs source etc man macros bin_SCRIPTS = xmedcon-config EXTRA_DIST = \ README \ REMARKS all: all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): xmedcon-config: $(top_builddir)/config.status $(srcdir)/xmedcon-config.in cd $(top_builddir) && $(SHELL) ./config.status $@ install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(SCRIPTS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binSCRIPTS install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binSCRIPTS .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool cscope cscopelist-am ctags ctags-am dist \ dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ dist-xz dist-zip distcheck distclean distclean-generic \ distclean-libtool distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-binSCRIPTS install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-binSCRIPTS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: xmedcon-0.14.1/COPYING0000644000175000017510000004312707176601663011232 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. xmedcon-0.14.1/aclocal.m40000644000175000017510000014013412637622762012034 00000000000000# generated automatically by aclocal 1.13.4 -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- dnl serial 11 (pkg-config-0.29) dnl dnl Copyright © 2004 Scott James Remnant . dnl Copyright © 2012-2015 Dan Nicholson dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA dnl 02111-1307, USA. dnl dnl As a special exception to the GNU General Public License, if you dnl distribute this file as part of a program that contains a dnl configuration script generated by Autoconf, you may include it under dnl the same distribution terms that you use for the rest of that dnl program. dnl PKG_PREREQ(MIN-VERSION) dnl ----------------------- dnl Since: 0.29 dnl dnl Verify that the version of the pkg-config macros are at least dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's dnl installed version of pkg-config, this checks the developer's version dnl of pkg.m4 when generating configure. dnl dnl To ensure that this macro is defined, also add: dnl m4_ifndef([PKG_PREREQ], dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], [m4_define([PKG_MACROS_VERSION], [0.29]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) dnl ---------------------------------- dnl Since: 0.16 dnl dnl Search for the pkg-config tool and set the PKG_CONFIG variable to dnl first found in the path. Checks that the version of pkg-config found dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is dnl used since that's the first version where most current features of dnl pkg-config existed. AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])dnl PKG_PROG_PKG_CONFIG dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------------------------------- dnl Since: 0.18 dnl dnl Check to see whether a particular set of modules exists. Similar to dnl PKG_CHECK_MODULES(), but does not set variables or print errors. dnl dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) dnl only at the first occurence in configure.ac, so if the first place dnl it's called might be skipped (such as if it is within an "if", you dnl have to call PKG_CHECK_EXISTS manually AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) dnl --------------------------------------------- dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting dnl pkg_failed based on the result. m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])dnl _PKG_CONFIG dnl _PKG_SHORT_ERRORS_SUPPORTED dnl --------------------------- dnl Internal check to see if pkg-config supports short errors. AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])dnl _PKG_SHORT_ERRORS_SUPPORTED dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl -------------------------------------------------------------- dnl Since: 0.4.0 dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES might not happen, you should be sure to include an dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])dnl PKG_CHECK_MODULES dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl --------------------------------------------------------------------- dnl Since: 0.29 dnl dnl Checks for existence of MODULES and gathers its build flags with dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags dnl and VARIABLE-PREFIX_LIBS from --libs. dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to dnl include an explicit call to PKG_PROG_PKG_CONFIG in your dnl configure.ac. AC_DEFUN([PKG_CHECK_MODULES_STATIC], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl _save_PKG_CONFIG=$PKG_CONFIG PKG_CONFIG="$PKG_CONFIG --static" PKG_CHECK_MODULES($@) PKG_CONFIG=$_save_PKG_CONFIG[]dnl ])dnl PKG_CHECK_MODULES_STATIC dnl PKG_INSTALLDIR([DIRECTORY]) dnl ------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable pkgconfigdir as the location where a module dnl should install pkg-config .pc files. By default the directory is dnl $libdir/pkgconfig, but the default can be changed by passing dnl DIRECTORY. The user can override through the --with-pkgconfigdir dnl parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, [with_pkgconfigdir=]pkg_default) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_INSTALLDIR dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) dnl -------------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable noarch_pkgconfigdir as the location where a dnl module should install arch-independent pkg-config .pc files. By dnl default the directory is $datadir/pkgconfig, but the default can be dnl changed by passing DIRECTORY. The user can override through the dnl --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([noarch-pkgconfigdir], [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, [with_noarch_pkgconfigdir=]pkg_default) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_NOARCH_INSTALLDIR dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------- dnl Since: 0.28 dnl dnl Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl _PKG_CONFIG([$1], [variable="][$3]["], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR # Copyright (C) 2002-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.13' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.13.4], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.13.4])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # -*- Autoconf -*- # Obsolete and "removed" macros, that must however still report explicit # error messages when used, to smooth transition. # # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. AC_DEFUN([AM_CONFIG_HEADER], [AC_DIAGNOSE([obsolete], ['$0': this macro is obsolete. You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl AC_CONFIG_HEADERS($@)]) AC_DEFUN([AM_PROG_CC_STDC], [AC_PROG_CC am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc AC_DIAGNOSE([obsolete], ['$0': this macro is obsolete. You should simply use the 'AC][_PROG_CC' macro instead. Also, your code should no longer depend upon 'am_cv_prog_cc_stdc', but upon 'ac_cv_prog_cc_stdc'.])]) AC_DEFUN([AM_C_PROTOTYPES], [AC_FATAL([automatic de-ANSI-fication support has been removed])]) AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([macros/libtool.m4]) m4_include([macros/ltoptions.m4]) m4_include([macros/ltsugar.m4]) m4_include([macros/ltversion.m4]) m4_include([macros/lt~obsolete.m4]) m4_include([acinclude.m4])