changeset 1607:73023a1ee6cb

* added -swap_bytes option to rawtominc call (thanks Steve Robbins)
author rotor <rotor>
date Mon, 22 Dec 2003 16:32:06 +0000
parents 4dd88c88dfdd
children 5371eb279b97
files conversion/ana2mnc/ana2mnc
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/conversion/ana2mnc/ana2mnc
+++ b/conversion/ana2mnc/ana2mnc
@@ -133,6 +133,9 @@
 chomp($history = `date`);
 $history .= '>>>> ' . join(' ', $me, @ARGV) . "\n";
 
+# Set to 1 if byte-swapping is needed.
+my $bs = 0;
+
 # then do whatever we are supposed to be doing
 if($me eq "ana2mnc"){
    ($anabase, $mncfile) = @ARGV[0..1];
@@ -469,7 +472,7 @@
    read(HDR, my($his_s), 200);
    close(HDR);
    
-   my($bs, $extents, $c, $h) = 0;
+   my($extents, $c, $h) = 0;
    
    # check if we need to byteswap
    $h->{sizeof_hdr} = destruct(\$hdr_s, 0,'i', 0);
@@ -736,6 +739,9 @@
    my(@args) = ('rawtominc');
    if($clobber){ push(@args, '-clobber'); }
    
+   # Swap bytes?
+   if($bs){ push(@args, '-swap_bytes'); }
+
    # datatype and ranges
    push(@args, @{$gen_hdr->{datatype}});
    push(@args, '-range', $gen_hdr->{voxel_min}, $gen_hdr->{voxel_max});