[med-svn] [Git][med-team/xmedcon][upstream] New upstream version 0.25.1-gtk3+dfsg

Étienne Mollier (@emollier) gitlab at salsa.debian.org
Sat Mar 22 18:27:54 GMT 2025



Étienne Mollier pushed to branch upstream at Debian Med / xmedcon


Commits:
7d412657 by Étienne Mollier at 2025-03-22T18:57:52+01:00
New upstream version 0.25.1-gtk3+dfsg
- - - - -


26 changed files:

- configure.ac
- etc/xmedcon.spec
- libs/dicom/basic.c
- libs/dicom/bit.c
- libs/dicom/decomp.c
- libs/dicom/dicom.h
- libs/dicom/image.c
- libs/dicom/log.c
- libs/dicom/parse.c
- libs/dicom/process.c
- libs/dicom/single.c
- libs/dicom/transform.c
- libs/dicom/zoom.c
- man/m-acr.4
- man/m-anlz.4
- man/m-ecat.4
- man/m-gif.4
- man/m-intf.4
- man/m-inw.4
- man/medcon.1
- man/medcon.3
- man/xmedcon.1
- source/m-defs.h
- source/m-files.c
- source/m-files.h
- source/xcolgbc.c


Changes:

=====================================
configure.ac
=====================================
@@ -29,7 +29,7 @@
 
 dnl Autoconf prerequisite and initialization
 AC_PREREQ([2.72])
