Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
βCITATION.cff file
Found CITATION.cff file -
βcodemeta.json file
Found codemeta.json file -
β.zenodo.json file
Found .zenodo.json file -
βDOI references
-
βAcademic publication links
-
βAcademic email domains
-
βInstitutional organization owner
-
βJOSS paper metadata
-
βScientific vocabulary similarity
Low similarity (13.7%) to scientific vocabulary
Keywords
Repository
π Tool to extract line profiles of edges
Basic Info
Statistics
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
- Releases: 1
Topics
Metadata Files
README.md
Fileswell [faΙͺlzΒ·wel]
Fileswell is a tool for extracting line profiles. It is therefore a profiler. A pro filer.
Installation
The package is not yet available on PyPI. You can install it from the source code by running the following command in the root directory of the repository:
bash
pip install .
Usage
The package provides two functions: load_imagej_rois and extract_line_profile.
load_imagej_rois can be used to load regions of interest (ROIs) that were selected
and saved using the ROI Manager in ImageJ/Fiji, either as a .roi file or as a .zip
file containing multiple .roi files.
```python from pathlib import Path
from fileswell import loadimagejrois, extractlineprofile
rois = loadimagejrois(Path("path/to/rois.zip")) # or .roi file
Select the roi you want to extract the line profile from
roi = rois[0] ```
If you don't have regions of interest (ROIs) saved in the ImageJ format, you can also manually create a ROI object from a set of coordinates:
```python import numpy as np
from fileswell import ROI
Coordinates in the form [[y1, x1], [y2, x2], ...]
coordinates = np.array([[0, 0], [0, 10], [10, 10], [10, 0]])
roi = ROI(coordinates) ```
Using the image and the selected ROI, you can extract the line profile using the
extract_line_profile function:
python
results = extract_line_profile(im, roi=roi)
The results are a dictionary containing the following keys:
- line_profile_mean: The mean line profile along the edge.
- line_profile_std: The standard deviation of the line profile along the edge.
- intensity_high_mean: The mean intensity in the high intensity region.
- intensity_high_std: The standard deviation of the intensity in the high intensity region.
- intensity_low_mean: The mean intensity in the low intensity region.
- intensity_low_std: The standard deviation of the intensity in the low intensity region.
API
extract_line_profile
``` Extract a line profile along an edge in an image.
This function extracts an averaged line profile along an edge in an image. It was first designed to extract line profiles from edges in CT slices of fairly homogenous materials. If there is a lot of noise, or the materials are very inhomogenous, it may not work so well.
The function works by segmenting the images into two regions, one with a high intensity and one with a low intensity. It then finds the edge between these two regions using a Canny edge detector. At each point on the edge it takes a line profile perpendicular to the edge, and then averages these line profiles.
Therefore, you need to supply a region-of-interest (ROI) that contains the edge you want to extract the line profile from, and some of the two regions surrounding that edge, but no other features.
If the image already contains nothing more than the edge and the two regions, you don't need to supply a ROI.
See also: https://stackoverflow.com/a/52020098 https://stackoverflow.com/q/37742358
Parameters
im : ndarray The image to extract the line profile from. edgewidth : int, optional (default=5) The estimated width of the edge, in pixels. For example, in a propagation-based phase-contrast CT slice, this would be the width of the phase fringes. Does not need to be exact. linelength : int, optional (default=10) The length of the line profile either side of the edge, in pixels. linewidth : int, optional (default=3) The width of each line profile, in pixels. roi : ROI, optional (default=None) The region-of-interest containing the edge and the two regions surrounding it. If None, the ROI is the whole image. smoothing : int, optional (default=2) Before thresholding, the image is smoothed using a median filter with size smoothing * edgewidth. The default of 2 should be sufficient for most images. threshmethod : str, optional (default='otsu') The method used to binary threshold the image. Supported methods are: - 'otsu': Otsu's method (default) - 'triangle': Triangle method - 'minimum': Minimum method - 'isodata': ISODATA method - 'li': Liβs iterative Minimum Cross Entropy method ax : array of matplotlib axes, optional (default=None) Needs to be a list or array of two matplotlib axes. The first axis will be used to show an image of the section of the image containing the edge and the line, with a sample of line profiles drawn on top. The second axis will be used to plot the line profiles. If None, no plots will be made. returnprofiles : bool, optional (default=False) Return the line profiles within the results. return_shifts : bool, optional (default=False) Return the profile shifts within the results.
Returns
dict A dictionary containing the following: - lineprofilemean: The mean line profile, averaged over all line profiles. - lineprofilestd: The standard deviation of the line profile, averaged over all line profiles. - intensityhighmean: The mean intensity of the high intensity region. - intensityhighstd: The standard deviation of the intensity of the high intensity region. - intensitylowmean: The mean intensity of the low intensity region. - intensitylowstd: The standard deviation of the intensity of the low intensity region. - lineprofiles: The individual line profiles, if returnprofiles is True. - shifts: The shifts of the line profiles, if return_shifts is True. ```
load_imagej_rois
``` Load ImageJ ROIs from a .roi or .zip (containing .roi files) file.
Parameters
path : Path The path to the .roi or .zip file.
Returns
list of ROI A list of ROI objects ```
ROI
``` A region-of-interest (ROI) defined by a set of coordinates.
Constructor parameters
coords : ndarray An Nx2 array of coordinates defining the ROI, with the first column being the y-coordinates and the second column being the x-coordinates.
Returns
ROI A ROI object. ```
Owner
- Name: Jannis Ahlers
- Login: jnahlers
- Kind: user
- Location: Melbourne
- Repositories: 1
- Profile: https://github.com/jnahlers
Medical physics PhD student at Monash University. Interested in cutting-edge X-ray imaging techniques.
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Ahlers"
given-names: "Jannis"
orcid: "https://orcid.org/0000-0003-0630-1819"
title: "fileswell"
version: 1.0.0
doi: 10.5281/zenodo.15469773
date-released: 2025-05-20
url: "https://github.com/jnahlers/fileswell"
preferred-citation:
type: article
authors:
- family-names: "Ahlers"
given-names: "Jannis"
orcid: "https://orcid.org/0000-0003-0630-1819"
- family-names: "D'Amico"
given-names: "Lorenzo"
orcid: "https://orcid.org/0000-0003-0299-3440"
- family-names: "Bast"
given-names: "Henriette"
orcid: "https://orcid.org/0009-0001-7390-1809"
- family-names: "Costello"
given-names: "Lucy"
orcid: "https://orcid.org/0009-0009-2666-7077"
- family-names: "Donnelley"
given-names: "Martin"
orcid: "https://orcid.org/0000-0002-5320-7756"
- family-names: "Alloo"
given-names: "Samantha"
orcid: "https://orcid.org/0000-0002-9502-6128"
- family-names: "Harker"
given-names: "Stephanie"
- family-names: "How"
given-names: "Ying Ying"
orcid: "https://orcid.org/0000-0001-8568-4736"
- family-names: "Croughan"
given-names: "Michelle"
orcid: "https://orcid.org/0000-0001-9345-2345"
- family-names: "Pollock"
given-names: "James"
orcid: "https://orcid.org/0000-0003-2594-9653"
- family-names: "Hausermann"
given-names: "Daniel"
orcid: "https://orcid.org/0009-0006-2878-307X"
- family-names: "Maksimenko"
given-names: "Anton"
- family-names: "Hall"
given-names: "Christopher"
orcid: "https://orcid.org/0000-0001-8691-7677"
- family-names: "Gureyev"
given-names: "Timur"
orcid: "https://orcid.org/0000-0002-1103-0649"
- family-names: "Nesterets"
given-names: "Yakov"
orcid: "https://orcid.org/0000-0002-0827-7261"
- family-names: "Kitchen"
given-names: "Marcus"
orcid: "https://orcid.org/0000-0002-0029-6660"
- family-names: "Pavlov"
given-names: "Konstantin"
orcid: "https://orcid.org/0000-0002-1756-4406"
- family-names: "Morgan"
given-names: "Kaye"
orcid: "https://orcid.org/0000-0001-6997-7977"
doi: "10.1038/s41598-025-14956-3"
title: "High-energy X-ray phase-contrast CT of an adult human chest phantom"
journal: "Scientific Reports"
volume: 15
start: 29314
year: 2025
GitHub Events
Total
- Release event: 1
- Push event: 2
- Create event: 1
Last Year
- Release event: 1
- Push event: 2
- Create event: 1
Dependencies
- matplotlib >=3.4.0
- natsort >=8.4.0
- numpy >=1.21.0
- roifile >=2024.9.15
- scikit-fda >=0.9.0
- scikit-image >=0.19.0
- scikit-learn ==1.4.0
- scipy >=1.7.0
- shapely >=1.8.0
- uncertainties >=3.2.0