summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMuQun Yang <ymuqun@hdfgroup.org>2001-02-16 03:35:37 (GMT)
committerMuQun Yang <ymuqun@hdfgroup.org>2001-02-16 03:35:37 (GMT)
commit5dc419551e3677f6b417ade268da3ee380245b75 (patch)
tree3e5ddb5d15da02e5b04cf0a1017f4d8beaa1f694 /tools
parenta7c25153bc0b6077613307afd90b6b98c4ebb194 (diff)
downloadhdf5-5dc419551e3677f6b417ade268da3ee380245b75.zip
hdf5-5dc419551e3677f6b417ade268da3ee380245b75.tar.gz
hdf5-5dc419551e3677f6b417ade268da3ee380245b75.tar.bz2
[svn-r3415]
Purpose: bug fix Description: two bugs: 1. different order of conventions of sds and image in hdf4 is considered at h4toh5image.c file. add palette colormodel attribute and correct names of a few attributes. see detail at: http://hdf.ncsa.uiuc.edu/HDF5/H5Image/ImageDetails.htm 2. convert hdf internal vdata structure(chunking table) into a new hdf5 dataset. Solution: 1. change h5 data space order for image. h5dims[0] = edge[1]-edge[0]; h5dims[1] = start[1]-start[0]; 2. at h4toh5main.c, check the vdata class name and if the first few characters match with HDF_CHK_TBL; ignore converting this vdata. 3. add a few attributes at h4toh5pal.c platforms: linux and sun 5.7(arabica) such as Big-endian-32bit (SUN/IRIX), little-endian-32(LINUX) and 64-bit (IRIX64/UNICOS/DEC-ALPHA) would be good.]
Diffstat (limited to 'tools')
-rw-r--r--tools/h4toh5image.c10
-rw-r--r--tools/h4toh5main.c27
-rw-r--r--tools/h4toh5pal.c15
3 files changed, 38 insertions, 14 deletions
diff --git a/tools/h4toh5image.c b/tools/h4toh5image.c
index c5bc1df..8fbbdc0 100644
--- a/tools/h4toh5image.c
+++ b/tools/h4toh5image.c
@@ -144,8 +144,14 @@ int Image_h4_to_h5(int32 file_id,int32 ri_id,hid_t h5_group,hid_t h5_palgroup) {
return FAIL;
}
- for (i=0;i<2;i++)
- h5dims[i] = edges[i]-start[i];
+ /* change the order of image dimension:
+ due to the difference of hdf4 image specification and
+ hdf5 image specification. */
+
+
+
+ h5dims[0] = edges[1]-start[1];
+ h5dims[1] = edges[0]-start[0];
gr_ref = GRidtoref(ri_id);
if(gr_ref == 0) {
diff --git a/tools/h4toh5main.c b/tools/h4toh5main.c
index 9881ce0..5e7c6d6 100644
--- a/tools/h4toh5main.c
+++ b/tools/h4toh5main.c
@@ -1100,7 +1100,25 @@ int h4toh5lonevds(int32 file_id, hid_t h5group){
/* Make sure this vdata is not an attribute of other hdf4 objects.*/
if(!VSisattr(vdata_id)) {
+
+ h4toh5_ZeroMemory(vdata_class,VGNAMELENMAX);
+ istat = VSgetclass(vdata_id,vdata_class);
+ if(istat == FAIL) {
+ printf("error in getting vdata class name.\n");
+ free(ref_vdata_array);
+ VSdetach(vdata_id);
+ return FAIL;
+ }
+
+
+ if(!strncmp(vdata_class,_HDF_CHK_TBL_CLASS,strlen(_HDF_CHK_TBL_CLASS))){
+
+ VSdetach(vdata_id);
+ continue;
+ }
+
vdata_ref = VSQueryref(vdata_id);
+
if(vdata_ref == FAIL) {
printf("error in getting vdata reference number.\n");
free(ref_vdata_array);
@@ -1116,17 +1134,10 @@ int h4toh5lonevds(int32 file_id, hid_t h5group){
return FAIL;
}
- h4toh5_ZeroMemory(vdata_class,VGNAMELENMAX);
- istat = VSgetclass(vdata_id,vdata_class);
- if(istat == FAIL) {
- printf("error in getting vdata class name.\n");
- free(ref_vdata_array);
- VSdetach(vdata_id);
- return FAIL;
- }
h4toh5_ZeroMemory(vdata_name,VGNAMELENMAX);
istat = VSQueryname(vdata_id,vdata_name);
+
if(istat == FAIL) {
printf("error in getting vdata name. \n");
free(ref_vdata_array);
diff --git a/tools/h4toh5pal.c b/tools/h4toh5pal.c
index 9fc1ec7..556ecdc 100644
--- a/tools/h4toh5pal.c
+++ b/tools/h4toh5pal.c
@@ -56,9 +56,10 @@ int Palette_h4_to_h5(int32 file_id,int32 pal_id,hid_t h5g,char*pal_name) {
size_t h4memsize;
size_t h4size;
- char palette_label[MAX_NC_NAME];
- char palette_class[MAX_NC_NAME];
- char palette_type[MAX_NC_NAME];
+ char palette_label[MAX_PAL_NAME];
+ char palette_class[MAX_PAL_NAME];
+ char palette_type[MAX_PAL_NAME];
+ char palette_colormodel[MAX_PAL_NAME];
hid_t h5memtype;
hid_t h5type;
@@ -143,7 +144,7 @@ int Palette_h4_to_h5(int32 file_id,int32 pal_id,hid_t h5g,char*pal_name) {
strcpy(palette_label,PALABEL);
strcpy(palette_class,PALETTE);
strcpy(palette_type,PAL_TYPE);
-
+ strcpy(palette_colormodel,RGB);
/* convert palette annotation into attribute of palette dataset.
Since there are no routines to find the exact tag of palette object,
we will check three possible object tags of palette objects, that is:
@@ -180,6 +181,12 @@ int Palette_h4_to_h5(int32 file_id,int32 pal_id,hid_t h5g,char*pal_name) {
return FAIL;
}
+ if(h4_transpredattrs(h5dset,PAL_COLORMODEL,palette_colormodel)==FAIL){
+ printf("unable to transfer palette type to HDF4 PALETTE TYPE.\n");
+ H5Sclose(h5d_sid);
+ H5Dclose(h5dset);
+ return FAIL;
+ }
if(h4_transnumattr(h5dset,HDF4_REF_NUM,pal_ref)==FAIL) {
printf("unable to transfer palette reference number to HDF4 REF. NUM.\n");
H5Sclose(h5d_sid);