changeset 1322:ed4bcc4b1431

Added -big_endian_image option.
author neelin <neelin>
date Fri, 23 Mar 2001 21:15:13 +0000
parents 21624831b427
children bb28a2d39639
files conversion/mri_to_minc/dicom_to_minc.pl
diffstat 1 files changed, 24 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/conversion/mri_to_minc/dicom_to_minc.pl
+++ b/conversion/mri_to_minc/dicom_to_minc.pl
@@ -383,8 +383,10 @@
         " -1 $cur_file" .
         " | extract_acr_nema -i " . 
         $specific_file_info{'pixel_data_group'} . " " .
-        $specific_file_info{'pixel_data_element'} . " " .
-        " | byte_swap ";
+        $specific_file_info{'pixel_data_element'} . " ";
+    if (!$Image_is_big_endian) {
+       $cmd .= " | byte_swap ";
+    }
 
     return $cmd;
 }
@@ -401,5 +403,25 @@
 *read_file_info = *dicom3_read_file_info;
 *get_image_cmd = *dicom3_get_image_cmd;
 
+# Check for dicom-specific arguments
+$Image_is_big_endian = 0;
+@args_to_remove = ();
+foreach $i (0..$#ARGV) {
+   $_ = $ARGV[$i];
+   if (/^-h(elp)?$/) {
+      warn 
+"Dicom-specific options:
+ -big_endian_image:\tSpecify that the image is big endian
+";
+   }
+   elsif (/^-big/ && (index("-big_endian_image",$_)==0)) {
+      $Image_is_big_endian = 1;
+      push(@args_to_remove, $i);
+   }
+}
+foreach $i (reverse(@args_to_remove)) {
+   splice(@ARGV, $i, 1);
+}
+
 &mri_to_minc(@ARGV);