[MINC-users] pyminc and hdf5

Andrew Wood andrew at biospective.com
Wed Apr 4 11:15:46 EDT 2012


Hi Mishkin,

I can reproduce your error with my HDF5 build. I've seen similar failures
before which I suspected were
related to negative dimension lengths. This failure may be related to the
negative dimension lengths given
to this volume in the past:

[02] Wed Jun 23 13:25:44 2010>>> mincreshape -clobber -dimorder \
     zspace,yspace,xspace -dimsize xspace=-1 -dimsize yspace=-1 -dimsize \
     zspace=-1 -dimrange zspace=0,192 \
     CLMS_001-MNI-5_amc_018_m00_t1g_original.mnc.gz \
      CLMS_001-MNI-5_amc_018_m00_t1g.mnc

It looks like you can workaround the problem by running the volume through
mincresample:

$ mincresample -xnelements 192 -znelements 192 -ynelements 256 original.mnc
resampled_positive.mnc
$ mincdiff -body original.mnc resampled_positive.mnc
Binary image comparison:
Images are identical.

$ ./Mishkin_copy.py original.mnc broken_copy.mnc
# fails with some HDF5 builds

$ ./Mishkin_copy.py resampled_positive.mnc working_copy.mnc
# works

Note you'll need to change to volumeFromInstance(inputfilename,
outputfilename, data=True)
to copy the data in addition to the shape and type.


Regards,
Andrew


On Tue, Apr 3, 2012 at 10:00 AM, Leila Baghdadi
<baghdadi at phenogenomics.ca>wrote:

> Hi Mishkin,
>
> I suspect this is a problem with the hdf5 installation on your machine and
> not pyminc.
>
> I just downloaded your file and it runs file on my machine (ubuntu Lucid),
> libhdf5-serial 1.8.4-5
>
> baghdadi at mouse30:/projects/souris/baghdadi$ python
> Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
> [GCC 4.4.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from pyminc.volumes.factory import *
> >>> infile=volumeFromFile('/micehome/baghdadi/t1.minc2.posdir.mnc')
> >>>
> outfile=volumeLikeFile('/micehome/baghdadi/t1.minc2.posdir.mnc','/micehome/baghdadi/copy.mnc')
> >>> outfile.writeFile()
> >>> outfile.closeVolume()
> >>> infile.closeVolume()
>
>
> Leila
>
> ----- Original Message -----
> From: Mishkin Derakhshan <mishkind at gmail.com>
> Sent: Mon, 4/2/2012 6:50pm
> To: MINC users mailing list <minc-users at bic.mni.mcgill.ca>
> Subject: [MINC-users] pyminc and hdf5
>
> Hi,
>
> I am getting this HDF5 warning/error when I try to run a very simple
> python program using pyminc:
>
> The minimal program that creates the error:
> #! /usr/bin/python
> import pyminc.volumes.factory as pyminc
> inputfilename = "t1.minc2.posdir.mnc"
> outputfilename = "copy.mnc"
> infile = pyminc.volumeFromFile(inputfilename)
> outfile = pyminc.volumeLikeFile(inputfilename, outputfilename)
> outfile.writeFile()
> outfile.closeVolume()
> infile.closeVolume()
>
> The error:
> HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) thread 0:
>  #000: ../../../src/H5T.c line 2120 in H5Tset_size(): size must be positive
>    major: Invalid arguments to routine
>    minor: Bad value
> HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) thread 0:
>  #000: ../../../src/H5T.c line 2120 in H5Tset_size(): size must be positive
>    major: Invalid arguments to routine
>    minor: Bad value
> HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) thread 0:
>  #000: ../../../src/H5T.c line 2120 in H5Tset_size(): size must be positive
>    major: Invalid arguments to routine
>    minor: Bad value
>
> The error with PYMINCDEBUG set:
>
> HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) thread 0:
>  #000: ../../../src/H5T.c line 2120 in H5Tset_size(): size must be positive
>    major: Invalid arguments to routine
>    minor: Bad value
> HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) thread 0:
>  #000: ../../../src/H5T.c line 2120 in H5Tset_size(): size must be positive
>    major: Invalid arguments to routine
>    minor: Bad value
> HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) thread 0:
>  #000: ../../../src/H5T.c line 2120 in H5Tset_size(): size must be positive
>    major: Invalid arguments to routine
>    minor: Bad value
> sizes [192, 256, 192]
> separations [0.999999999999998, 1.0, 1.0]
> starts [-103.827645851979, -111.44957556808501, -84.49910974372]
> dimnames: ['zspace', 'yspace', 'xspace']
> sizes [192, 256, 192]
> separations [0.999999999999998, 1.0, 1.0]
> starts [-103.827645851979, -111.44957556808501, -84.49910974372]
> dimnames: ['zspace', 'yspace', 'xspace']
> 0 48381856 c_void_p(48388544) zspace
> 0 48384368 c_void_p(48388752) yspace
> 0 48384624 c_void_p(48388960) xspace
> 3 [48388544, 48388752, 48388960]
> sizes [192, 256, 192]
> setting data
> New Shape: (192, 256, 192)
> TYPE: short float64
> TYPE: int float64
> TYPE: double float64
> before setting of hyperslab
> after setting of hyperslab
>
> Sample input file that gives the error:
> http://www.bic.mni.mcgill.ca/users/mishkin/files/t1.minc2.posdir.mnc
>
> I only get the error for my own acquired data, but using something
> like the icbm_152 volume I don't get the error. I've looked for
> anything funny about my sample input file but haven't spotted
> anything. Perhaps someone who understands the HDF5 error a bit better
> can help?
>
> thanks,
> mishkin
> _______________________________________________
> MINC-users at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
> _______________________________________________
> MINC-users at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>


More information about the MINC-users mailing list