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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
#include <stdio.h>
#include "minc2.h"
#define TESTRPT(msg, val) (error_cnt++, fprintf(stderr, \
"Error reported on line #%d, %s: %d\n", \
__LINE__, msg, val))
static int error_cnt = 0;
int main(int argc, char **argv)
{
mihandle_t vol;
mivolumeprops_t props;
int r;
micompression_t compression_type;
miboolean_t enable_flag;
int zlib_level;
int depth;
int edge_lengths[MI2_MAX_VAR_DIMS];
int edge_count;
int i;
r = minew_volume_props(&props);
if (r < 0) {
TESTRPT("failed", r);
}
r = miset_props_multi_resolution(props, 1 , 2);
if (r < 0) {
TESTRPT("failed", r);
}
r = miget_props_multi_resolution(props, &enable_flag, &depth);
if (r < 0) {
TESTRPT("failed", r);
}
else {
printf("Multiresolution enabled: %d depth: %d \n", enable_flag, depth);
}
r = miset_props_compression_type(props, MI_COMPRESS_NONE);
if (r < 0) {
TESTRPT("failed", r);
}
else {
printf("Set compression type to %d\n", MI_COMPRESS_NONE);
}
r = miget_props_compression_type(props,&compression_type);
if (r < 0 || compression_type != MI_COMPRESS_NONE) {
TESTRPT("failed", r);
}
else {
printf("Got compression type %d \n", compression_type);
}
r = miset_props_zlib_compression(props,4);
if (r < 0) {
TESTRPT("failed", r);
}
else {
printf("Set zlib level to %d\n", 4);
}
r = miget_props_zlib_compression(props,&zlib_level);
if (r < 0 || zlib_level != 4) {
TESTRPT("failed", r);
}
else {
printf("Got zlib level %d \n", zlib_level);
}
mifree_volume_props(props);
while (--argc > 0) {
r = miopen_volume(*++argv, MI2_OPEN_RDWR, &vol);
if (r < 0) {
TESTRPT("failed", r);
}
r = miget_volume_props(vol, &props);
if (r < 0) {
TESTRPT("failed", r);
}
r = miget_props_blocking(props, &edge_count, edge_lengths,
MI2_MAX_VAR_DIMS);
if (r < 0) {
TESTRPT("failed", r);
}
printf("edge_count %d\n", edge_count);
for (i = 0; i < edge_count; i++) {
printf(" %d", edge_lengths[i]);
}
printf("\n");
mifree_volume_props(props);
miclose_volume(vol);
}
if (error_cnt != 0) {
fprintf(stderr, "%d error%s reported\n",
error_cnt, (error_cnt == 1) ? "" : "s");
}
else {
fprintf(stderr, "No errors\n");
}
return (error_cnt);
}
|