[MINC-users] dcm2mnc and long attribute fields

Andrew Janke a.janke at gmail.com
Tue Jun 23 01:55:15 EDT 2009


Hi Soren

>  Someone at the department here had a problem that seems to be related
> to dcm2mnc behaviour.
> When dcm2mnc is run on a large number of dicom files, the parsed files
> contain attribute with all the names of the files used as argument.
>
> It seems minc_modify_header can have problems with long attribute fields.
> Here's output from an mritoself on a couple of files:

Yes, this certainly is a (more general) problem with long attributes
that typically are DICOM related. Given that the root "cause" of this
is that the size of arguments on the C/L is limited you could just
increase the size of ncargs in your kernel to get around this.

My attack plan for such things is to simply strip all the dicom bits
out of the header before further processing using something like the
following (perl) script that I affectionately call
"minc_de-dicomerise".

----
#! /usr/bin/env perl
#
# Andrew Janke - rotor at 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 == -1){
   die "\n+++WARNING: THIS SCRIPT MAY MUNGE YOUR FILE PERMANENTLY!+++\n\n".
       "Usage: $me <file1_to_clean.mnc> [<file2.mnc> [...]]\n\n";
   }

foreach $file (@ARGV){
   print " + Working on $file\n";

   (@yukky_vars) = split(' ', `mincinfo -varnames $file`);

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


--
Andrew Janke
(a.janke at gmail.com || http://a.janke.googlepages.com/)
Canberra->Australia    +61 (402) 700 883



More information about the MINC-users mailing list