[MINC-development] using milist_grp_next

Soren Christensen sorench at gmail.com
Tue Apr 14 08:42:39 EDT 2009


Hi all,
Please let me know if this belongs in minc-users rather than here.
 I am trying to learn how to use the minc2 api but got stuck
attempting to iterate through the groups and attributes of a minc2
file. Admitted my C skills need a little work too, that may well be
the problem.
I am building on one of the tutorials and get an error from the below code:

#include <minc2.h>
#include <stdio.h>

int main(int argc, char **argv) {
  mihandle_t    minc_volume;
  milisthandle_t milisthandle;
  int           result;
  char          mystr[255];
  int           maxpath;

  result = miopen_volume(argv[1], MI2_OPEN_READ, &minc_volume);

  if (result != MI_NOERROR) {
    fprintf(stderr, "Error opening input file: %d.\n", result);
  }

  result = milist_start ( minc_volume,"/",1,&milisthandle);

  if (result != MI_NOERROR) {
    fprintf(stderr, "Error querying input file: %d.\n", result);
  }

  result = milist_grp_next  (milisthandle, mystr,maxpath);

  if (result != MI_NOERROR) {
    fprintf(stderr, "Error in reading group: %d.\n", result);
  }



  return(0);
}



./prog minc2.mnc

gives:
HDF5-DIAG: Error detected in HDF5 library version: 1.6.1 thread 0.
Back trace follows.
  #000: H5G.c line 296 in H5Gopen(): unable to open group
    major(10): Symbol table layer
    minor(52): Can't open object
  #001: H5G.c line 1888 in H5G_open(): not found
    major(10): Symbol table layer
    minor(40): Object not found
  #002: H5G.c line 1945 in H5G_open_oid(): not a group
    major(10): Symbol table layer
    minor(52): Can't open object
  #003: H5O.c line 1467 in H5O_read(): unable to load object header
    major(12): Object header layer
    minor(22): Read failed
  #004: H5O.c line 1528 in H5O_read_real(): unable to find message in
object header
    major(12): Object header layer
    minor(40): Object not found
  #005: H5O.c line 1609 in H5O_find_in_ohdr(): unable to find object
header message
    major(12): Object header layer
    minor(40): Object not found



Could someone give me a hint as to what I am doing wrong? From what I
can see in the unit test the syntax seems much the same.


Thanks in advance,
Soren


The file should be ok btw:
h5dump -H minc2.mnc  | grep 'GROUP\|DATASET'
GROUP "/" {
   GROUP "minc-2.0" {
      GROUP "dimensions" {
         DATASET "xspace" {
         DATASET "yspace" {
         DATASET "zspace" {
      GROUP "image" {
         GROUP "0" {
            DATASET "image" {
            DATASET "image-max" {
            DATASET "image-min" {
      GROUP "info" {
         DATASET "dicom_0x0002" {
         DATASET "dicom_0x0008" {
         DATASET "dicom_0x0010" {
         DATASET "dicom_0x0018" {
         DATASET "dicom_0x0019" {
         DATASET "dicom_0x0020" {
         DATASET "dicom_0x0028" {
         DATASET "dicom_0x0040" {
         DATASET "study" {


More information about the MINC-development mailing list