331 |
// compute the offset to the first space axis |
// compute the offset to the first space axis |
332 |
int base = nin->dim - nin->spaceDim; |
int base = nin->dim - nin->spaceDim; |
333 |
|
|
334 |
// FIXME: we should also be checking the size of the axes, the shape of the voxels, |
// FIXME: we should also be checking the shape of the voxels and the type of the samples. |
|
// and the type of the samples. |
|
335 |
// check that the image format is what we expect |
// check that the image format is what we expect |
336 |
if (nin->spaceDim != 1) { |
if (nin->spaceDim != 1) { |
337 |
fprintf(stderr, "nrrd file \"%s\" has unexpected dimension %d, expected 1\n", |
fprintf(stderr, "nrrd file \"%s\" has unexpected dimension %d, expected 1\n", |
349 |
img->dim = 1; |
img->dim = 1; |
350 |
img->size[0] = nin->axis[base+0].size; |
img->size[0] = nin->axis[base+0].size; |
351 |
img->data = nin->data; |
img->data = nin->data; |
352 |
|
// FIXME: this code probably only works for scalar images |
353 |
|
img->dataSzb = nrrdElementSize(nin) * nrrdElementNumber(nin) * img->size[0]; |
354 |
|
|
355 |
//printf("LoadImage \"%s\": space dim = 1, axes = <%d>\n", |
//printf("LoadImage \"%s\": space dim = 1, axes = <%d>\n", |
356 |
//name, img->size[base+0]); |
//name, img->size[base+0]); |
393 |
img->size[0] = nin->axis[base+0].size; |
img->size[0] = nin->axis[base+0].size; |
394 |
img->size[1] = nin->axis[base+1].size; |
img->size[1] = nin->axis[base+1].size; |
395 |
img->data = nin->data; |
img->data = nin->data; |
396 |
|
// FIXME: this code probably only works for scalar images |
397 |
|
img->dataSzb = nrrdElementSize(nin) * nrrdElementNumber(nin) * img->size[0] * img->size[1]; |
398 |
|
|
399 |
//printf("LoadImage \"%s\": space dim = 2, axes = <%d, %d>\n", |
//printf("LoadImage \"%s\": space dim = 2, axes = <%d, %d>\n", |
400 |
//name, img->size[0], img->size[1]); |
//name, img->size[0], img->size[1]); |
457 |
img->size[1] = nin->axis[base+1].size; |
img->size[1] = nin->axis[base+1].size; |
458 |
img->size[2] = nin->axis[base+2].size; |
img->size[2] = nin->axis[base+2].size; |
459 |
img->data = nin->data; |
img->data = nin->data; |
460 |
|
// FIXME: this code probably only works for scalar images |
461 |
|
img->dataSzb = nrrdElementSize(nin) * nrrdElementNumber(nin) * img->size[0] * img->size[1] * img->size[2]; |
462 |
|
|
463 |
//printf("LoadImage \"%s\": space dim = 3, axes = <%d, %d, %d>\n", |
//printf("LoadImage \"%s\": space dim = 3, axes = <%d, %d, %d>\n", |
464 |
//name, img->size[0], img->size[1], img->size[2]); |
//name, img->size[0], img->size[1], img->size[2]); |