[cctbxbb] CBF compositing

Graeme.Winter at diamond.ac.uk Graeme.Winter at diamond.ac.uk
Mon Dec 3 06:43:28 PST 2012


Hi Frank,

OK, so we have done something recently which I think would be very similar, converting tiff files and "dat" files (don't ask) to full 'n' proper cbf files. It worked sensibly and would work in your case, but as you point out it would involve some post processing. In this example however the postprocessing was done by cbflib, which makes it a little more kosher.

In essence, the program does this:

 - read tiff files -> numpy arrays -> sum
 - read dat file
 - write cbf header with empty image using template and dat file contents
 - read / write this file through cbflib adding the image data in flight

You should be able to do this all in one go, looking at pycbf_test4.py in the new distribution of cbflib / pycbf, but you may find it a bit of a fiddle constructing the full cbf file ab initio.

Cheerio,

Graeme

-----Original Message-----
From: cctbxbb-bounces at phenix-online.org [mailto:cctbxbb-bounces at phenix-online.org] On Behalf Of Frank Murphy
Sent: 03 December 2012 13:19
To: cctbx mailing list
Subject: Re: [cctbxbb] CBF compositing

Graeme,

Unfortunately, my intent is to write out the image as a proper CBF. Your email is exactly correct, as I was at first quite happy to find how simple it was to add the images together, but then disappointed as I have struggled writing out a proper CBF in one step.

I, of course, can write the CBF out and then hack the header, but this wastes a lot of time, having to effectively write a CBF twice. I was able to write a header and CBF data separately and then concatenate them, but the header for the CBF data file needs edited...

Frank


On Dec 3, 2012, at 5:01 AM, <Graeme.Winter at diamond.ac.uk> wrote:

> Hi Frank,
> 
> It would be easy to write one, as pycbf is included in there as is some code to unpack the byte-offset compression quickly in iotbx.detectors -
> 
>    from iotbx.detectors import ImageFactory
> 
>    image = ImageFactory(filename)
>    image.read()
>    image.get_raw_data()
> 
> You would however need to create and pack the data to a new CBF file, which IIRC requires some new additions to the pycbf bindings - I asked Herbert B about this a while back and he needed to make some patches as it was not generally possible. That said, what I was after was creating a full cbf not e.g. miniCBF.
> 
> Adding the new version to a live version of cctbx/python is easy enough.
> 
> I take it as a given that this is for visualizing - you're not too worried about the image headers? Otherwise this will be somewhat more tricky.
> 
> Email from Herbert B follows. It went to the imgCIF mailing list so is public already :o)
> 
> Best wishes,
> 
> Graeme
> 
> -------------
> 
> 
> Dear Graeme,
> 
>   I have made a new example that uses setters and writes a byte-offset compressed image.  Testing revealed some bugs in the wrapper for some of the setters, so I have also updated the release kit.  The whole thing is  available on the  CBFlib_bleeding_edge svn on sourceforge as well as a release kit
> 
>   http://downloads.sf.net/cbflib/CBFlib-0.9.2.6.tar.gz
> 
> Please give it a try and take a look at pycbf/pycbf_test4.py for an example of writing a byte-offset CBF.  Let me know if it does what you need.  If not, tell me what is missing or wrong and I'll be happy to fix things and add more pycbf examples to the kit.
> 
>   Regards,
>     Herbert
> 
> P.S.  This was a very useful question because it relate to testing the HDF5 changes.
> 
> -----Original Message-----
> From: cctbxbb-bounces at phenix-online.org [mailto:cctbxbb-bounces at phenix-online.org] On Behalf Of Frank Murphy
> Sent: 01 December 2012 14:22
> To: cctbx mailing list
> Subject: [cctbxbb] CBF compositing
> 
> Hello,
> 
> Does anyone have a CCTBX-based method for compositing multiple CBFs to a single image a la merge2cbf?
> 
> Thanks in advance,
> Frank Murphy
> 
> 
> 
> _______________________________________________
> cctbxbb mailing list
> cctbxbb at phenix-online.org
> http://phenix-online.org/mailman/listinfo/cctbxbb
> 
> -- 
> This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
> Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. 
> Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
> Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
> 
> 
> 
> 
> _______________________________________________
> cctbxbb mailing list
> cctbxbb at phenix-online.org
> http://phenix-online.org/mailman/listinfo/cctbxbb

Frank Murphy
frankvmurphy at gmail.com



_______________________________________________
cctbxbb mailing list
cctbxbb at phenix-online.org
http://phenix-online.org/mailman/listinfo/cctbxbb

-- 
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. 
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
 





More information about the cctbxbb mailing list