File: slice-test.c

package info (click to toggle)
minc 2.1.10-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 8,160 kB
  • sloc: ansic: 82,507; sh: 10,666; yacc: 1,187; perl: 612; makefile: 586; lex: 319
file content (41 lines) | stat: -rw-r--r-- 806 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <stdio.h>
#include <stdlib.h>
#include "minc2.h"

int
main(int argc, char **argv)
{
    mihandle_t hvol;
    int r;
    unsigned long coords[3];
    double min, max;
    int i;

    while (--argc > 0) {
	r = miopen_volume(*++argv, MI2_OPEN_READ, &hvol);
	if (r < 0) {
	    fprintf(stderr, "can't open %s, error %d\n", *argv, r);
	}
	else {
	    for (i = 0; i < 10; i++) {
		coords[0] = i;
		coords[1] = rand();
		coords[2] = rand();

		r = miget_slice_min(hvol, coords, 3, &min);
		if (r < 0) {
		    fprintf(stderr, "error %d getting slice minimum\n", r);
		}

		r = miget_slice_max(hvol, coords, 3, &max);
		if (r < 0) {
		    fprintf(stderr, "error %d getting slice maximum\n", r);
		}
		printf("%d. min %f max %f\n", i, min, max);
	    }
	    miclose_volume(hvol);
	}
    }
    return (0);
}