changeset 2231:9a589483820b

Fix handling of single-frame files
author bert <bert>
date Mon, 05 Dec 2005 16:44:00 +0000
parents af300b590479
children 19861f2c6d8c
files conversion/micropet/upet2mnc.c
diffstat 1 files changed, 18 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/conversion/micropet/upet2mnc.c
+++ b/conversion/micropet/upet2mnc.c
@@ -650,7 +650,6 @@
         }
     }
 
-
     fclose(ci.hdr_fp);
     fclose(ci.img_fp);
     miclose(ci.mnc_fd);
@@ -672,6 +671,8 @@
         return (-1);
     }
 
+    ncopts = 0;
+
     /* Set the dimension names.  This is done here since the correct 
      * arrangement depends on the value of _orient_flag 
      */
@@ -925,25 +926,22 @@
 create_dimension(struct conversion_info *ci_ptr, int index, int length)
 {
     ci_ptr->dim_lengths[index] = length;
-    if (length > 1) {
-        ci_ptr->dim_ids[index] = ncdimdef(ci_ptr->mnc_fd, 
-                                          _dimnames[index], 
-                                          length);
-        if (index != DIM_W) {
-            if (index == DIM_T) {
-                micreate_std_variable(ci_ptr->mnc_fd, _dimnames[index], 
-                                      NC_DOUBLE, 1, &ci_ptr->dim_ids[index]);
-                micreate_std_variable(ci_ptr->mnc_fd, MItime_width, 
-                                      NC_DOUBLE, 1, &ci_ptr->dim_ids[index]);
-            }
-            else {
-                micreate_std_variable(ci_ptr->mnc_fd, _dimnames[index], 
-                                      NC_DOUBLE, 0, NULL);
-            }
-        }
+    if (index == DIM_W && length <= 1) {
+        return;
     }
-    else {
-        ci_ptr->dim_ids[index] = -1;
+
+    ci_ptr->dim_ids[index] = ncdimdef(ci_ptr->mnc_fd, 
+                                      _dimnames[index], 
+                                      length);
+    if (index == DIM_T) {
+        micreate_std_variable(ci_ptr->mnc_fd, _dimnames[index], 
+                              NC_DOUBLE, 1, &ci_ptr->dim_ids[index]);
+        micreate_std_variable(ci_ptr->mnc_fd, MItime_width, 
+                              NC_DOUBLE, 1, &ci_ptr->dim_ids[index]);
+    }
+    else if (index != DIM_W) {
+        micreate_std_variable(ci_ptr->mnc_fd, _dimnames[index], 
+                              NC_DOUBLE, 0, NULL);
     }
 }
 
@@ -1524,3 +1522,4 @@
     ncvarput(ci_ptr->mnc_fd, ncvarid(ci_ptr->mnc_fd, MIimage), start, count, 
              ci_ptr->frame_buffer);
 }
+