-AC_INIT([XMedCon],[0.25.0],[enlf-at-users.sf.net],[xmedcon],[http://xmedcon.sf.net/])
+AC_INIT([XMedCon],[0.25.1],[enlf-at-users.sf.net],[xmedcon],[http://xmedcon.sf.net/])
 AC_CONFIG_SRCDIR([source/medcon.c])
 
 AC_CONFIG_HEADERS([config.h])
@@ -37,9 +37,9 @@ AX_PREFIX_CONFIG_H([source/m-depend.h],[LIBMDC],[config.h])
 
 XMEDCON_MAJOR="0"
 XMEDCON_MINOR="25"
-XMEDCON_PATCH="0"
+XMEDCON_PATCH="1"
 XMEDCON_PRGR="(X)MedCon"
-XMEDCON_DATE="03-jan-2025"
+XMEDCON_DATE="17-mar-2025"
 XMEDCON_VERSION="${XMEDCON_MAJOR}.${XMEDCON_MINOR}.${XMEDCON_PATCH}"
 XMEDCON_LIBVERS="${XMEDCON_PRGR} ${XMEDCON_VERSION} by Erik Nolf"
 


=====================================
etc/xmedcon.spec
=====================================
@@ -11,7 +11,7 @@
 #
 #
 Name: xmedcon
-Version: 0.25.0
+Version: 0.25.1
 Release: 1
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-root


=====================================
libs/dicom/basic.c
=====================================
@@ -18,22 +18,22 @@ char dicom_version[]="libdicom 0.33", **dicom_transfer_syntax=0L, dicom_transfer
 
 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);
+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 off_t	position;
-static int	meta;
+static void mdc_dicom_endian(void);
+
+static ELEMENT element;
+static FILE *stream=0L;
+static off_t position;
+static int meta;
 static enum
 {
   LITTLE=1,
@@ -68,13 +68,13 @@ void dicom_init(FILE *fp)
 
 int dicom_open(const char *file)
 {
-  U16	magic=0x1234;
+  U16 magic=0x1234;
   char  vr[2];
-  size_t	r;
+  size_t r;
 #if MEDCON_INTEGRATED
   char  buffer[512];
 #else
-  char	*dot,*tmp,buffer[512];
+  char *dot,*tmp,buffer[512];
 #endif 
 
   dicom_log(DEBUG,"dicom_open()");
@@ -203,10 +203,10 @@ int dicom_open(const char *file)
 
 ELEMENT *dicom_element(void)
 {
-  off_t	rewind;
-  U16	tmp;
-  char	vr[2];
-  size_t	r;
+  off_t rewind;
+  U16 tmp;
+  char vr[2];
+  size_t r;
 
   dicom_log(DEBUG,"dicom_element()");
 
@@ -516,7 +516,7 @@ void mdc_dicom_switch_syntax_endian(void)
    routine and get the header info we need */
 int mdc_dicom_load(VR vr)
 {
-  size_t	r;
+  size_t r;
   dicom_log(DEBUG,"dicom_load()");
 
   if (!stream)
@@ -575,8 +575,8 @@ int mdc_dicom_load(VR vr)
 
 void dicom_clean(void)
 {
-  U32	i;
-  char	*c;
+  U32 i;
+  char *c;
 
   dicom_log(DEBUG,"dicom_clean()");
 
@@ -821,8 +821,8 @@ static void dicom_encapsulated(int reset)
 
 static void dicom_sequence(int reset)
 {
-  static U32	length[0x100];
-  static U8	sequence;
+  static U32 length[0x100];
+  static U8 sequence;
   static TAG    sqtag[0x100];
 
   dicom_log(DEBUG,"dicom_sequence()");
@@ -898,8 +898,8 @@ static void dicom_sequence(int reset)
 
 static void dicom_endian(void)
 {
-  U32	i;
-  U8	*s;
+  U32 i;
+  U8 *s;
 
   dicom_log(DEBUG,"dicom_endian()");
 
@@ -913,7 +913,7 @@ static void dicom_endian(void)
   case SS :
   case US :
     s=element.value.UN;
-    for (i=element.length>>1; i; i--,s+=2)
+    for (i=element.length>>1; i>0; i--,s+=2)
       dicom_swap(s,2);
     return;
 
@@ -921,13 +921,13 @@ static void dicom_endian(void)
   case UL :
   case FL :
     s=element.value.UN;
-    for (i=element.length>>2; i; i--,s+=4)
+    for (i=element.length>>2; i>0; i--,s+=4)
       dicom_swap(s,4);
     return;
 
   case FD :
     s=element.value.UN;
-    for (i=element.length>>3; i; i--,s+=8)
+    for (i=element.length>>3; i>0; i--,s+=8)
       dicom_swap(s,8);
     return;
 
@@ -942,8 +942,8 @@ static void dicom_endian(void)
 
 static int dicom_vm(void)
 {
-  U32	i;
-  char	*c,**table,*s,*d;
+  U32 i;
+  char *c,**table,*s,*d;
 
   dicom_log(DEBUG,"dicom_vm()");
 
@@ -1000,7 +1000,7 @@ static int dicom_vm(void)
     case UI :
       element.vm=1;
       c=element.value.UN;
-      for (i=element.length; i; i--,c++)
+      for (i=element.length; i>0; i--,c++)
         if (*c=='\\')
           element.vm++;
 
@@ -1008,22 +1008,22 @@ static int dicom_vm(void)
       +element.length+1);
       if (!element.value.UN)
       {
-	dicom_log(ERROR,"Out of memory");
-	dicom_close();
-	return -1;
+        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--)
+      for (i=element.length; i>0; i--)
         *--d=*--s;
 
       table=element.value.AE;
       *table++=c;
 
-      for (i=element.length; i; i--,c++)
+      for (i=element.length; i>0; i--,c++)
         if (*c=='\\')
         {
           *c=0;
@@ -1055,7 +1055,7 @@ void dicom_swap(void *v,int n)
   b=v;
   e=b+n-1;
 
-  for (i=n>>1; i; i--)
+  for (i=n>>1; i>0; i--)
   {
     tmp=*b;
     *b++=*e;
@@ -1096,7 +1096,7 @@ 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))
+        if (mdc_dicom_decomp_rle(stream, s, e))
           return(-1);
         break;
     case COMPRESSED_LOSSLESS:
@@ -1105,8 +1105,7 @@ int mdc_dicom_decompress(SINGLE *s, ELEMENT *e)
           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))
+        if (mdc_dicom_decomp_ljpg(stream, s, e))
           return(-3);
         break;
     case UNCOMPRESSED_EXPLICIT_LITTLE:


=====================================
libs/dicom/bit.c
=====================================
@@ -9,15 +9,15 @@
 
 union
 {
-  U32	*u32;
-  U16	*u16;
-  U8	*u8;
+  U32 *u32;
+  U16 *u16;
+  U8 *u8;
 }
 source;
 
-U32	cache32;
-U16	cache16;
-U8	cache8;
+U32 cache32;
+U16 cache16;
+U8  cache8;
 
 int left;
 
@@ -291,4 +291,4 @@ U16 mdc_dicom_12_unpack(int pix)
 
   return result;
 }
-/* eNlf: END   - support for 12 bits unpacking */
+/* eNlf: END   - support for 12bits unpacking */


=====================================
libs/dicom/decomp.c
=====================================
@@ -32,46 +32,64 @@
  * RLE *
  *******/
 
-static void mdc_dicom_decodeRLE_segment(U16 *, U8 *, U32, U32 , U32);
+S16 mdc_dicom_decodeRLE_segment(U16 *, U8 *, U32, 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)
+S16 mdc_dicom_decomp_rle(FILE *fp, SINGLE *s, ELEMENT *e)
 {
-  U32 	numberSegments, i;
-  U8	*rle;
-  long	offset[MDC_MAX_RLE_SEGMENTS + 1], rlelen, skip;
-  int	r;
+  U16 *image16 = (U16 *)e->value.OB;
+  U32 length = e->length;
+  U32 bytes = s->w*s->h*s->samples*s->alloc>>3;
+
+  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                                      */
-   
+
+  if (fp == NULL || s == NULL || e == NULL) {
+    dicom_log(ERROR,"RLE - Invalid NULL argument");
+    return(-1);
+  }
+
+  image16 = (U16 *)e->value.OB;
+  length  = e->length;
+  bytes   = s->w*s->h*s->samples*s->alloc>>3;
+
+  if (image16 == NULL || length == 0 || bytes == 0) {
+    dicom_log(ERROR,"RLE - Invalid parameter");
+    return(-2);
+  }
+
   /* 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;
+    return(-3);
   }
   dicom_swap(&numberSegments,4);
-  if (numberSegments > MDC_MAX_RLE_SEGMENTS) 
+  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 */
+    dicom_log(ERROR,"RLE - Maximum of 32 bits images supported");
+    return(-4); /* 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;
+       return(-5);
      }
      dicom_swap(&offset[i],4);
   }
@@ -81,7 +99,7 @@ S16 mdc_dicom_decomp_rle(FILE *fp, U16 *image16, U32 length)
   if (dicom_check(-1))
   {
     dicom_log(ERROR,"RLE - Failure header skip");
-    return -1;
+    return(-6);
   }
 
   offset[numberSegments] = length; /* needed for offset last segment */
@@ -91,41 +109,50 @@ S16 mdc_dicom_decomp_rle(FILE *fp, U16 *image16, U32 length)
   {
     /* read rle image */
     rlelen = offset[i+1] - offset[i];
-    rle	   = (U8*)malloc((U32)(rlelen + 10L));
+    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_check(-1);
         dicom_log(ERROR,"RLE - Failure image read");
-        return -2;
+        return(-7);
       }
-      mdc_dicom_decodeRLE_segment(image16,rle
-                                         ,(unsigned)rlelen,numberSegments,i);
+
+      /* decode segment */
+      r = mdc_dicom_decodeRLE_segment(image16, rle, bytes, (unsigned)rlelen, numberSegments, i);
+
       /* delete buffer */
       free(rle);
+
+      /* check result */
+      if (r != 0) {
+        dicom_check(-1);
+        dicom_log(ERROR,"RLE - Failure to decompress");
+        return(-8);
+      }
     }
     else
     {
       dicom_log(ERROR,"RLE - Out of memory");
-      return -3;
+      return(-9);
     }
   }
- 
-  return 0;
-    
+
+  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				
+ *  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)
+S16 mdc_dicom_decodeRLE_segment(U16 *image, U8 *rle, U32 bytes, U32 length, U32 segtot, U32 segnb)
 {
   U32  j, indj;
   U8   *pix, val;
@@ -141,17 +168,32 @@ void mdc_dicom_decodeRLE_segment(U16 *image, U8 *rle, U32 length,U32 segtot, U32
   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 (indj > bytes) break; /* zero padding case */
+
+      /* handle */
       if (j < length - 1)
         pix [indj] = rle [j++];
       indj += segtot;
     }
     else if ((code > 0) && (code <= 127))
     {
+      /* check read overflow: incomplete stream, encoder bug */
+      if ((j + code) > length) {
+        dicom_log(ERROR,"RLE - segment: underflow for code < 128");
+        return(-1);
+      }
+      /* check write overflow: encoder bug */
+      if ((indj + (code*segtot)) > bytes) {
+        dicom_log(ERROR,"RLE - segment: overflow for code < 128");
+        return(-2);
+      }
+      /* handle */
       for (ii = 0; ii < (code + 1); ii++)
       {
          if (j == length) break;
@@ -162,6 +204,17 @@ void mdc_dicom_decodeRLE_segment(U16 *image, U8 *rle, U32 length,U32 segtot, U32
     /* repetition of the same byte */
     else if ((code <= 255) && (code > 128))
     {
+      /* check read overflow: incomplete stream, encoder bug */
+      if ((j + 1) > length) {
+        dicom_log(ERROR,"RLE - segment: underflow for code > 128");
+        return(-3);
+      }
+      /* check write overflow: encoder bug */
+      if ((indj + (256 - code)*segtot) > bytes) {
+        dicom_log(ERROR,"RLE - segment: overflow for code > 128");
+        return(-4);
+      }
+      /* handle */
       val = rle [j++];
       iimax = 256-code;
       for (ii = 0; ii <= iimax; ii++)
@@ -170,19 +223,48 @@ void mdc_dicom_decodeRLE_segment(U16 *image, U8 *rle, U32 length,U32 segtot, U32
         indj += segtot;
       }
     }
+    else if (code == 128)
+    {
+      /* illegal value as per the DICOM standard */
+      dicom_log(ERROR,"RLE - segment: illegal code = 128");
+      return(-5);
+    }
   } /* for */
+
+  return(0);
 }
 
 /*****************
  * LossLess JPEG *
  *****************/
 
-S16 mdc_dicom_decomp_ljpg(FILE *fp, U16 *image16, U32 length, U32 depth)
+S16 mdc_dicom_decomp_ljpg(FILE *fp, SINGLE *s, ELEMENT *e)
 {
 #if MDC_SUPPORT_LJPG
-  return(JPEGLosslessDecodeImage(fp,image16,(signed)depth,(signed)length));
+
+  U16 *image16;
+  signed int length, depth;
+
+  if (fp == NULL || s == NULL || e == NULL) {
+    dicom_log(ERROR,"LJPG - Invalid NULL argument");
+    return(-1);
+  }
+
+  image16 = (U16 *)e->value.OB;
+  length  = (signed int)e->length;
+  depth   = (signed int)s->alloc*s->samples;
+
+  if (image16 == NULL || length <= 0 || depth <= 0) {
+    dicom_log(ERROR,"LJPG - Invalid parameter");
+    return(-2);
+  }
+
+  return(JPEGLosslessDecodeImage(fp,image16,depth,length));
+
 #else
-  return(-1);
+
+  return(-3);
+
 #endif
 }
 


=====================================
libs/dicom/dicom.h
=====================================
@@ -85,7 +85,8 @@ int	dicom_log_close(void);
 
 typedef struct
 {
-  U16 size,bit;
+  U32 size;
+  U16 bit;
 
   union
   {
@@ -318,7 +319,7 @@ 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_color(IMAGE *image, U8 *palette, U8 dither, char *(*reduce)(U8*,U8*,U16,U16,U8*,U8));
 
 void	dicom_hsv(U16,U16,U16,U8 *);
 IMAGE	*dicom_merge(const IMAGE *,const IMAGE *,U16);
@@ -327,8 +328,8 @@ 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);
+S16 mdc_dicom_decomp_rle(FILE *, SINGLE *, ELEMENT *);
+S16 mdc_dicom_decomp_ljpg(FILE *, SINGLE *, ELEMENT *);
 S16 mdc_dicom_decomp_uncomp_little(FILE *, SINGLE *, ELEMENT *);
 
 #define __LIBDICOM__


=====================================
libs/dicom/image.c
=====================================
@@ -64,8 +64,8 @@ IMAGE *dicom_new(int rgb,U16 frames,U16 w,U16 h)
 
 int dicom_read(const char *file,IMAGE **image,U32 *images,int parametric)
 {
-  SINGLE	*single;
-  IMAGE		*new,*tmp;
+  SINGLE *single;
+  IMAGE  *new,*tmp;
 
   dicom_log(DEBUG,"dicom_read()");
 
@@ -179,9 +179,9 @@ int dicom_write_ascii(const char *file,const IMAGE *image,int width)
   static char gray[]=
     "$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\\|()1{}[]?-_+~<>i!lI;:,\"^`'. ";
 
-  FILE	*stream;
-  IMAGE	*zoom;
-  U16	frame,x,y,*pixel;
+  FILE *stream;
+  IMAGE *zoom;
+  U16 frame,x,y,*pixel;
 
   dicom_log(DEBUG,"dicom_write_ascii()");
 
@@ -212,12 +212,12 @@ int dicom_write_ascii(const char *file,const IMAGE *image,int width)
 
   pixel=zoom->data.gray;
 
-  for (frame=zoom->frames; frame; frame--)
+  for (frame=zoom->frames; frame>0; frame--)
   {
-    for (y=zoom->h; y; y--)
+    for (y=zoom->h; y>0; y--)
     {
-      for (x=zoom->w; x; x--,pixel++)
-	putc(gray[(int) 69**pixel/0xFFFF],stream);
+      for (x=zoom->w; x>0; x--,pixel++)
+         putc(gray[(int) 69**pixel/0xFFFF],stream);
       puts("");
     }
     puts("");
@@ -235,11 +235,11 @@ int dicom_write_ascii(const char *file,const IMAGE *image,int width)
 /*
 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;
+  struct jpeg_compress_struct cinfo;
+  struct jpeg_error_mgr jerr;
+  JSAMPROW line,target;
+  FILE *stream;
+  U16 *source,l;
 
   dicom_log(DEBUG,"dicom_write_jpeg()");
 
@@ -303,7 +303,7 @@ int dicom_write_jpeg(const char *file,const IMAGE *image,int quality)
       source=image->data.gray+cinfo.next_scanline*image->w;
       target=line;
 
-      for (l=image->w; l; l--)
+      for (l=image->w; l>0; l--)
         *target++=*source++>>8;
     }
 


=====================================
libs/dicom/log.c
=====================================
@@ -17,8 +17,8 @@ CONDITION dicom_log_level=NOTICE;
 /* 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;
+static FILE *stream=NULL;
+static char *program=NULL;
 
 /************
  * log name *
@@ -64,8 +64,8 @@ int dicom_log_open(const char *file)
 
 void dicom_log(CONDITION condition,const char *message)
 {
-  time_t	t;
-  char		tmp[32];
+  time_t t;
+  char tmp[32];
 
   static char *explination[]=
   {


=====================================
libs/dicom/parse.c
=====================================
@@ -9,20 +9,20 @@
 #include <stdlib.h>
 #include "dicom.h"
 
-static DICTIONARY	*parse_input(char *);
-static void		parse_output(const DICTIONARY *);
-static void             parse_warn(const char *msg);
+static DICTIONARY *parse_input(char *);
+static void parse_output(const DICTIONARY *);
+static void parse_warn(const char *msg);
 
 /********
  * main *
  ********/
 
-#define	LINE 8192
+#define LINE 8192
 
 int main(int argc,char *argv[])
 {
-  DICTIONARY	*dict;
-  char		line[LINE], *s;
+  DICTIONARY *dict;
+  char line[LINE], *s;
 
   for (;;)
   {


=====================================
libs/dicom/process.c
=====================================
@@ -14,8 +14,8 @@
 
 void dicom_max(IMAGE *image)
 {
-  S64	length,l;
-  U16	min,max,*pixel;
+  S64 length,l;
+  U16 min,max,*pixel;
 
   dicom_log(DEBUG,"dicom_max()");
 
@@ -37,7 +37,7 @@ void dicom_max(IMAGE *image)
   min=*pixel;
   max=min;
 
-  for (l=length; l; l--,pixel++)
+  for (l=length; l>0; l--,pixel++)
   {
     if (*pixel<min)
     {
@@ -57,7 +57,7 @@ void dicom_max(IMAGE *image)
 
   pixel=image->data.gray;
 
-  for (l=length; l; l--, pixel++)
+  for (l=length; l>0; l--, pixel++)
     *pixel=0xFFFFUL*(*pixel-min)/(max-min);
 }
 
@@ -67,8 +67,8 @@ void dicom_max(IMAGE *image)
 
 void dicom_invert(IMAGE *image)
 {
-  S64	l;
-  U16	*pixel;
+  S64 l;
+  U16 *pixel;
 
   dicom_log(DEBUG,"dicom_invert()");
 
@@ -86,7 +86,7 @@ void dicom_invert(IMAGE *image)
 
   pixel=image->data.gray;
 
-  for (l=(S64)image->frames*image->w*image->h; l; l--, pixel++)
+  for (l=(S64)image->frames*image->w*image->h; l>0; l--, pixel++)
     *pixel=0xFFFFU-*pixel;
 }
 
@@ -96,8 +96,8 @@ void dicom_invert(IMAGE *image)
 
 void dicom_voi(IMAGE *image,U16 min,U16 max)
 {
-  S64	l;
-  U16	*pixel;
+  S64 l;
+  U16 *pixel;
 
   dicom_log(DEBUG,"dicom_voi()");
 
@@ -119,7 +119,7 @@ void dicom_voi(IMAGE *image,U16 min,U16 max)
 
   pixel=image->data.gray;
 
-  for (l=(S64)image->frames*image->w*image->h; l; l--,pixel++)
+  for (l=(S64)image->frames*image->w*image->h; l>0; l--,pixel++)
   {
     if (*pixel<=min)
     {
@@ -144,8 +144,8 @@ void dicom_voi(IMAGE *image,U16 min,U16 max)
 void dicom_gray(IMAGE *image)
 {
   S64 length,l;
-  U16	*target;
-  U8	*source;
+  U16 *target;
+  U8 *source;
 
   dicom_log(DEBUG,"dicom_gray()");
 
@@ -163,7 +163,7 @@ void dicom_gray(IMAGE *image)
   source=image->data.rgb;
   target=image->data.gray;
 
-  for (l=length; l; l--,source+=3)
+  for (l=length; l>0; l--,source+=3)
     *target++=77UL*source[0]+151UL*source[1]+29UL*source[2];
 
   image->rgb=0;
@@ -183,7 +183,7 @@ void dicom_gray(IMAGE *image)
  *  color  *
  ***********/
 
-void dicom_color(IMAGE *image, U8 *palette, U8 dither, char *(*reduce)())
+void dicom_color(IMAGE *image, U8 *palette, U8 dither, char *(*reduce)(U8*,U8*,U16,U16,U8*,U8))
 {
   S64   l, size, length;
   U16   *target16;
@@ -242,9 +242,9 @@ void dicom_color(IMAGE *image, U8 *palette, U8 dither, char *(*reduce)())
 
 void dicom_hsv(U16 h,U16 s,U16 v,U8 *rgb)
 {
-  float	hue,saturation,f;
-  int	i;
-  U8	value,m,n;
+  float hue,saturation,f;
+  int i;
+  U8 value,m,n;
 
   hue=h*6.0/65536.0;
   saturation=s/65535.0;
@@ -304,9 +304,9 @@ void dicom_hsv(U16 h,U16 s,U16 v,U8 *rgb)
 
 IMAGE *dicom_merge(const IMAGE *anatomic,const IMAGE *parametric,U16 saturation)
 {
-  IMAGE	*zoom,*merge;
-  U16	bar,*value,*hue,frame,x,y;
-  U8	*target;
+  IMAGE *zoom,*merge;
+  U16 bar,*value,*hue,frame,x,y;
+  U8 *target;
 
   dicom_log(DEBUG,"dicom_merge()");
 
@@ -345,25 +345,25 @@ IMAGE *dicom_merge(const IMAGE *anatomic,const IMAGE *parametric,U16 saturation)
   hue=zoom->data.gray;
   target=merge->data.rgb;
 
-  for (frame=anatomic->frames; frame; frame--)
+  for (frame=anatomic->frames; frame>0; frame--)
     for (y=0; y<anatomic->h; y++)
     {
-      for (x=anatomic->w; x; x--)
+      for (x=anatomic->w; x>0; x--)
       {
-	dicom_hsv(2UL*(0xFFFFU-*hue)/3U,*hue?saturation:0,*value,target);
+         dicom_hsv(2UL*(0xFFFFU-*hue)/3U,*hue?saturation:0,*value,target);
 
-	value++;
-	hue++;
-	target+=3;
+         value++;
+         hue++;
+         target+=3;
       }
 
-      for (x=3*bar; x; x--)
-	*target++=0;
+      for (x=3*bar; x>0; x--)
+         *target++=0;
 
-      for (x=bar; x; x--)
+      for (x=bar; x>0; x--)
       {
-	dicom_hsv(0xAAAAUL*y/(anatomic->h-1),saturation,0xFFFFU,target);
-	target+=3;
+         dicom_hsv(0xAAAAUL*y/(anatomic->h-1),saturation,0xFFFFU,target);
+         target+=3;
       }
     }
 


=====================================
libs/dicom/single.c
=====================================
@@ -21,10 +21,12 @@ static SINGLE single;
 
 SINGLE *dicom_single(void)
 {
-  ELEMENT	*e;
-  S64		length, bytes;
-  U32		i, f;
-  char		*interpretation[]=
+  ELEMENT *e;
+  CLUT *clut;
+  S64 length, bytes;
+  U32 i, f;
+  size_t size;
+  char *interpretation[]=
   {
     "MONOCHROME2",
     "MONOCHROME1",
@@ -70,7 +72,7 @@ SINGLE *dicom_single(void)
           break;
 
         if ((e->value.CS == NULL) || (*e->value.CS[0] == '\0')) {
-          dicom_log(WARNING,"NULL of empty Photometric Interpretation");
+          dicom_log(WARNING,"Empty Photometric Interpretation");
           break;
         }
 
@@ -171,15 +173,18 @@ SINGLE *dicom_single(void)
         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];
-	}
+        if (e->vm!=3)
+          dicom_log(WARNING,"Wrong VM for PaletteColorLookupTableDescriptor");
+        else
+        {
+          clut = (CLUT *)&single.clut[e->element-0x1101];
+  
+          clut->size = (U32)e->value.US[0];
+          clut->threshold.u16 = e->value.US[1];
+          clut->bit= e->value.US[2];
+  
+          if (clut->size == 0) clut->size = 1<<16; /* 2^16 or 65356 */
+        }
 
         eNlfSafeFree(e->value.US);
         continue;
@@ -187,9 +192,40 @@ SINGLE *dicom_single(void)
 
       if (0x1201<=e->element && e->element<=0x1203)
       {
-        if (dicom_load(US))
-          break;
-	single.clut[e->element-0x1201].data.u16=e->value.US;
+        clut = (CLUT *)&single.clut[e->element-0x1201];
+
+        /* eNlf: BEGIN - read lookup tables of a single byte */
+        if (clut->size == e->length) {
+          /* one byte case */
+          U16 *wordclut;
+
+          if (dicom_load(OB))
+            break;
+
+          wordclut = (U16 *)malloc(clut->size*2L);
+          if (!wordclut) {
+            dicom_log(ERROR,"Out of memory");
+            break; 
+          }
+
+          /* transform into a two byte word */
+          for (i=0; i<clut->size; i++) {
+             wordclut[i] = (U16)e->value.OB[i];
+          }
+          clut->data.u16 = wordclut;
+
+          eNlfSafeFree(e->value.OB);
+
+        /* eNlf: END   - read lookup tables of a single byte */
+        }else{
+
+          /* should be two byte case */
+          if (dicom_load(OW))
+             break;
+
+          clut->data.u16=e->value.OW;
+
+        }
         continue;
       }
     }
@@ -206,7 +242,7 @@ SINGLE *dicom_single(void)
         pixel = (U32)single.samples*single.alloc>>3;
 
         if (e->length!=0xFFFFFFFF)
-	{ /* pixel data, not encapsulated */
+        { /* pixel data, not encapsulated */
 
           /* first fix bad VR values, confusing data endian swap */
           switch (e->vr)
@@ -236,18 +272,18 @@ SINGLE *dicom_single(void)
               break;
           }
 
-	  length=dicom_pixel(e);
-	  if (length<0)
-	    break;
+          length=dicom_pixel(e);
+          if (length<0)
+            break;
 
-    if (length != (S64)frames * width * height * pixel) {
-      dicom_log(WARNING,"Incorrect PixelData length");
-      dicom_single_free();
-      return 0L;
-    }
+          if (length != (S64)frames * width * height * pixel) {
+            dicom_log(WARNING,"Incorrect PixelData length");
+            dicom_single_free();
+            return 0L;
+          }
 
-    return &single;
-	}
+          return &single;
+        }
         else if (e->length == 0xFFFFFFFF)
         { /* encapsulated data */
           U8 *data;
@@ -276,6 +312,15 @@ SINGLE *dicom_single(void)
           /* eNlf: routines like source.u++ go beyond the boundaries  */
           /* eNlf: - memset the allocated buffer for sure             */
           bytes = (S64)width*height*pixel*frames + 4L;
+
+          /* check for overflow */
+          size = (size_t)bytes;
+          if ((S64)size != bytes) {
+            dicom_log(ERROR,"System size_t too small");
+            return 0L;
+          }
+
+          /* allocate memory */
           data = (U8*)malloc(bytes);
           if (!data)
           {
@@ -363,7 +408,7 @@ static S64 dicom_pixel(const ELEMENT *e)
       error=dicom_load(OW);
     }else if (single.alloc==12) {
       if ( *((U8*)&magic)==0x12 ) mdc_dicom_switch_endian(); 
-      error=dicom_load(OW);
+        error=dicom_load(OW);
       if ( *((U8*)&magic)==0x12 ) mdc_dicom_switch_endian();
     }else{
       error=dicom_load(OB);


=====================================
libs/dicom/transform.c
=====================================
@@ -17,9 +17,9 @@ static U16 dicom_clut(const CLUT *,U16);
 
 int dicom_alloc(SINGLE *single)
 {
-  S64	length,l;
-  U16	magic=0x1234,*data,*d;
-  int	high,bit,low;
+  S64 length,l;
+  U16 magic=0x1234,*data,*d;
+  int high,bit,low;
 
   dicom_log(DEBUG,"dicom_alloc()");
 
@@ -51,13 +51,13 @@ int dicom_alloc(SINGLE *single)
 
   if ( *((U8*)&magic)==0x12 )
     if (single->alloc==12)
-      for (l=length; l; l-=2)
+      for (l=length; l>0; l-=2)
       {
         *d++=mdc_dicom_12_unpack(1);
         *d++=mdc_dicom_12_unpack(2);
       }
     else 
-      for (l=length; l; l--)
+      for (l=length; l>0; l--)
       {
         dicom_32_skip(high);
         *d++=dicom_32_read(bit);
@@ -65,24 +65,24 @@ int dicom_alloc(SINGLE *single)
       }
   else
     if (single->alloc==16)
-      for (l=length; l; l--)
+      for (l=length; l>0; l--)
       {
-	dicom_16_skip(high);
-	*d++=dicom_16_read(bit);
-	dicom_16_skip(low);
+        dicom_16_skip(high);
+        *d++=dicom_16_read(bit);
+        dicom_16_skip(low);
       }
     else if (single->alloc==12)
-      for (l=length; l; l-=2)
+      for (l=length; l>0; l-=2)
       {
         *d++=mdc_dicom_12_unpack(1);
         *d++=mdc_dicom_12_unpack(2);
       }
     else
-      for (l=length; l; l--)
+      for (l=length; l>0; l--)
       {
-	dicom_8_skip(high);
-	*d++=dicom_8_read(bit);
-	dicom_8_skip(low);
+        dicom_8_skip(high);
+        *d++=dicom_8_read(bit);
+        dicom_8_skip(low);
       }
 
   eNlfSafeFree(single->data);
@@ -100,9 +100,9 @@ int dicom_alloc(SINGLE *single)
 
 int dicom_sign(SINGLE *single)
 {
-  int	edge,i;
-  S64	length,l;
-  U16	*d;
+  int edge,i;
+  S64 length,l;
+  U16 *d;
 
   dicom_log(DEBUG,"dicom_sign()");
 
@@ -129,7 +129,7 @@ int dicom_sign(SINGLE *single)
   length=(S64)single->frames*single->w*single->h*single->samples;
   d=single->data;
 
-  for (l=length; l; l--,d++)
+  for (l=length; l>0; l--,d++)
     if (*d<edge)
       *d+=edge;
     else
@@ -137,32 +137,32 @@ int dicom_sign(SINGLE *single)
 
   switch(single->photometric)
   {
-  case PALETTE_COLOR :
-  case ARGB :
-    for (i=0; i<3; i++)
-      if (single->clut[i].threshold.u16<edge)
-        single->clut[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 (*d<edge)
-	    *d+=edge;
-	  else
-	    *d-=edge;
-      }
-    break;
-
-  default :
-    break;
+    case PALETTE_COLOR :
+    case ARGB :
+      for (i=0; i<3; i++)
+        if (single->clut[i].threshold.u16<edge)
+          single->clut[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>0; l--,d++)
+             if (*d<edge)
+               *d+=edge;
+             else
+               *d-=edge;
+        }
+      break;
+  
+    default :
+      break;
   }
 
   single->sign=0;
@@ -176,9 +176,9 @@ int dicom_sign(SINGLE *single)
 
 int dicom_planar(SINGLE *single)
 {
-  int	i,j;
-  S64	length,l;
-  U16	*frame_s,*frame_d,*s,*d;
+  int i,j;
+  S64 length,l;
+  U16 *frame_s,*frame_d,*s,*d;
 
   dicom_log(DEBUG,"dicom_planar()");
 
@@ -218,7 +218,7 @@ int dicom_planar(SINGLE *single)
     {
       d=frame_d+j;
 
-      for (l=length; l; l--)
+      for (l=length; l>0; l--)
       {
         *d=*s++;
         d+=single->samples;
@@ -241,9 +241,9 @@ int dicom_planar(SINGLE *single)
 
 int dicom_shift(SINGLE *single)
 {
-  int	shift,i;
-  S64	length,l;
-  U16	*d;
+  int shift,i;
+  S64 length,l;
+  U16 *d;
 
   dicom_log(DEBUG,"dicom_shift()");
 
@@ -264,56 +264,56 @@ int dicom_shift(SINGLE *single)
 
   switch(single->photometric)
   {
-  default :
-    shift=15-single->high;
-
-    if (!shift)
-      return 0;
-
-    length=(S64)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=(S64)single->frames*single->w*single->h;
+    default :
+      shift=15-single->high;
+  
+      if (!shift)
+        return 0;
+  
+      length=(S64)single->frames*single->w*single->h*single->samples;
       d=single->data;
-
-      for (l=length; l; l--)
+  
+      for (l=length; l>0; l--)
+        *d++<<=shift;
+  
+      single->high=15;
+      break;
+  
+    case ARGB :
+      shift=15-single->high;
+  
+      if (shift)
       {
-        d++;
-	*d++<<=shift;
-	*d++<<=shift;
-	*d++<<=shift;
+        length=(S64)single->frames*single->w*single->h;
+        d=single->data;
+  
+        for (l=length; l>0; l--)
+        {
+          d++;
+          *d++<<=shift;
+          *d++<<=shift;
+          *d++<<=shift;
+        }
+  
+        single->high=15;
+      }
+      break;
+  
+    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>0; l--)
+           *d++<<=shift;
+  
+        single->clut[i].bit=16;
       }
-
-      single->high=15;
-    }
-    break;
-
-  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;
@@ -327,9 +327,9 @@ IMAGE *dicom_transform(SINGLE *single,int parametric)
 {
   static IMAGE image;
 
-  S64	length,l;
-  U16	*s;
-  U8	*d;
+  S64 length,l;
+  U16 *s;
+  U8  *d;
 
   dicom_log(DEBUG,"dicom_transform()");
 
@@ -368,35 +368,35 @@ IMAGE *dicom_transform(SINGLE *single,int parametric)
 
   switch(single->photometric)
   {
-  case MONOCHROME1 :
-  case MONOCHROME2 :
-    image.rgb=0;
-    image.data.gray=single->data;
-    single->data=0L;
-
-    if (parametric)
+    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 ℑ
-
-    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;
+  
+    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;
@@ -414,60 +414,60 @@ IMAGE *dicom_transform(SINGLE *single,int parametric)
 
   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*3L; 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)
+    case PALETTE_COLOR :
+      for (l=length; l>0; 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*3L; l>0; l--)
+        *d++=*s++>>8;
+      break;
+  
+    case HSV :
+      for (l=length; l>0; 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+=4;
+        dicom_hsv(s[0],s[1],s[2],d);
+        s+=3;
+        d+=3;
       }
-      else
+      break;
+  
+    case ARGB :
+      for (l=length; l>0; 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>0; l--)
       {
+        *d++=(0xFFFF-*s++)>>8;
+        *d++=(0xFFFF-*s++)>>8;
+        *d++=(0xFFFF-*s++)>>8;
         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;
+      break;
+  
+    default :
+      break;
   }
 
   return ℑ


=====================================
libs/dicom/zoom.c
=====================================
@@ -22,9 +22,9 @@ static IMAGE *zoom;
 
 IMAGE *dicom_zoom(const IMAGE *image,int w,int h,int hyper)
 {
-  U16	frame;
-  int	size;
-  void	*source,*target;
+  U16 frame;
+  int size;
+  void *source,*target;
 
   dicom_log(DEBUG,"dicom_zoom()");
 
@@ -53,7 +53,7 @@ IMAGE *dicom_zoom(const IMAGE *image,int w,int h,int hyper)
   source=image->data.rgb;
   target=zoom->data.rgb;
 
-  for (frame=zoom->frames; frame; frame--)
+  for (frame=zoom->frames; frame>0; frame--)
   {
     if (!hyper || (w<image->w && h<image->h))
       if (zoom->rgb)
@@ -79,8 +79,8 @@ IMAGE *dicom_zoom(const IMAGE *image,int w,int h,int hyper)
 
 static void dicom_zoom_gray(const IMAGE *image,U16 *source,U16 *target)
 {
-  float	x,y,sx,sy;
-  U16	*line;
+  float x,y,sx,sy;
+  U16 *line;
 
   dicom_log(DEBUG,"dicom_zoom_gray()");
 
@@ -101,9 +101,9 @@ static void dicom_zoom_gray(const IMAGE *image,U16 *source,U16 *target)
 
 static void dicom_zoom_rgb(const IMAGE *image,U8 *source,U8 *target)
 {
-  float	x,y,sx,sy;
-  int	i;
-  U8	*line;
+  float x,y,sx,sy;
+  int i;
+  U8 *line;
 
   dicom_log(DEBUG,"dicom_zoom_rgb()");
 
@@ -129,9 +129,9 @@ static void dicom_zoom_rgb(const IMAGE *image,U8 *source,U8 *target)
 
 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;
+  float x,y,sx,sy,dx,dy;
+  int ix,iy;
+  U16 *line,*next;
 
   dicom_log(DEBUG,"dicom_hyper_gray()");
 
@@ -173,9 +173,9 @@ static void dicom_hyper_gray(const IMAGE *image,U16 *source,U16 *target)
 
 static void dicom_hyper_rgb(const IMAGE *image,U8 *source,U8 *target)
 {
-  float	x,y,sx,sy,dx,dy;
-  int	ix,iy,i;
-  U8	*line,*next;
+  float x,y,sx,sy,dx,dy;
+  int ix,iy,i;
+  U8 *line,*next;
 
   dicom_log(DEBUG,"dicom_hyper_rgb()");
 
@@ -207,7 +207,7 @@ static void dicom_hyper_rgb(const IMAGE *image,U8 *source,U8 *target)
 
       ix*=3;
 
-      for (i=3; i; i--)
+      for (i=3; i>0; i--)
       {
         *target++= (1.0-dx)*(1.0-dy)*line[ix] + dx*(1.0-dy)*line[ix+4] +
           (1.0-dx)*dy*next[ix] + dx*dy*next[ix+4] + 0.5;


=====================================
man/m-acr.4
=====================================
@@ -1,7 +1,7 @@
 '\" t
 .TH M-ACR 4
 .SH NAME
-m-acr - ACR/NEMA medical image format (MedCon)
+m-acr - ACR/NEMA medical image format for (X)MedCon
 .SH DESCRIPTION
 .PP
 .in 0.2i
@@ -99,7 +99,7 @@ char *  Image Modality                : (NM)
 Uint16  Group   number                : 0x0008
 Uint16  Element number                : 0x0070
 Uint32  Element length  in bytes      : (24)
-char *  Manufacturer                  : (MedCon v?.?? - Erik Nolf)
+char *  Manufacturer                  : ((X)MedCon)
 ---------------------------------------------------------------------------
 Uint16  Group   number                : 0x0008
 Uint16  Element number                : 0x0080


=====================================
man/m-anlz.4
=====================================
@@ -1,7 +1,7 @@
 '\" t
 .TH M-ANLZ 4
 .SH NAME
-m-anlz - Analyze (SPM) medical image format (MedCon)
+m-anlz - Analyze (SPM) medical image format for (X)MedCon
 .SH DESCRIPTION
 .PP
 .in 0.2i


=====================================
man/m-ecat.4
=====================================
@@ -1,7 +1,7 @@
 '\" t
 .TH M-ECAT 4
 .SH NAME
-m-ecat - CTI ECAT 6/7 medical image format (MedCon)
+m-ecat - CTI ECAT 6/7 medical image format for (X)MedCon
 .SH DESCRIPTION
 .PP
 .in 0.2i
@@ -223,7 +223,7 @@ Pixeltypes/Image : different pixeltypes for each image are NOT supported
 .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!
+The (X)MedCon programs also support 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.


=====================================
man/m-gif.4
=====================================
@@ -1,7 +1,7 @@
 '\" t
 .TH M-GIF 4
 .SH NAME
-m-gif - GIF87a and annimated GIF89a format (MedCon)
+m-gif - GIF87a and annimated GIF89a format for (X)MedCon
 .SH DESCRIPTION
 .PP
 .in 0.2i


=====================================
man/m-intf.4
=====================================
@@ -1,7 +1,7 @@
 '\" t
 .TH M-INTF 4
 .SH NAME
-m-intf - InterFile 3.3 medical image format (MedCon)
+m-intf - InterFile 3.3 medical image format for (X)MedCon
 .SH DESCRIPTION
 .PP
 .in 0.2i
@@ -73,7 +73,7 @@ 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.
+                   (X)MedCon does support different pixeltypes per image.
 ===========================================================================
 .fi
 .PP


=====================================
man/m-inw.4
=====================================
@@ -1,7 +1,7 @@
 '\" t
 .TH M-INW 4
 .SH NAME
-m-inw - RUG INW1.0 medical image format (MedCon)
+m-inw - RUG INW1.0 medical image format for (X)MedCon
 .SH DESCRIPTION
 .PP
 .in 0.2i


=====================================
man/medcon.1
=====================================
@@ -1,7 +1,7 @@
 '\" t
 .TH MEDCON 1
 .SH NAME
-medcon - MedCon conversion of medical image formats
+medcon - (X)MedCon's CLI - Medical Image Conversion Utility
 .SH SYNOPSIS
 .PP
 .in 0.2i
@@ -14,7 +14,10 @@ medcon - MedCon conversion of medical image formats
 .PP
 .in 0.2i
 .I MedCon 
-is a conversion utility intended for reconstructed nuclear medical images.
+is the command line interface for (X)MedCon's medical image conversion library. The program is capable of reading a few medical image formats containing multiple images in a single file.
+.PP
+.in 0.2i
+For more help type 'medcon \-\-help' or check out the documentation on the project's website.
 .PP
 .in 0.2i
 The supported formats are:


=====================================
man/medcon.3
=====================================
@@ -1,11 +1,11 @@
 '\" t
 .TH MEDCON 3
 .SH NAME
-medcon - MedCon C project for conversion of medical images
+medcon - (X)MedCon's C Library - Medical Image Conversion Utility
 .SH LIBRARY
 .PP
 .in 0.2i
-Local MedCon C library (
+(X)MedCon C library (
 .B libmdc.a
 )
 
@@ -33,28 +33,87 @@ 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!         */
+
+char MDC_INSTITUTION[];                 /* name of institution              */
+
+Int8 MDC_COLOR_MAP;                     /* gray color palette selected      */
+
+Int8 MDC_PADDING_MODE;                  /* resized image padding mode       */
+
+Int8 MDC_ANLZ_SPM;                      /* Analyze/SPM scaling factor       */
+Int8 MDC_ANLZ_OPTIONS;                  /* Analyze/SPM request params       */
+
+Int8 MDC_DICOM_MOSAIC_ENABLED;          /* DICOM: mosaic support enabled    */
+Int8 MDC_DICOM_MOSAIC_FORCED;           /* DICOM: mosaic preset  forced     */
+Int8 MDC_DICOM_MOSAIC_DO_INTERL;        /* DICOM: mosaic forced interlaced  */
+Int8 MDC_DICOM_MOSAIC_FIX_VOXEL;        /* DICOM: mosaic fix voxel sizes    */
+Int8 MDC_DICOM_WRITE_IMPLICIT;          /* DICOM: write little implicit     */
+Int8 MDC_DICOM_WRITE_NOMETA;            /* DICOM: write without meta header */
+Int8 MDC_DICOM_WRITE_ENCAP_UNCOMP;      /* DICOM: write encap. uncompressed */
+
+Int8 MDC_FORCE_RESCALE;                 /* user specified slope/intercept   */
+Int8 MDC_FORCE_CONTRAST;                /* user specified centre/width      */
+
+Int8 MDC_INFO;                          /* default print header info        */
+Int8 MDC_INTERACTIVE;                   /* interactive read of raw file     */
+Int8 MDC_CONVERT;                       /* image conversion requested       */
+Int8 MDC_EXTRACT;                       /* extract images                   */
+Int8 MDC_RENAME;                        /* rename base filename             */
+Int8 MDC_ECHO_ALIAS;                    /* echo alias name based on ID's    */
+Int8 MDC_EDIT_FI;                       /* edit FILEINFO struct             */
+
+Int8 MDC_PIXELS;                        /* print specified pix values       */
+Int8 MDC_PIXELS_PRINT_ALL;              /* print    all    pix values       */
+
+Int8 MDC_NEGATIVE;                      /* allow negative pixel values      */
+Int8 MDC_QUANTIFY;                      /* quantitation with one factor     */
+Int8 MDC_CALIBRATE;                     /* quantitation with two factors    */
+Int8 MDC_CONTRAST_REMAP;                /* apply contrast remapping         */
+
+Int8 MDC_DEBUG;                         /* give debug info                  */
+Int8 MDC_VERBOSE;                       /* run in verbose mode              */
+
+Int8 MDC_GIF_OPTIONS;                   /* request for extra GIF options    */
+
+Int8 MDC_MAKE_GRAY;                     /* forced remap color to gray scale */
+Int8 MDC_DITHER_COLOR;                  /* apply dither on color reduction  */
+
+Int8 MDC_NORM_OVER_FRAMES;              /* normalize over images in a frame */
+                                        /* instead of all images            */
+
+Int8 MDC_SKIP_PREVIEW;                  /* skip the first (preview) slice   */
+Int8 MDC_IGNORE_PATH;                   /* ignore path in INTF data fname   */
+Int8 MDC_SINGLE_FILE;                   /* write INTF as single file        */
+Int8 MDC_FORCE_INT;                     /* force integer pixels             */
+Int8 MDC_INT16_BITS_USED;               /* bits to use for Int16 type       */
+Int8 MDC_TRUE_GAP;                      /* spacing = true gap/overlap       */
+Int8 MDC_ALIAS_NAME;                    /* use  alias name based on ID's    */
+Int8 MDC_PREFIX_DISABLED;               /* prevent the prefix in names      */
+Int8 MDC_PREFIX_ACQ;                    /* use acquisition number as prefix */
+Int8 MDC_PREFIX_SER;                    /* use series      number as prefix */
+
+Int8 MDC_PATIENT_ANON;                  /* make patient anonymous           */
+Int8 MDC_PATIENT_IDENT;                 /* give patient identification      */
+Int8 MDC_FILE_OVERWRITE;                /* allow file overwriting           */
+Int8 MDC_FILE_STDIN;                    /* input from stdin  stream         */
+Int8 MDC_FILE_STDOUT;                   /* output  to stdout stream         */
+Int8 MDC_FILE_SPLIT;                    /* split up file in parts           */
+Int8 MDC_FILE_STACK;                    /* stack up files                   */
+
+Int8 MDC_FLIP_HORIZONTAL;               /* flip horizontal   (x)            */
+Int8 MDC_FLIP_VERTICAL;                 /* flip vertical     (y)            */
+Int8 MDC_SORT_REVERSE;                  /* reverse   sorting                */
+Int8 MDC_SORT_CINE_APPLY;               /* cine apply sorting               */
+Int8 MDC_SORT_CINE_UNDO;                /* cine undo  sorting               */
+Int8 MDC_MAKE_SQUARE;                   /* make square image                */
+Int8 MDC_CROP_IMAGES;                   /* crop image dimensions            */
+Int8 MDC_RESLICE;                       /* reslice images (tra, sag, cor)   */
+
+Int8 MDC_FRMT_INPUT;                    /* format used for stdin            */
+Int8 MDC_ECAT6_SORT;                    /* ECAT sort order                  */
+
+Int8 MDC_FALLBACK_FRMT;                 /* fallback read format             */
+
 .fi
 .PP
 .in 0.2i
@@ -76,12 +135,13 @@ Important Defines
 #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_ANLZ    9              /* Analyze (SPM)            */
 #define MDC_FRMT_DICM   10              /* DICOM 3.0                */
 #define MDC_FRMT_PNG    11              /* PNG                      */
 #define MDC_FRMT_CONC   12              /* Concorde uPet            */
+#define MDC_FRMT_NIFTI  13              /* NIfTI-1                  */
 
-#define MDC_MAX_FMTS    13              /* total + 1                */
+#define MDC_MAX_FMTS    14              /* total + 1                */
 
 /* supported color maps */
 #define MDC_MAP_PRESENT  0              /* 256 RGB   colormap       */
@@ -97,233 +157,245 @@ Important Defines
 .in 0.2i
 .ce 3
 -----------------------------------------------------------------------
-Important Definitions
+Important Structures
 -----------------------------------------------------------------------
 .PP
 .in 0.2i
 .nf
 
+/* 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;
+  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 angle_start;              /* start angle (interfile)   */
-        float angle_step;               /* angular step              */
-        float scan_arc;                 /* angular range             */
+  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)     */
+  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;                  /* 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         */
+  float hoffset;                 /* horizon. position (mm) */
+  float voffset;                 /* vertical position (mm) */
 
-} STATIC_DATA;
+} 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             */ /* 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?      */
+  /*             **   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   */
+  off_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*/
-        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?      */ 
+  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;
+
 .fi
 .PP
 .in 0.2i
@@ -337,19 +409,19 @@ Important Functions
 void MdcInit              (void);
 void MdcFinish            (void);
 
-int  MdcHandleArgs        ( FILEINFO *fi,int argc,char *argv[],int MAXFILES );
+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) );
+int  MdcReadFile          ( FILEINFO *fi, int filenr, char *(*ReadFunc)(FILEINFO *fi) );
+int  MdcWriteFile         ( FILEINFO *fi, int format, int prefixnr, char *(*WriteFunc)(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 MdcCloseFile         ( FILE *fp );
 void MdcSplitPath         ( char path[], char **dir, char **fname );
 int  MdcGetFrmt           ( FILEINFO *fi );
 
@@ -360,30 +432,31 @@ 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 *MdcReadANLZ         ( FILEINFO *fi );
+char *MdcReadCONC         ( FILEINFO *fi );
+char *MdcReadDICM         ( FILEINFO *fi );
 char *MdcReadECAT6        ( FILEINFO *fi );
 char *MdcReadECAT7        ( FILEINFO *fi );
+char *MdcReadGIF          ( 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 *MdcReadINW          ( FILEINFO *fi );
 char *MdcReadNIFTI        ( FILEINFO *fi );
+char *MdcReadPNG          ( FILEINFO *fi );
+char *MdcReadRAW          ( 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 *MdcWriteDICM        ( FILEINFO *fi );
+char *MdcWriteECAT6       ( FILEINFO *fi );
+char *MdcWriteECAT7       ( FILEINFO *fi );
+char *MdcWriteGIF         ( FILEINFO *fi );
+char *MdcWriteINTF        ( FILEINFO *fi );
+char *MdcWriteINW         ( FILEINFO *fi );
 char *MdcWriteNIFTI       ( FILEINFO *fi );
+char *MdcWritePNG         ( FILEINFO *fi );
+char *MdcWriteRAW         ( FILEINFO *fi );
 
 .fi
 .PP
@@ -392,8 +465,8 @@ char *MdcWriteNIFTI       ( FILEINFO *fi );
 .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 ...
+.I (X)MedCon
+library is intended for easy use of read/write routines for the supported medical image formats. Our original testing format was Ecat 6.4. The FILEINFO structure holds all the interesting parameters and pointers to each image. A fast introduction ...
 .PP
 .in 0.2i
 .TP
@@ -404,7 +477,7 @@ The very first and very last function to call when using this library. Currently
 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.
+Prints possible (X)MedCon command line options and terminates the program.
 .TP
 .B MdcOpenFile()
 Initializes FILEINFO struct and opens the file with or without decompression.
@@ -434,10 +507,10 @@ Resets the IMG_DATA structures. This is necessary after each conversion.
 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.
+Splits the path in a string into 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().
+Checks the format of the file. For the return value, see the representation of the supported formats under the section `Important Defines'. With the MDC_INTERACTIVE variable ON, the function returns MDC_FRMT_RAW; see also MdcReadRAW().
 .TP
 .B MdcGetColorMap()
 Fills a 256 byte RGB palette with the requested grayscale colormap.
@@ -454,40 +527,42 @@ Prints a warning. Argument is a variable parameter list.
 .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.
+.B MdcReadANLZ()  -   MdcWriteANLZ()
+Reads and writes Analyze (SPM) files.
+.TP
+.B MdcReadCONC()  -   MdcWriteCONC()
+Reads and writes Concorde microPET.
+.TP
+.B MdcReadDICM()  -   MdcWriteDICM()
+Reads and writes DICOM files.
+.TP
+.B MdcReadECAT6() -   MdcWriteECAT6()
+Reads and writes ECAT 6.4 files.
+.TP
+.B MdcReadECAT7() -   MdcWriteECAT7()
+Reads and writes ECAT 7.2 files.
 .TP
-.B MdcReadECAT6(),  MdcReadECAT7()  -   MdcWriteECAT6()
-Reads ECAT 6 (resp. 7). Writes ECAT 6.4 files.
+.B MdcReadGIF()   -   MdcWriteGIF()
+Reads GIF87a & GIF89a, writes annimated GIF89a 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.
+.B MdcReadINW()   -   MdcWriteINW()
+Reads and writes RUG INW files.
 .TP
-.B MdcReadPNG()  -   MdcWritePNG()
-Reads PNG files. Writes PNG files.
+.B MdcReadNIFTI() -   MdcWriteNIFTI()
+Reads and writes NIfTI-1 files.
 .TP
-.B MdcReadCONC()  -   MdcWriteCONC()
-Reads and writes Concorde microPET.
+.B MdcReadPNG()   -   MdcWritePNG()
+Reads and writes PNG files.
 .TP
-.B MdcReadNIFTI()  -   MdcWriteNIFTI()
-Reads and writes NIH's NIfTI files.
+.B MdcReadRAW()   -   MdcWriteRAW()
+Reads files of an unknown format interactively and writes raw image arrays without header in binary or ascii.
 
 .SH EXAMPLE
 .PP
@@ -504,12 +579,11 @@ A sample C-source code to show the usage of the functions. Please, look into the
 
 #include "medcon.h"
 
-#undef VERSION /* prevent any conflict */
-#define VERSION "TestIt v2.3"
+#define PROG_VERSION "TestIt v2.4"
 
 void NewPrefix(int n)
 {
-  sprintf(prefix,"my%02d-",n); /* max of 5 chars */
+  sprintf(prefix,"my%02d-",n); /* max of MDC_MAX_PREFIX chars (5) */
 }
 
 int main(int argc, char *argv[])
@@ -524,20 +598,21 @@ int main(int argc, char *argv[])
 
 .B  /* check arguments */
   if (argc < 2) {
-    printf("%s - %s\\n",VERSION,MdcGetLibLongVersion());
+    printf("%s - %s\n",PROG_VERSION,MdcGetLibLongVersion());
+    printf("\nPurpose: a simplified example program\n");
     MdcPrintUsage(argv[0]);
   }
 
 .B  /* init library */
   MdcInit();
 
-.B  /* handle arguments, last one determines max inputfiles */
+.B  /* handle MedCon arguments, last argument 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]);
+    printf("\n%s: ERROR : No output format specified\n\n",argv[0]);
     return(MDC_BAD_CODE);
   }
 
@@ -551,7 +626,7 @@ int main(int argc, char *argv[])
 .B     /* do the conversions */
      if (total[MDC_CONVS] > 0) {
 
-.B      /* go through conversion formats */
+.B       /* go through conversion formats */
        for (c=1; c<MDC_MAX_FRMTS; c++) {
           convert = convs[c];
 .B          /* write output format when selected */
@@ -563,8 +638,10 @@ int main(int argc, char *argv[])
           }
        }
      }
+
 .B     /* clean up FILEINFO struct */
      MdcCleanUpFI(&fi);
+
   }
 
 .B  /* finish library */
@@ -573,6 +650,7 @@ int main(int argc, char *argv[])
   return(err);
 
 }
+
 -----------------------------------------------------------------------
 .fi
 .PP


=====================================
man/xmedcon.1
=====================================
@@ -1,7 +1,7 @@
 '\" t
 .TH MEDCON 1
 .SH NAME
-xmedcon \- MedCon with GUI for the X Window System
+xmedcon \- (X)MedCon's GUI - Medical Image Conversion Utility
 .SH SYNOPSIS
 .PP
 .in 0.2i
@@ -20,11 +20,10 @@ or
 .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.
+is the graphical user interface for (X)MedCon's medical image conversion library. The program is capable of reading a few medical image formats containing multiple images in a single file. It is built around the Gtk widget toolkit and GdkPixbuf image loading library.
 .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).
-
+For more help type 'xmedcon \-\-help', read the man\-page medcon(1) or check out the documentation on the project's website.
 .SH FILES
 .PP
 .in 0.2i


=====================================
source/m-defs.h
=====================================
@@ -129,25 +129,25 @@
 #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_FRMT_BAD     MDC_ZERO      /* unsupported format      */
+#define MDC_FRMT_NONE    MDC_FRMT_BAD  /* unsupported format      */
+#define MDC_FRMT_RAW     1             /* raw binary              */
+#define MDC_FRMT_ASCII   2             /* 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             /* Analyse (SPM)           */
+#define MDC_FRMT_DICM    10            /* DICOM 3.0               */
+#define MDC_FRMT_PNG     11            /* PNG                     */
+#define MDC_FRMT_CONC    12            /* Concorde uPet           */
+#define MDC_FRMT_NIFTI   13            /* NIfTI-1                 */
+
+#define MDC_MAX_FRMTS    14            /* total + 1 formats       */
+
+/* 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                */
@@ -155,7 +155,7 @@
 #define MDC_ACQUISITION_GATED      4         /* gated                  */
 #define MDC_ACQUISITION_GSPECT     5         /* gated spect            */
 
-#define MDC_MAX_ACQUISITIONS       6         /* total acquisitions + 1 */
+#define MDC_MAX_ACQUISITIONS       6         /* total + 1 acquisitions */
 
 /* ECAT sort order */
 #define MDC_ANATOMICAL   1


=====================================
source/m-files.c
=====================================
@@ -277,7 +277,7 @@ int MdcReadFile(FILEINFO *fi, int filenr, char *(*ReadFunc)(FILEINFO *fi))
 
 }
 
-int MdcWriteFile(FILEINFO *fi, int format, int prefixnr, char *(*WriteFunc)())
+int MdcWriteFile(FILEINFO *fi, int format, int prefixnr, char *(*WriteFunc)(FILEINFO*))
 {
   const char *msg=NULL;
   Int8 INTERNAL_ENDIAN;


=====================================
source/m-files.h
=====================================
@@ -49,8 +49,8 @@
 ****************************************************************************/
 
 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 MdcReadFile(FILEINFO *fi, int filenr, char *(*ReadFunc)(FILEINFO *fi));
+int MdcWriteFile(FILEINFO *fi, int format, int prefixnr, char *(*WriteFunc)(FILEINFO*));
 int MdcLoadFile(FILEINFO *fi);
 int MdcSaveFile(FILEINFO *fi, int format, int prefixnr);
 int MdcLoadPlane(FILEINFO *fi, Uint32 img);


=====================================
source/xcolgbc.c
=====================================
@@ -131,17 +131,17 @@ void XMdcColGbcCorrectMakeIcons(void)
   GdkPixbuf *im0;
 
   im0=gdk_pixbuf_new_from_data(xmdc_brightness_icon, GDK_COLORSPACE_RGB, FALSE,
-                               8, 12, 12, 3*12, (void(*)())NULL, NULL);
+                               8, 12, 12, 3*12, (GdkPixbufDestroyNotify)NULL, NULL);
   sGbc.brightness_icon = gdk_pixbuf_add_alpha(im0,TRUE,0xff,0x00,0xff);
   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);
+                               8, 12, 12, 3*12, (GdkPixbufDestroyNotify)NULL, NULL);
   sGbc.contrast_icon   = gdk_pixbuf_add_alpha(im0,TRUE,0xff,0x00,0xff);
   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);
+                               8, 12, 12, 3*12, (GdkPixbufDestroyNotify)NULL, NULL);
   sGbc.gamma_icon      = gdk_pixbuf_add_alpha(im0,TRUE,0xff,0x00,0xff);
   g_object_unref(im0);
 



View it on GitLab: https://salsa.debian.org/med-team/xmedcon/-/commit/7d4126579eeda541b729462668f7ae5700f6fc6e

-- 
View it on GitLab: https://salsa.debian.org/med-team/xmedcon/-/commit/7d4126579eeda541b729462668f7ae5700f6fc6e
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20250322/74f0f6b8/attachment-0001.htm>


More information about the debian-med-commit mailing list