[MINC-users] Some minc tools don't work on some gziped volume

Andrew Janke rotor@cmr.uq.edu.au
Thu Jul 8 03:36:03 2004


On Wed, 7 Jul 2004, Olivier Colliot wrote:

> Something strange is happening when I compress some MINC volumes.
> Tools mincinfo and mincheader work with the unziped volume but not the
> ziped ones.
>
> There is the same kind of problem with mincheader :
>  >mincheader toto.mnc.gz
> [........]
>                 dicom_0x0040:el_0x0245 = "110730.703000 " ;
>                 dicom_0x0040:el_0x0253 = "4060610651" ;
> ncdump: type_name: bad type 0
>
> I never had these kind of problems before. This only occurs with MRIs
> coming from the Siemens Sonata scanner.
> These files have a huge minc header, maybe this can be related to the
> problem.

This was a problem with older distributions of MINC whereby not all of the
header was decompressed, (a guess was made as to how big a header might
possibly grow to and only that was uncompressed, then people went and made huge
headers by stuffing in all the dicom information! :).

The other option is that certain dicom codes have been known to confuse
netCDF/ncgen/ncdump somewhat as they (presumably) resemble control codes used
within netCDF.

The "fix" for this is the hack perl script below that will strip all such dicom
information out of the header, however be _VERY_ aware that this script has the
potention to wreak havoc on your MINC file headers as it simply removes any
header that has "dicom" somewhere in it!  It may also give you dental cavities,
but that claim has never been proved.

In other words, use it at your own risk and be aware that it works on the file
in question in place...

--cut here--
#! /usr/bin/env perl
#
# Andrew Janke - rotor@cmr.uq.edu.au
# Center for Magnetic Resonance
# The University of Queensland
# http://www.cmr.uq.edu.au/~rotor
#
# USE AT OWN RISK!  THIS MAY MUNGE YOUR MINC FILES HEADER!

use warnings "all";
use File::Basename;

$me = &basename($0);
if($#ARGV != 0){
   die "\n+++WARNING: THIS SCRIPT MAY MUNGE YOUR FILE PERMANENTLY!+++\n\n".
       "Usage: $me <file_to_clean.mnc>\n\n";
   }

(@yukky_vars) = split(' ', `mincinfo -varnames $ARGV[0]`);

foreach $var (grep {/dicom/} @yukky_vars){
   foreach (split(' ', `mincinfo -varatts $var $ARGV[0]`)){
      print " | [$ARGV[0]] - removing $var:$_\n";
      system('minc_modify_header', '-delete', "$var:$_", $ARGV[0]) == 0 or die;
      }
   }
--cut here--

--
Andrew Janke  ( rotorATcmr.uq.edu.au || www.cmr.uq.edu.au/~rotor )
Australia->University of Queensland->Centre for Magnetic Resonance
W: +61 7 3232 7254  ||  H: +61 7 3800 4042  ||  M: +61 4 2138 8581