changeset 2103:4cb3d0943711

properly initialize variable, also use _pet instead of _mri suffix for PET modality
author bert <bert>
date Fri, 13 May 2005 21:40:15 +0000
parents 9e3d2ff7925e
children b8cb66beeb20
files conversion/dcm2mnc/minc_file.c
diffstat 1 files changed, 19 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/conversion/dcm2mnc/minc_file.c
+++ b/conversion/dcm2mnc/minc_file.c
@@ -7,7 +7,10 @@
    @CREATED    : January 28, 1997 (Peter Neelin)
    @MODIFIED   : 
    * $Log: minc_file.c,v $
-   * Revision 1.6.2.1  2005-05-12 21:16:48  bert
+   * Revision 1.6.2.2  2005-05-13 21:40:15  bert
+   * properly initialize variable, also use _pet instead of _mri suffix for PET modality
+   *
+   * Revision 1.6.2.1  2005/05/12 21:16:48  bert
    * Initial checkin
    *
    * Revision 1.6  2005/04/29 23:09:06  bert
@@ -104,7 +107,7 @@
    software for any purpose.  It is provided "as is" without
    express or implied warranty.
 ---------------------------------------------------------------------------- */
-static const char rcsid[] = "$Header: /private-cvsroot/minc/conversion/dcm2mnc/minc_file.c,v 1.6.2.1 2005-05-12 21:16:48 bert Exp $";
+static const char rcsid[] = "$Header: /private-cvsroot/minc/conversion/dcm2mnc/minc_file.c,v 1.6.2.2 2005-05-13 21:40:15 bert Exp $";
 
 #include "dcm2mnc.h"
 
@@ -148,6 +151,7 @@
     char patient_name[256];
     char reg_time[256];
     char temp_str[256];
+    char suffix_str[256];
     const char *filename;
     int minc_clobber;
     int mincid, icvid;
@@ -231,8 +235,15 @@
         }
 
         /* Create file name */
-        /* changed by leili, omitted the scanner info, changed - to _ */
-        sprintf(temp_name, "%s%s_%s_%s_%s%s%s%s%s%s_mri.mnc", 
+
+        if (!strcmp(general_info->study.modality, MI_MRI)) {
+            strcpy(suffix_str, "_mri");
+        }
+        else if (!strcmp(general_info->study.modality, MI_PET)) {
+            strcpy(suffix_str, "_pet");
+        }
+
+        sprintf(temp_name, "%s%s_%s_%s_%s%s%s%s%s%s%s.mnc", 
                 full_path,
                 patient_name,
                 general_info->patient.reg_date,
@@ -242,7 +253,9 @@
                 scan_label[ECHO],
                 scan_label[TIME],
                 scan_label[PHASE],
-                scan_label[CHEM_SHIFT]);
+                scan_label[CHEM_SHIFT],
+                suffix_str);
+
         filename = temp_name;
 
         if (G.Debug) {
@@ -347,7 +360,7 @@
 static void 
 minc_set_spacing(int mincid, int varid, Mri_Index imri, General_Info *gi_ptr)
 {
-    double sum;                 /* Sum of differences for computing average */
+    double sum = 0.0;   /* Sum of differences for computing average */
     double avg;                 /* Average */
     double diff;                /* Difference between adjacent coordinates */
     double step;                /* Step size from widths */
@@ -375,7 +388,6 @@
 
         /* Now calculate the average value for the coordinate spacing.
          */
-        sum = 0.0;
         for (index = 1; index < length; index++) {
             sum += gi_ptr->coordinates[imri][index] - 
                 gi_ptr->coordinates[imri][index-1];