Mercurial > hg > minc-tools
changeset 1721:ea9505f4d1f5
Revise miselect_resolution() to actually swap the open datasets
author | bert <bert> |
---|---|
date | Mon, 29 Mar 2004 22:06:53 +0000 |
parents | d6d963b34c9b |
children | f512ca3023db |
files | libsrc2/volprops.c |
diffstat | 1 files changed, 25 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libsrc2/volprops.c +++ b/libsrc2/volprops.c @@ -201,6 +201,7 @@ miselect_resolution(mihandle_t volume, int depth) { hid_t grp_id; + char path[MI2_MAX_PATH]; if ( volume->hdf_id < 0 || depth > MAX_RESOLUTION_GROUP || depth < 0) { return (MI_ERROR); @@ -213,16 +214,36 @@ Make sure the selected resolution does exist. */ if (depth > volume->create_props->depth) { - printf(" THIS RESOLUTION DOES NOT EXIST!!! \n"); - return (0); + return (MI_ERROR); } - else { + else if (depth != 0) { if (minc_update_thumbnail(volume, grp_id, 0, depth) < 0) { return (MI_ERROR); } } - return (MI_NOERROR); + volume->selected_resolution = depth; + + if (volume->image_id >= 0) { + H5Dclose(volume->image_id); + } + sprintf(path, "%d/image", depth); + volume->image_id = H5Dopen(grp_id, path); + + if (volume->volume_class == MI_CLASS_REAL) { + if (volume->imax_id >= 0) { + H5Dclose(volume->imax_id); + } + sprintf(path, "%d/image-max", depth); + volume->imax_id = H5Dopen(grp_id, path); + + if (volume->imin_id >= 0) { + H5Dclose(volume->imin_id); + } + sprintf(path, "%d/image-min", depth); + volume->imin_id = H5Dopen(grp_id, path); + } + return (MI_NOERROR); } /*! Compute all resolution