[Imgcif-l] Reading CBF files from Python

Nicholas K. Sauter nksauter at lbl.gov
Sun Jul 4 05:03:43 BST 2010


All,

OK, Graeme Winter's compress/uncompress routines are now checked in to 
the open source Computational Crystallography Toolbox, 
http://cctbx.sf.net.  They use the CBF byte-offset algorithm to convert 
an integer array to compressed string and vice versa.

A Python unit test to excercise the entire cycle is at 
cctbx_sources/cbflib_adaptbx/excercise_compression.py

Herbert---
You were right:  reading the entire compressed file directly into a 
memory buffer allows the decompression routine to operate much faster, 
compared with getc() or a smaller buffer.  2Kx2K files compress & 
uncompress in about 50 ms...faster than anything else I've seen!

Nick Sauter

Graeme.Winter at Diamond.ac.uk wrote:
> Hi Folks,
>
> In case anyone is interested, I coded up a pretty simple implementation
> of the byte offset compression and decompression in C++, with the
> interface
>
>   vector<char> compress(vector<int> data)
>   vector<int> uncompress(vector<char> packed)
>
> It could be useful for people wanting to "edit" images, which is what I
> had in mind. It's finding it's way into cctbx (thanks Nick!) but I will
> be happy to mail it out if anyone would like it.
>
> Best wishes,
>
> Graeme
>
>
>   
>   



More information about the imgcif-l mailing list