Create a subtracted scattering profile

15 views
Skip to first unread message

孙亚平

unread,
Oct 10, 2024, 8:18:46 AM10/10/24
to BioXTAS RAW
Hello everyone, I can only find the code to create the subtracted scattering contour on the website, but now I want to get the image of the sample subtracted solution, what code can I use to achieve and get the subtracted tiff file?

Jesse Hopkins

unread,
Oct 10, 2024, 8:54:18 AM10/10/24
to BioXTAS RAW
Hi,

Unfortunately, RAW doesn’t natively support doing pixel by pixel subtraction from images. However, it would be pretty easy to use the API (https://bioxtas-raw.readthedocs.io/en/latest/api.html) to do this. If you load the images with RAW (https://bioxtas-raw.readthedocs.io/en/latest/api/main_api.html#bioxtasraw.RAWAPI.load_images) they will be returned as numpy arrays. Once you have the two arrays you can subtract them. It would look something like this:

import bioxtasraw.RAWAPI as raw
settings = raw.load_settings('./standards_data/SAXS.cfg')
buffer_images = ['./standards_data/GIbuf2_A9_18_001_0000.tiff',
    './standards_data/GIbuf2_A9_18_001_0001.tiff']
imgs = raw.load_and_integrate_images(buffer_images, my_settings)
sub_image = imgs[1]-imgs[0]


I hope that helps.

All the best.

- Jesse

----
Jesse Hopkins, PhD
Deputy Director
BioCAT, Sector 18
Advanced Photon Source

On Oct 10, 2024, at 3:59 AM, 孙亚平 <sunyap...@163.com> wrote:

Hello everyone, I can only find the code to create the subtracted scattering contour on the website, but now I want to get the image of the sample subtracted solution, what code can I use to achieve and get the subtracted tiff file?

--
You received this message because you are subscribed to the Google Groups "BioXTAS RAW" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bioxtas_raw...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bioxtas_raw/761aad18-5aa0-428a-8e0d-18da8f5209ban%40googlegroups.com.

Jesse Hopkins

unread,
Oct 10, 2024, 8:55:36 AM10/10/24
to BioXTAS RAW
Sorry, the fourth line of that code should have been:
imgs = raw.load_images(buffer_images, my_settings)

孙亚平

unread,
Oct 10, 2024, 9:54:52 PM10/10/24
to BioXTAS RAW
Thank you very much, but I would like to ask that the third and fourth lines need buffer images for everything, so the sample image, imgs refers to the sample image, does this string of code not use the sample image?

Jesse Hopkins

unread,
Oct 10, 2024, 10:05:07 PM10/10/24
to bioxt...@googlegroups.com
This is just an example I stole from the documentation. You will need to user filenames and paths that match whatever you have on your local system and the particular files you want to use. So you’ll need to change lines 2 and 3 at least.

All the best.

- Jesse

----
Jesse Hopkins, PhD
Deputy Director
BioCAT, Sector 18
Advanced Photon Source
Reply all
Reply to author
Forward
0 new messages