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

SCM Repository

[diderot] View of /branches/lamont/test/reduction/readNrrd.c
ViewVC logotype

View of /branches/lamont/test/reduction/readNrrd.c

Parent Directory Parent Directory | Revision Log Revision Log

Revision 2534 - (download) (as text) (annotate)
Thu Jan 30 15:47:24 2014 UTC (5 years, 8 months ago) by lamonts
File size: 1095 byte(s)
Updating reduction testing
 * readNrrd.c 
 * Reads in a vec4 Nrrd! 

#include <stdlib.h> 
#include <stdio.h> 
#include <teem/nrrd.h> 
#include <assert.h>
#include <sys/sysctl.h>
#include <sys/stat.h>
void demoIO(char *filename); 

int main(void)
  return 0; 

void demoIO(char *filename) {
  char me[]="demoIO", *err;
  Nrrd *nin;

  /* create a nrrd; at this point this is just an empty container */
  nin = nrrdNew();

  /* read in the nrrd from file */
  if (nrrdLoad(nin, filename, NULL)) {
    err = biffGetDone(NRRD);
    fprintf(stderr, "%s: trouble reading \"%s\":\n%s", me, filename, err);

  /* say something about the array */
  printf("%s: \"%s\" is a %d-dimensional nrrd of type %d (%s)\n", 
         me, filename, nin->dim, nin->type,
         airEnumStr(nrrdType, nin->type));
  printf("%s: the array contains %d elements, each %d bytes in size\n",
         me, (int)nrrdElementNumber(nin), (int)nrrdElementSize(nin));
  float * data = (float *)nin->data;
    for(int i = 0; i < 1; i++){

ViewVC Help
Powered by ViewVC 1.0.0