Hi Mathieu,

As Anthony indicates, it's hard to discern the exact issue when you don't 
provide much in the way of code to look at.

If it helps, here is an example of creating a HDF5 file with a float32 array of 
the dimensions you specified. The shape value should be a tuple.

>>> import numpy as np
>>> import tables
>>> x = np.random.random((121,145,121))
>>> x.shape
(121, 145, 121)
>>> f = tables.openFile('patient.h5', 'w')
>>> atom = tables.Float32Atom()
>>> image1 = f.createCArray(f.root, 'image1', atom, x.shape)
>>> image1[:] = x
>>> f.close()

You could have an HDF5 file per patient and keep the three float32 arrays and 
the CSV data as separate nodes.

I would suggest that you have the HDF5 structure and resulting PyTables code 
worked out before thinking about how to wrap it in an object.

Cheers, Tim 


On 05/07/2013, at 7:13 AM, Mathieu Dubois <duboismathieu_g...@yahoo.fr> wrote:

> Hello,
> 
> I'm a beginner with Pyable.
> 
> I wanted to store a database in a HDF5 file using PyTable. The DB is 
> made by a CSV file (which contains the subject information) and a lot of 
> images (I work on MRI so the images are 3 dimensional float32 arrays of 
> shape (121, 145, 121)). The relation is very simple: there are a 3 
> images per subject.
> 
> My first idea was to create a class  Subject like this:
> class Subject(tables.IsDescription):
>     # Subject information
>     Id           = tables.UInt16Col()
>     ...
>     Image    = tables.Float32Col(shape=IMAGE_SIZE)
> 
> And the proceed like in the tutorial (open a file, create a group and a 
> table associated to the Subject class and then append data to this table).
> 
> Unfortunately I got an error when creating the table (even before 
> inserting data):
> HDF5-DIAG: Error detected in HDF5 (1.8.4-patch1) thread 140612945950464:
>   #000: ../../../src/H5Ddeprec.c line 170 in H5Dcreate1(): unable to 

<snip>


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to