Closed nsouedet closed 3 years ago
Could you write a test program/script for this command and use case so that we know in the future when it works and when it breaks ? It will be useful to debug this issue too ;)
Hello Denis, Yes, I am going to do a use case and a script. My first tests let me think that writer is OK, but reader seems to be buggy (may be related to strides extended support). Are you able to reproduce the issue on your side ?
AimsVolumeExtract
did produce a file with the correct size, so I guess the problem is in memory allocation for 4D (or more) volumes. Probably in the recent changes I did, so I guess it's my fault. I'm trying with 5.0 also...
For me 5.0 is OK
That's it: brainvisa 5.0 reads the file correctly, so the bug is in new modifs in master, and not in AimsVolumeExtract
. I'll check that.
Yes doing a read from 5.0 of a file writen with master version is also OK, that's why I said that the issue is related to master reader changes.
Thanks a lot
You are right, the issue is more general and is not related to unallocated date. It is related to 4D (or more) data.
The 3D case is OK
from soma import aims
# 3D data
v = aims.Volume_FLOAT(512,256,1)
aims.write(v, '/tmp/test_3d.ima') # Write is OK
v = aims.read('/tmp/test_3d.ima') # Read is OK
print('3D test is ok')
Whereas the 4D case fails
# 4D data
v = aims.Volume_FLOAT(512,256,1, 2)
aims.write(v, '/tmp/test_4d.ima') # Write is OK
v = aims.read('/tmp/test_4d.ima') # Read fails
print('4D test is ok')
In the 4D case, at reading, the following messages are displayed (8 times the same message):
readBlock( failed at ( 0,65,0,1) : 408 != 512
readBlock( failed at ( 0,65,0,1) : 408 != 512
readBlock( failed at ( 0,65,0,1) : 408 != 512
readBlock( failed at ( 0,65,0,1) : 408 != 512
readBlock( failed at ( 0,65,0,1) : 408 != 512
readBlock( failed at ( 0,65,0,1) : 408 != 512
readBlock( failed at ( 0,65,0,1) : 408 != 512
readBlock( failed at ( 0,65,0,1) : 408 != 512
it's in the allocate() method, there is a bug in the calculation of the volume size with/without strides. I'm fixing that.
Fine, thanks a lot !
Following commands does not seem to work correctly anymore :
A segmentation fault occurs when trying to read the writen /tmp/test.ima file :