1MEDCON(1)                   General Commands Manual                  MEDCON(1)
2
3
4

NAME

6       medcon - MedCon conversion of medical image formats
7

SYNOPSIS

9       medcon [options] -f files ...
10

DESCRIPTION

12  MedCon  is  a  conversion utility intended for reconstructed nuclear medical
13  images.
14
15  The supported formats are:
16
17  Format                      Explanation                         Notation
18  ------                      -----------                         --------
19 Ascii       Raw ascii  image arrays without header           'ascii'
20 Binary      Raw binary image arrays without header           'bin'
21 Gif89a      annimated GIF with colormap                      'gif'
22 Acr/Nema    Papyrus, Siemens    (vers 2.0)                   'acr'
23 INW         RUG local format (vers 1.0)                      'inw'
24 ECAT        Siemens CTI ECAT 6                               'ecat6' or 'ecat'
25 ECAT        Siemens CTI ECAT 7                               'ecat7'
26 InterFile   version 3.3                                      'intf'
27 Analyze     with consideration to SPM software               'anlz'
28 DICOM       uses the VT-DICOM library                        'dicom'
29 PNG         Portable Network Graphics                        'png'
30 Concorde    Concorde/microPET                                'conc'
31 NIfTI       Neuroimaging Informatics Technology Initiative   'nifti'
32

FLAGS

34       -f, --file, --files <files> ...
35              Read a list of files.
36
37

OPTIONS

