Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis12/src/lib/common/image.c
ViewVC logotype

Diff of /branches/vis12/src/lib/common/image.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1977, Mon Jul 16 20:04:34 2012 UTC revision 1978, Sat Jul 21 16:19:40 2012 UTC
# Line 287  Line 287 
287  #undef I  #undef I
288  }  }
289    
 static void Error (WorldPrefix_t *wrld, const char *fmt, ...)  
 {  
     char buf[1024];  
     va_list ap;  
   
 // NOTE: if there was a biffMsg function that worked with va_lists, then we  
 // could avoid the buffer  
     va_start (ap, fmt);  
     vsnprintf (buf, sizeof(buf), fmt, ap);  
     va_end (ap);  
   
     biffMsgAdd(wrld->errors, buf);  
 }  
   
290  static Nrrd *LoadNrrdFile (WorldPrefix_t *wrld, const char *filename)  static Nrrd *LoadNrrdFile (WorldPrefix_t *wrld, const char *filename)
291  {  {
292    /* create a nrrd; at this point this is just an empty container */    /* create a nrrd; at this point this is just an empty container */
# Line 333  Line 319 
319  // FIXME: we should also be checking the shape of the voxels and the type of the samples.  // FIXME: we should also be checking the shape of the voxels and the type of the samples.
320    // check that the image format is what we expect    // check that the image format is what we expect
321      if (nin->spaceDim != 1) {      if (nin->spaceDim != 1) {
322          Error (wrld, "nrrd has unexpected dimension %d, expected 1\n", nin->spaceDim);          Diderot_Error (wrld, "nrrd has unexpected dimension %d, expected 1\n", nin->spaceDim);
323          return DIDEROT_FAIL;          return DIDEROT_FAIL;
324      }      }
325      else if (CheckAxis(nin, base)) {      else if (CheckAxis(nin, base)) {
326          Error (wrld, "nrrd has unexpected axis structure: %s\n",          Diderot_Error (wrld, "nrrd has unexpected axis structure: %s\n",
327              airEnumStr(nrrdKind, nin->axis[base].kind));              airEnumStr(nrrdKind, nin->axis[base].kind));
328          return DIDEROT_FAIL;          return DIDEROT_FAIL;
329      }      }
# Line 389  Line 375 
375    
376    // check that the image format is what we expect    // check that the image format is what we expect
377      if (nin->spaceDim != 2) {      if (nin->spaceDim != 2) {
378          Error (wrld, "nrrd has unexpected dimension %d, expected 2\n", nin->spaceDim);          Diderot_Error (wrld, "nrrd has unexpected dimension %d, expected 2\n", nin->spaceDim);
379          return DIDEROT_FAIL;          return DIDEROT_FAIL;
380      }      }
381      else if (CheckAxis(nin, base) || CheckAxis(nin, base+1)) {      else if (CheckAxis(nin, base) || CheckAxis(nin, base+1)) {
382          Error (wrld, "nrrd has unexpected axis structure: %s %s\n",          Diderot_Error (wrld, "nrrd has unexpected axis structure: %s %s\n",
383              airEnumStr(nrrdKind, nin->axis[base].kind),              airEnumStr(nrrdKind, nin->axis[base].kind),
384              airEnumStr(nrrdKind, nin->axis[base+1].kind));              airEnumStr(nrrdKind, nin->axis[base+1].kind));
385          return DIDEROT_FAIL;          return DIDEROT_FAIL;
# Line 462  Line 448 
448    
449    // check that the image format is what we expect    // check that the image format is what we expect
450      if (nin->spaceDim != 3) {      if (nin->spaceDim != 3) {
451          Error (wrld, "nrrd has unexpected dimension %d, expected 3\n", nin->spaceDim);          Diderot_Error (wrld, "nrrd has unexpected dimension %d, expected 3\n", nin->spaceDim);
452          return DIDEROT_FAIL;          return DIDEROT_FAIL;
453      }      }
454      else if (CheckAxis(nin, base) || CheckAxis(nin, base+1) || CheckAxis(nin, base+2)) {      else if (CheckAxis(nin, base) || CheckAxis(nin, base+1) || CheckAxis(nin, base+2)) {
455          Error (wrld, "nrrd has unexpected axis structure: %s %s %s\n",          Diderot_Error (wrld, "nrrd has unexpected axis structure: %s %s %s\n",
456              airEnumStr(nrrdKind, nin->axis[base].kind),              airEnumStr(nrrdKind, nin->axis[base].kind),
457              airEnumStr(nrrdKind, nin->axis[base+1].kind),              airEnumStr(nrrdKind, nin->axis[base+1].kind),
458              airEnumStr(nrrdKind, nin->axis[base+2].kind));              airEnumStr(nrrdKind, nin->axis[base+2].kind));

Legend:
Removed from v.1977  
changed lines
  Added in v.1978

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0