0
$\begingroup$

We collected electron diffraction data and converted the data into .cbf (Crystallographic Binary File). Those are about 10'000 files. Now I would like to convert the .cbf into an image format like .tif but with a specified dynamic range.

I tried it with fabIO which is a python module. But I could not figure out how to successfully convert .cbf into .tif. .edf worked but it's not the desired format. Also I don't know how to pick the dynamic range.

Maybe it is possible to use Adxv in the command line? I've been using it to export .tif but was only able to do so one by one.

What follows is my python script to convert .cbf into .edf:

import os
from glob import glob
import fabio

path = '/Users/myuser/Documents/Crystals'

result = [y for x in os.walk(path) for y in glob(os.path.join(x[0], '*.cbf'))]

i = 0
text = ''
while i < len(result):

    if i == 4000:
        image = fabio.open(result[i])
        image.convert("edf").save("4000.edf")

    i += 1

Do you know how to use fabIO in order to export .tif with specific dynamic range? Or do you maybe know how to use Adxv in the command line in order to process many images? Or maybe you have another solution?

$\endgroup$

1 Answer 1

0
$\begingroup$
import os
from glob import glob
import fabio

path = '/Users/myuser/Documents/Crystals'

result = [y for x in os.walk(path) for y in glob(os.path.join(x[0], '*.cbf'))]

i = 0
command = ''
while i < len(result):

    path = os.path.dirname(result[i])
    filename = os.path.splitext(result[i])[0]+'.tif'

    command = '/Applications/Adxv.app/Contents/MacOS/Adxv -smv32bits -sa -overload 500 '+result[i]+' '+filename
    os.system(command)

    i += 1

In the end I figured it out using Adxv in stand alone -sa and -overload N as dynamic range.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.