39       -8, --indexed-color
40              This color mode forces 24-bit RGB color images being reduced  to
41              an  8-bit  indexed  colormap. For color reduction in combination
42              with dithering see the -dith option.
43
44
45       -24, --true-color
46              This color mode keeps a 24-bit image as is.
47
48
49       -alias, --alias-naming
50              Generate filenames based on patient and study  information.  The
51              syntax of the resulting basename is:
52
53              <patient_name>+<study_id>+<study_date>+<study_time>
54                            and
55                <series>+<acquisition>+<instance>
56
57              with  the latter three id's applied in case the originating for‐
58              mat is DICOM or Acr/Nema. See also -noprefix. Since Analyze does
59              not have a patient_name, patient_id is used instead.
60
61
62       -anon, --anonymous
63              Make  patient  and  study related entries anonymous (filled with
64              'X'). This option can not be used with option -ident.
65
66
67       -b8, --unsigned-char
68
69       -b16, --signed-short
70
71       -b16.12
72              Force writing of Uint8  or  Int16  pixels.  The  special  option
73              -b16.12  only  uses  12  bits,  as  unsigned however. With these
74              options one can lose the quantified float values  when  the  new
75              format  doesn't  support a global rescale factor or slope/inter‐
76              cept.
77
78
79       -big, --big-endian
80              Force writing of big endian files when supported by the format.
81
82
83       -byframe, --sort-by-frame
84              Set sort order in ECAT by frames, instead of the default anatom‐
85              ical  sort  (based  on slice location). Identical planes in each
86              frame will be grouped together. You don't want this.
87
88
89       -c, --convert <format> ...
90              Convert with a list of formats to convert to. Use  the  notation
91              without  quotes as specified in the above table. You can not use
92              this option with -p.
93
94
95       -contrast, --enable-contrast
96              Apply (DICOM) window centre/width contrast  remapping.  Although
97              this  may  improve the display of images, any manufacturer inde‐
98              pendent pixel values (like HU, SUV)  with  quantitation  options
99              -qc or -qs will be lost.
100
101
102       -cor, --coronal
103              Reslice  the  images of a volume into a coronal projection while
104              preserving the real world dimensions.
105
106
107       -crop=<X>:<Y>:<W>:<H>, --crop-images=<X>:<Y>:<W>:<H>
108              This option allows to crop an equal frame  from  all  images  at
109              <X>:<Y>  where width and height are <W>:<H>. The upper-left cor‐
110              ner of an image is at 0:0.
111
112
113       -cs, --cine-sorting
114              Apply cine sorting, 1st image of each time frame, 2nd  image  of
115              each  time  frame, 3rd image of each time frame, ... (applicable
116              on gated SPECT). Reapplying does NOT undo this sorting. For this
117              you need option -cu.
118
119
120       -cu, --cine-undo
121              Undo the cine sorting (as a result of the option -cs).
122
123
124       -cw=<centre>:<width>
125              Remap  contrast using specified centre/width pair. No spaces are
126              allowed within this option. See also -contrast options.
127
128
129       -d, --debug
130              Show debug info. After reading a file, the program will  display
131              the contents of the internal FILEINFO structure.
132
133
134       -db    Only print main header of CTI ECAT files to standard output.
135
136
137       -dith, --dither-color
138              Use dithering to improve quality of color reduction (from RGB to
139              8-bit indexed).
140
141       -e, --extract [image ranges ...]
142              A routine to extract images interactively,  unless  you  specify
143              normal style image ranges directly on the command-line separated
144              by spaces. In normal style it is also possible  to  reorder  the
145              sequence  of  images.  You  need to specify an output conversion
146              format (see option -c). Note that the extraction does NOT addapt
147              the centre-centre slice separations. In other words, proper vol‐
148              ume measurements could be lost.
149
150                   Selection Type?  1=normal    2=ecat
151
152                 Normal Style
153                 ------------
154
155          - Any number must be one-based (0 = All reversed)
156          - Syntax of range   : X...Y or X-Y
157          - Syntax of interval: X:S:Y    (S = step)
158          - The list is sequence sensitive!
159
160                 Give a list of images to extract?
161
162                 Ecat Style
163                 ----------
164
165          - Any number must be one-based (0 = All)
166          - Syntax of range   : X...Y or X-Y
167          - Syntax of interval: X:S:Y    (S = step)
168
169                 Give planes list?
170                 Give frames list?
171                 Give gates  list?
172                 Give beds   list?
173
174
175       -ean, --echo-alias-name
176              A convenience function which quickly echoes the alias  or  human
177              readable filename on screen, without any delay of image process‐
178              ing. For the syntax of this alias filename, see  option  -alias.
179              The  output  could then be used in a script, for example to make
180              interpretable links towards  cryptic  numbered  files  resulting
181              from a DICOM series.
182
183
184       -fb-none, --without-fallback
185
186       -fb-anlz, --fallback-analyze
187
188       -fb-conc, --fallback-concorde
189
190       -fb-dicom, --fallback-dicom
191
192       -fb-ecat, --fallback-ecat
193              Disable  or  specify  a  fallback read format in case autodetect
194              failed.
195
196
197       -fh, --flip-horizontal
198
199       -fv, --flip-vertical
200              Flip images horizontal (-fh) along the  X-axis,  vertical  (-fv)
201              along the Y-axis respectively. Parameters such as slice orienta‐
202              tion are NOT changed. See also the -rs option.
203
204
205       -fmosaic=<W>x<H>x<N>, --force-mosaic=<W>x<H>x<N>
206              Enforce the mosaic file support for DICOM or  Acr/Nema  formats.
207              The  *stamps* will be splitted into separate slices according to
208              the values supplied on the command-line. See also extra  options
209              -interl and -mfixv. The preset arguments are:
210
211                   <W> = pixel width  of image stamps (X)
212
213                   <H> = pixel height of image stamps (Y)
214
215                   <N> = total number of image stamps (Z)
216
217                   medcon -f imagefile -fmosaic=64x64x30
218
219
220       -g, --make-gray
221              Remap  coloured  images to gray. This is necessary when you con‐
222              vert to formats which only support a grayscale colormap!
223
224
225       -gap, --spacing-true-gap
226              The spacing between slices is the true gap/overlap between adja‐
227              cent  slices.  In  contrary  to  the default behaviour where the
228              spacing between slices is measured from the centre to centre  of
229              two  adjacent slices (including gap/overlap). Applied in DICOM &
230              Acr/Nema.
231
232
233       -hackacr, --hack-acrtags
234              Enables you to hack a file that contains  Acr/Nema  tags  hidden
235              somewhere.   Some  proprietary image formats do contain tags but
236              are placed after some  unknown  headerinformation.  This  option
237              will  try  to  find  some  readable tags in the first 2048 bytes
238              after which it will give some possible hints to get  the  images
239              out  of  the file with the use of the interactive reading proce‐
240              dure (see option `-i'). This  experimental  procedure  can  fail
241              badly ...
242
243
244       -i, --interactive
245              Selects  the interactive reading procedure. Normally the program
246              automatically detects the format or uses 'ecat' (or 'dicom')  as
247              default.  With the interactive procedure it could be possible to
248              read an uncompressed, unsupported format by answering  the  fol‐
249              lowing questions:
250
251          Number of images?
252          General header offset to binary data?
253          Image   header offset to binary data?
254          Image   header repeated before each image?
255          Swap the pixel bytes?
256          Same characteristics for all images?
257          Absolute offset in bytes? (overrides above, 0 = unused)
258          Image columns?
259          Image rows?
260          Pixel data type?
261          Redo input?
262
263       The  GUI  allows to save such raw predef input (RPI) files, that can be
264       used in a redirect statement:
265
266          medcon -f unsupported.img -c intf -i < predef.rpi
267
268       Doing so you can create small scripts that will read and  convert  your
269       unsupported images at once.
270
271
272       -ident, --identify
273              An  interactive routine to specify the patient and study related
274              information.  This option can not be used with the option -anon.
275              The questions asked are:
276
277
278          Give patient name?
279          Give patient id?
280          Select patient sex?
281          Give study description?
282          Give study id/name/p-number?
283          Give series description?
284
285
286       -implicit, --write-implicit
287              Another  DICOM  related option to enforce the implicit VR little
288              transfer syntax as  output,  instead  of  the  default  explicit
289              transfer syntax.
290
291
292       -interl, --mosaic-interlaced
293              An  extra  option  used in combination with forced mosaic (-fmo‐
294              saic). The option indicates that  the  slices  in  the  original
295              mosaic  are  in  fact interlaced.  See also options -fmosaic and
296              -mfixv.
297
298
299       -little, --little-endian
300              Force writing of little endian files when supported by the  for‐
301              mat.
302
303
304       -lut, --load-lut <filename>
305              Load an external LUT color scheme.
306
307
308       -mh, --map-hotmetal
309              Selects the hotmetal colormap. This is only usefull to GIF89a or
310              PNG.
311
312
313       -mr, --map-rainbow
314              Selects the rainbow  colormap. This is only usefull to GIF89a or
315              PNG.
316
317
318       -mc, --map-combined
319              Selects the combined colormap. This is only usefull to GIF89a or
320              PNG.
321
322
323       -mi, --map-inverted
324              Selects the invers   colormap. This is only usefull to GIF89a or
325              PNG
326
327
328       -mfixv, --mosaic-fix-voxel
329              Another  extra  option  used  in  combination with forced mosaic
330              (-fmosaic). Choosing this options will rescale  the  real  world
331              voxel  dimensions  by  the mosaic factor.  See also -fmosaic and
332              -interl.
333
334
335       -mosaic, --enable-mosaic
336              Enable mosaic file support in  DICOM  or  Acr/Nema  format.  The
337              *stamps* will be splitted into separate slices according to val‐
338              ues found in the file. This autodetect routine will  always  fix
339              the  voxel  sizes.  To  support  other type of mosaic files, see
340              option -fmosaic.
341
342
343       -n, --negatives
344              Preserve negative values. When not selected, all negative values
345              are  put  to  zero. In combination with quantitation (see -qs or
346              -qc) the requested format must support pixels of type  float,  a
347              global  rescale  factor or the more generic slope/intercept con‐
348              cept in order to preserve the (negative and positive) quantified
349              values.
350
351
352       -nf, --norm-over-frames
353              Normalize  with  minimum/maximum  values  found over images in a
354              frame group (in case the original format has different  frames).
355              The default behaviour is normalization with minimum/maximum val‐
356              ues found over all images.   This  can  be  important  when  the
357              requested  format  requires  a rescaling to a new pixeltype. The
358              original pixel values then need to be rescaled to the new pixel‐
359              type boundaries based on the minimum/maximum values.
360
361
362       -nometa, --write-without-meta
363              Write  DICOM  files  without  the  part  10  meta  header (group
364              0x0002).
365
366
367       -nopath, --ignore-path
368              Ignore absolute path mentioned in the "name of data file" key of
369              an  interfile  header.  Do  make  sure  then  that the data file
370              resides in the same directory as the header file.
371
372
373       -noprefix, --without-prefix
374              This option disables the numbered prefix in the output filename.
375              In  combination  with  the -alias option, one could create human
376              readable and alphabetical sorted files from  DICOM  or  Acr/Name
377              multiple file volumes.
378
379
380       -o, --output-name <filename>
381              Changes  output  filename  for  ALL  files  to be created. It is
382              allowed to specify a full directory path  as  well.  However,  a
383              full path disables unique filename prefixing.
384
385
386       -one, --single-file
387              Write header and image to same file; as allowed for InterFile.
388
389
390       -optgif, --options-gif
391              Define some GIF options when converting to the GIF format. With‐
392              out this option a loop  and  background  color  are  defined  by
393              default. This interactive routine asks the following questions:
394
395          Select color map?
396          Insert a display loop?
397          Delay 1/100ths of a second?
398          Insert a transparent color?
399          Transparent color?
400          Background  color?
401
402       -optspm, --options-spm
403              Define some SPM options (origins) when converting to the Analyze
404              format. The quantification is not set. See also '-spm' &  '-ar'.
405              The interactive routine asks the following questions:
406
407          Origin X?
408          Origin Y?
409          Origin Z?
410
411       -p, --print-values
412              Show  some  specified  pixel values. This is an interactive rou‐
413              tine. Calibration and negative pixels  are  preserved  automati‐
414              cally.  You  need to specify the -qs to preserve the quantifica‐
415              tion instead of the calibration. You can  not  use  this  option
416              with -c. See also -pa option for a non-interactive routine.
417
418          - Any number must be one-based (0 = All)
419          - Syntax of range   : X...Y or X-Y
420          - Syntax of interval: X:S:Y    (S = step)
421
422                   Selection Type?  1=normal    2=ecat
423
424                 Normal Style
425                 ------------
426
427                   Give a list of image numbers?
428                   Give a list of pixels x,y ?
429
430                 Ecat Style
431                 ----------
432
433                   Give planes list?
434                   Give frames list?
435                   Give gates  list?
436                   Give beds   list?
437                   Give a list of pixels x,y ?
438
439
440       -pa, --print-all-values
441              Show  all  pixel  values.  This  option  is identical to -p, but
442              doesn't require user input.
443
444
445       -pad, --pad-around
446
447       -padtl, --pad-top-left
448
449       -padbr, --pad-bottom-right
450              Increasing the slice matrix is done by padding an image with the
451              lowest  pixel  value. The options above enable different padding
452              modes.
453
454
455       -preacq, --prefix-acquisition
456
457       -preser, --prefix-series
458              Respectivily use acquisition or series  value  in  the  numbered
459              prefix of the new filename. This is useful for alphabetical file
460              ordering, where leading zeros in DICOM elements are missing. See
461              also -alias.
462
463
464       -q, --quantitation
465              Enable  quantitation  using all scale factors (for now alias for
466              -qc option).
467
468
469       -qs, --quantification
470              A first scaling option to preserve the (ECAT) quantification (a)
471              or to consider a first linear scaling slope with intercept (b).
472
473          qpv = ppv * quant_scale   [counts/second/pixel] (a)
474          qpv = ppv * slope + intercept (b)
475
476          qpv = quantified pixel value
477          ppv = plain pixel value
478
479       The  "quant_scale"  factor  normalizes  all  images  in the file; quite
480       important for merging purposes. When the corresponding format  can  not
481       hold  a  rescale factor for each image, the quantified values are saved
482       as floats. Therefore, the highest pixel precision for correct quantita‐
483       tion is float, not double!
484
485       If  the format does not support floats, the quantified pixel values get
486       rescaled to an integer. Then only formats that support a global scaling
487       factor or slope/intercept pair will preserve those quantified values.
488
489       Note that this option can not be used with -qc.
490
491
492       -qc, --calibration
493              A  second quantitation option to preserve the (ECAT) quantifica‐
494              tion as well as the (ECAT) calibration (a) or in general,  using
495              two  rescale slopes with an intercept (b). These should normally
496              transform pixels into manufacturer independent  values.  So  one
497              can  assume that after a calibration, the new pixels will repre‐
498              sent  a  real  world  unit  (like  concentration  values  (SUV),
499              hounsfield units (HU) and alike).
500
501
502          cpv = ppv * quant_scale * calibr_fctr  [uCi/ml] (a)
503          cpv = ppv * slope1 * slope2 + intercept (b)
504
505          cpv = calibrated pixel value
506          ppv = plain pixel value
507          qpv = quantified pixel value = ppv * quant_scale
508
509       The  "quant_scale"  factor  normalizes  all  images  in the file; quite
510       important for merging purposes. The "calibr_fctr" rescales the qpv-val‐
511       ues  to  a  new unit. When the corresponding format can not hold a com‐
512       pound factor for each image, the quantified values  will  be  saved  as
513       floats. Therefore, the highest pixel precision for correct quantitation
514       is float and not double!
515
516       If the format does not support floats, the calibrated pixel values  are
517       rescaled to an integer type. Only formats that support a global scaling
518       factor or slope/intercept pair preserve those calibrated values.
519
520
521       Note that this option can not be used with -qs.
522
523
524       -r, --rename-file
525              Rename the file basename. This option is only useful in case  of
526              conversion.
527
528
529       -rs, --reverse-slices
530              Reverse  all  the  slices  along  the Z-axis. Parameters such as
531              slice orientation are NOT changed. See  also  the  -fh  and  -fv
532              options.
533
534
535       -s, --silent
536              Suppress all message, warning and error dialogs.
537
538
539       -sag, --sagittal
540              Reslice  the images of a volume into a sagittal projection while
541              preserving the real world dimensions.
542
543
544       -si=<slope>:<intercept>
545              Force remap of pixel values using specified slope/intercept (y =
546              s*x  + i). The quantitation option -qc is enabled by default. No
547              spaces are allowed within this option.
548
549
550       -skip1, --skip-preview-slice
551              Skip the first image in an InterFile. In other words, the  first
552              image  in  the  array will simply be ignored. Use this only when
553              you are sure that the InterFile does contain an annoying/confus‐
554              ing preview slice.
555
556
557       -split4d, -splitf, --split-frames
558
559       -split3d, -splits, --split-slices
560              Write  out a study into separate files, one for each volume in a
561              time frame (--split-frames) or each image slice (--split-slices)
562              individually.  The names of the files created will have an extra
563              index  number.  See  also  -stack3d  and  -stack4d  as  opposite
564              options.
565
566
567       -spm, --analyze-spm
568              Considering  Analyze files for/from SPM. In this case the global
569              scaling factor hidden in imd.funused[1] will be used, as well as
570              the hidden offset value in imd.funused[0].
571
572       In  case  of quantitation, the default output pixel type is float. This
573       option allows to write integers combined with a global scale factor. To
574       actually use this scaling factor, you must select a quantitation option
575       like -qs or -qc as well.
576
577       See also -ar & -optspm.
578
579
580       -sqr, --make-square
581              Make all image matrices square,  using  the  largest  dimension.
582              Images  are  padded  with  the lowest pixel value. See also -pad
583              related options.
584
585
586       -sqr2, --make-square-two
587              Make all image matrices square, using the nearest power  of  two
588              (between 64, 128, 256, 512 and 1024). Images are padded with the
589              lowest pixel value. See also -pad related options.
590
591
592       -stack4d, -stackf, --stack-frames
593
594       -stack3d, -stacks, --stack-slices
595              Write separate studies into one file. The --stack-slices  option
596              allows  to  write  single  image slice files into one 3D volume,
597              while the --stack-frames option allows volumes of different time
598              frames  being written into one 4D file. The sequence of stacking
599              is based on the file sequence given at the  argument  line.  See
600              also -split3d and -split4d as the opposite options.
601
602
603       -tra, --transverse
604              Reslice  the  images  of  a  volume into a transverse projection
605              while preserving the real world dimensions.
606
607
608       -uin, --use-institution-name <namestring>
609              Change the program's default institution name which  is  applied
610              on studies without one. However, this does not override existing
611              values. For a  namestring  with  spaces,  group  between  double
612              quotes.
613
614
615       -v, --verbose
616              Verbose  mode.  Show some explaining messages during the reading
617              and writing of files.
618
619
620       -vifi, --edit-fileinfo
621              An interactive routine for editing voxel,array,slice and  orient
622              related entries in the FILEINFO struct.
623
624
625       -w, --overwrite-files
626              Allow overwrite of existing files, without warning.
627
628

NOTES

630  When no conversion was specified, the program will display the header infor‐
631  mation of each image.
632
633  When conversion was specified, the program  will  automatically  create  new
634  filenames in the current directory with the following syntax:
635
636                               mXXX-filename.ext
637
638               `XXX-' a number representing the XXX-th conversion
639               `ext' a corresponding extension of the new format
640
641                         Binary raw   ->   .bin
642                         Ascii  raw   ->   .asc
643                         Gif89a       ->   .gif
644                         Acr/Nema     ->   .ima
645                         INW          ->   .im
646                         ECAT         ->   .img
647                         Interfile    ->   .h33 + .i33
648                         Analyze      ->   .hdr + .img
649                         DICOM        ->   .dcm
650                         PNG          ->   .png
651                         CONC         ->   .hdr + .dat
652
653  Some special remarks related to reading from stdin or writing to stdout.
654
655     a) reading from stdin:
656
657       Enable this by using an "-" mark instead of the list of input files.
658
659          1. redirect: medcon -f - < inputfile
660
661       This  is  supported  for all formats and shouldn't cause any particular
662       problems. Interactive routines are disabled because stdin is now in use
663       by the image input.
664
665          2. pipes   : cat inputfile | medcon -f - format
666
667       Actually,  this  way only one or two formats are supported since seek()
668       calls are not possible during pipes. The fact is that most of our  for‐
669       mats  are read using those seek() calls. In normal operation we already
670       need a quick sneak in the file to determine the  format.  Because  this
671       fseek() isn't allowed, you must supply at least the input format too.
672
673     b) writing to stdout:
674
675       Enabled by using an extra "-" mark on the conversion list.
676
677          medcon -f inputfile -c - format
678
679       Only  one  inputfile  is  allowed. The converted output will be send to
680       stdout.
681
682       In case of dual file formats such as Analyze or InterFile,  the  header
683       information  will be send to stderr. The reference to the image file in
684       the header of an InterFile will ofcourse be wrong (since the program is
685       not capable of knowing the resulting filename).
686
687       In  case  of RAW or ASCII output, the program will print the content of
688       the internal FILEINFO struct to stderr as well. Please  note  that  the
689       (t)csh  shells  do  not  allow to catch stderr or stdout separately. In
690       case of the bash shell, it is possible to say:
691
692       medcon -f inputfile -c - intf -b16.12 -qc 1>image 2>header
693

EXAMPLES

695  1.  To display the image headers:
696            medcon -f filename1 filename2
697
698  2.  To convert the images:
699            medcon -f filename1 filename2 -c gif acr intf
700
701  3.  To read interactively
702            medcon -i -f filename -c ecat
703
704  4.  To extract alternate images:
705            medcon -e 1:2:20 -f filename -c gif
706
707  5.  To print out pixel values
708            medcon -p -f filename
709
710  6.  Convert to raw binary images, send to standard output:
711            medcon -f filename -c - bin
712

FILES

714  /usr/local/xmedcon/include/   Directory with header files.
715  /usr/local/xmedcon/lib/       Directory with libraries.
716  /usr/local/xmedcon/bin/       Directory with executables.
717  /usr/local/xmedcon/man/       Directory with man-pages.
718  /usr/local/xmedcon/etc/       Directory with rcfiles.
719

SEE ALSO

721  xmedcon(1), xmedcon-config(1)
722
723  m-acr(4), m-anlz(4), m-gif(4), m-inw(4), m-intf(4), m-ecat(4)
724
725  medcon(3)
726

AUTHOR

728  (X)MedCon project was originally written by Erik Nolf (eNlf) for the  former
729  PET-Centre at Ghent University (Belgium).
730
731  e-mail:   enlf-at-users.sourceforge.net   www:   http://xmedcon.sourceforge.net
732
733
734
735                                                                     MEDCON(1)
Impressum