Skip to main content

Reading and preprocessing x-ray projection data in Zeiss .txrm format

This package extends the dxchange reader to read the Zeiss proprietary data format .txrm to python lists or arrays. In particular, the import of metadata from the file headers is extended to access information needed for reconstructing x-ray projection data, e.g. acquired on Zeiss x-ray microscopes. Further, the package contains some simple functions to preprocess x-ray projections in preparation for reconstruction. These include flat field correction, revision of detector shifts, downsampling, conversion into line integral domain and truncation correction.

For installation, please run

conda install -c conda-forge dxchange
pip install xrmreader

This example code uses pyconrad for visualization.

import xrmreader
import pyconrad.autoinit
from edu.stanford.rsl.conrad.data.numeric import NumericGrid


projection_data = r'your_file.txrm'

metadata = xrmreader.read_metadata(projection_data)
print(metadata)

# load raw data
raw_projections = xrmreader.read_txrm(projection_data)
NumericGrid.from_numpy(raw_projections).show('Raw projections')

# preprocess data in individual steps
projections = xrmreader.read_txrm(projection_data)
projections = xrmreader.divide_by_reference(projections, metadata['reference'])
projections = xrmreader.revert_shifts(projections, metadata['x-shifts'], metadata['y-shifts'])
projections = xrmreader.downsample(projections, spatial_factor=2)
projections = xrmreader.negative_logarithm(projections)
projections = xrmreader.truncation_correction(projections)
NumericGrid.from_numpy(projections).show('Preprocessed projections version 1')

# load and preprocess data in one step (this does the same thing as the individual steps above, but needs less memory)
preprocessed_projections = xrmreader.read_and_preprocess_txrm(projection_data)
NumericGrid.from_numpy(preprocessed_projections).show('Preprocessed projections version 2')

As the reading functionality is modified from the dxchange project by De Carlo et al. (https://github.com/data-exchange/dxchange), we reproduce their copyright notice.

Copyright (c) 2016, UChicago Argonne, LLC. All rights reserved.

Copyright 2016. UChicago Argonne, LLC. This software was produced under U.S. Government contract DE-AC02-06CH11357 for Argonne National Laboratory (ANL), which is operated by UChicago Argonne, LLC for the U.S. Department of Energy. The U.S. Government has rights to use, reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR UChicago Argonne, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified to produce derivative works, such modified software should be clearly marked, so as not to confuse it with the version available from ANL.

Additionally, redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of UChicago Argonne, LLC, Argonne National Laboratory, ANL, the U.S. Government, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY UChicago Argonne, LLC AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UChicago Argonne, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

For the rest of the code, this applies.

Copyright (c) 2021 Mareike Thies

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Release files for xrmreader 2.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xrmreader 2.9.1
File Size Uploaded
xrmreader-2.9.1.tar.gz 15.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xrmreader 2.9.1
File Interpreter ABI Platform
xrmreader-2.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.8 kB

Release files / xrmreader-2.9.1.tar.gz

Download URL xrmreader-2.9.1.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cdc0106a17b838c34ded180368c9998496df513076f67bed2e87add90ed14ebf
BLAKE2b-256 checksum
How to use checksums
90d0397ec26615c1352342f5e70f0f0cc00323a1ecfc249b61dfcef63207c0a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.11

Release files / xrmreader-2.9.1-py3-none-any.whl

Download URL xrmreader-2.9.1-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f34ad3648fa24402c932e480a859dce0bb54d5f0acea491acf71406c7d1ecff1
BLAKE2b-256 checksum
How to use checksums
ccb08be3c08f976acf2828c0a646be4a2cceb3713e204bf19be6e42956d8432b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.11

Release history Release notifications | RSS feed

This release

2.9.1 This release

2 release files

2.9

2 release files

2.8

2 release files

2.7.1

2 release files

2.7

2 release files

2.6

2 release files

2.5

2 release files

2.4

2 release files

2.3

2 release files

2.2

2 release files

2.1

2 release files

2.0

2 release files

1.9

2 release files

1.8

2 release files

1.7

2 release files

1.6

2 release files

1.5

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page