changeset 2493:aaf8cc96fda0

fix a bug in output_mnc.c for output buffers for a slice
author claude <claude>
date Fri, 06 Nov 2009 18:51:14 +0000 (2009-11-06)
parents 8512aa0133ab
children 04d0fb05f230
files ChangeLog NEWS volume_io/Volumes/output_mnc.c
diffstat 3 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2009-11-06 Claude Lepage <claude@bic.mni.mcgill.ca>
+	* volume_io/Volumes/output_mnc.c: fix output buffers for a slice
+          as only first buffer would be written out
 
 2009-08-11 Andrew L Janke <a.janke@gmail.com>
 	* progs/mincpik/mincpik: Added taking first time point for 4D files
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+* volume_io/Volumes/output_mnc.c: fix output buffers for a slice
+  as only first buffer would be written out
 
 * Fixed bug in multidim_array_is_alloced for correct check of
   memory allocation of image data. Return volume=NULL when memory
--- a/volume_io/Volumes/output_mnc.c
+++ b/volume_io/Volumes/output_mnc.c
@@ -1424,7 +1424,8 @@
       count[d] = 1;
       file_indices[d] = file_start[d];
       if( to_volume_index[d] != INVALID_AXIS ) {
-        if( MI_MAX_VAR_BUFFER_SIZE > volume_count[to_volume_index[d]] * slab_size * unit_size ) {
+        if( MI_MAX_VAR_BUFFER_SIZE > volume_count[to_volume_index[d]] * slab_size * unit_size 
+            && n_steps == 1 ) {
           count[d] = volume_count[to_volume_index[d]];
           file->n_slab_dims++;  /* integral number of complete dimensions */
         } else {
@@ -1494,6 +1495,12 @@
 
     terminate_progress_report( &progress );
 
+    if( step != n_steps ) {
+      fprintf( stderr, "Error: Your output minc file may be incomplete\n" );
+      fprintf( stderr, "(wrote only %d out of %d buffers)\n", step, n_steps );
+      exit(1);
+    }
+
     return( OK );
 }