[MINC-development] minc2 compression - another bug under control
Claude LEPAGE
claude at bic.mni.mcgill.ca
Tue Apr 21 17:04:50 EDT 2009
Hi,
I isolated a bug about internal file compression in minc2. The bug
is fixed, but hasn't made it to cvs just yet (it will soon be). The
problem occurred when writing large volumes. For example, I had a
volume 361x433x361 (0.5mm) that would take 90 minutes to write to
disk. Painfully slow. After my fix, it takes 13 seconds to write
the file. The fix also has a positive effects with 4-D volumes.
Unfortunately, I haven't solved the problem of compression when
dimensions are reordered (mincreshape).
If you want to fix your local version of minc2 before the next
release, then change the following piece of code in
libsrc/hdf_convenience.c:
New code should look like (line 1345):
hsize_t val = 1;
int unit_size = nctypelen( vartype );
for( i = ndims-1; i >= 0; i-- ) {
if( MI_MAX_VAR_BUFFER_SIZE > dims[i] * val * unit_size ) {
chkdims[i] = dims[i];
} else {
chkdims[i] = MIN( dims[i],
(hsize_t)( MI_MAX_VAR_BUFFER_SIZE / ( val * unit_size ) ) );
}
val *= chkdims[i];
}
Notice the placement of the update of the variable val.
Enjoy!
Claude
More information about the MINC-development
mailing list