Skip to content

Commit

Permalink
renaming of project due to pypi availability. Implementation of multi…
Browse files Browse the repository at this point in the history
…processing of feature extraction.
  • Loading branch information
RichardObi committed Apr 30, 2024
1 parent 3a21d30 commit 6464757
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 172 deletions.
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!---[![PyPI](https://img.shields.io/pypi/v/frd.svg)](https://pypi.org/project/frd/)--->
<!---[![PyPI](https://img.shields.io/pypi/v/frd-score.svg)](https://pypi.org/project/frd-score/)--->

# Fréchet Radiomics Distance (FRD)

Expand All @@ -18,11 +18,11 @@ In general, the variability (e.g. measured via FRD) of imaging biomarkers (e.g.

## Installation

<!--- Install from [pip](https://pypi.org/project/frd/): --->
<!--- Install from [pip](https://pypi.org/project/frd-score/): --->
Install frd:

```
pip install git+https://github.com/RichardObi/frd
pip install frd-score
```

Requirements:
Expand All @@ -41,23 +41,23 @@ Requirements:

To compute the FID score between two datasets, where images of each dataset are contained in an individual folder:
```
python -m frd path/to/dataset_A path/to/dataset_B
python -m frd_score path/to/dataset_A path/to/dataset_B
```

If you would like to use masks to localize radiomics features, you can provide the path to the masks as follows:
```
python -m frd path/to/dataset_A path/to/dataset_B -M path/to/mask_A path/to/mask_B
python -m frd_score path/to/dataset_A path/to/dataset_B -M path/to/mask_A path/to/mask_B
```

### Run in your code:
If you would like to import frd as a module, you can use the following code snippet:
```
from frd import frd_score
from frd_score import frd
paths=['path/to/dataset_A', 'path/to/dataset_B']
paths_masks=[path_mask_A, path_mask_B] # optionally, we can add masks.
frd_value = frd_score.compute_frd(paths, paths_masks=paths_masks)
frd_value = frd.compute_frd(paths, paths_masks=paths_masks)
```

## Additional arguments
Expand All @@ -78,11 +78,13 @@ frd_value = frd_score.compute_frd(paths, paths_masks=paths_masks)

`--verbose` or `-v`: You may enable more detailed logging.info and logging.debug console logs by providing the `verbose` argument.

`--num_workers` or `-w`: The number of cpu workers used for multiprocessing during feature extraction. If set to None, then the system's number of available cpu cores minus 2 will be taken as default (1 is the minimum value for num_workers).

`--save-stats` or `-s`:
As in [pytorch-fid](https://github.com/mseitzer/pytorch-fid), you can generate a compatible `.npz` archive of a dataset using the `--save-stats` flag.
You may use the `.npz` archive as dataset path, which can be useful to compare multiple models against an original dataset without recalculating the statistics multiple times.
```
python -m frd --save-stats path/to/dataset path/to/npz_outputfile
python -m frd_score --save-stats path/to/dataset path/to/npz_outputfile
```


Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ def get_version(rel_path):

if __name__ == "__main__":
setuptools.setup(
name="frd",
version=get_version(os.path.join("src", "frd", "__init__.py")),
name="frd-score",
version=get_version(os.path.join("src", "frd_score", "__init__.py")),
author="Richard Osuala, Preeti Verma",
description=(
"Package for calculating Fréchet Radiomics Distance (FRD)"
),
long_description=read("README.md"),
license="Apache-2.0",
long_description_content_type="text/markdown",
url="https://github.com/RichardObi/frd",
download_url="https://github.com/RichardObi/frd/archive/refs/tags/v0.0.1.tar.gz",
url="https://github.com/RichardObi/frd_score",
download_url="https://github.com/RichardObi/frd_score/archive/refs/tags/v0.0.1.tar.gz",
project_urls={
"Bug Tracker": "https://github.com/RichardObi/frd/issues",
"Bug Tracker": "https://github.com/RichardObi/frd_score/issues",
},
package_dir={"": "src"},
packages=setuptools.find_packages(where="src"),
Expand All @@ -47,7 +47,7 @@ def get_version(rel_path):
python_requires=">=3.8",
entry_points={
"console_scripts": [
"frd = frd.frd_score:main",
"frd = frd_score.frd:main",
],
},
install_requires=[
Expand Down
3 changes: 0 additions & 3 deletions src/frd/__main__.py

This file was deleted.

File renamed without changes.
3 changes: 3 additions & 0 deletions src/frd_score/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import frd_score.frd

frd_score.frd.main()
Loading

0 comments on commit 6464757

Please sign in to comment.