Simple pipeline for experimenting with radiomics features
docker run -p 8501:8501 -v <your_data_dir>:/data -it piotrekwoznicki/autorad:0.2 |
pip install --upgrade autorad |
Installation from source
git clone https://github.com/pwoznicki/AutoRadiomics.git
cd AutoRadiomics
pip install -e .
Example - Hydronephrosis detection from CT images:
Extract radiomics features
df = pd.read_csv(table_dir / "paths.csv")
image_dataset = ImageDataset(
df=df,
image_colname="image path",
mask_colname="mask path",
ID_colname="patient ID"
)
extractor = FeatureExtractor(
dataset=image_dataset,
out_path=(table_dir / "features.csv"),
)
extractor.extract_features()
Load, split and preprocess extracted features
# Create a dataset from the radiomics features
feature_df = pd.read_csv(table_dir / "features.csv")
feature_dataset = FeatureDataset(
dataframe=feature_df,
target="Hydronephrosis",
task_name="Hydronephrosis detection"
)
# Split data and load splits
splits_path = result_dir / "splits.json"
feature_dataset.full_split(save_path=splits_path)
feature_dataset.load_splits_from_json(splits_path)
# Preprocessing
preprocessor = Preprocessor(
normalize=True,
feature_selection_method="boruta",
oversampling_method="SMOTE",
)
feature_dataset._data = preprocessor.fit_transform(dataset.data)
Train the model for hydronephrosis classification
# Select classifiers to compare
classifier_names = [
"Gaussian Process Classifier",
"Logistic Regression",
"SVM",
"Random Forest",
"XGBoost",
]
classifiers = [MLClassifier.from_sklearn(name) for name in classifier_names]
model = MLClassifier.from_sklearn(name="Random Forest")
model.set_optimizer("optuna", n_trials=5)
trainer = Trainer(
dataset=dataset,
models=[model],
result_dir=result_dir,
experiment_name="Hydronephrosis detection"
)
trainer.run()
Create an evaluator to train and evaluate selected classifiers
evaluator = Evaluator(dataset=data, models=classifiers)
evaluator.evaluate_cross_validation()
evaluator.boxplot_by_class()
evaluator.plot_all_cross_validation()
evaluator.plot_test()
Commands
MLFlow
mlflow server -h 0.0.0.0 -p 5000 --backend-store-uri <result_dir>
Dependencies:
- MONAI
- pyRadiomics
- MLFlow
- Optuna
- scikit-learn
- imbalanced-learn
- XGBoost
- Boruta
- Medpy
- NiBabel
- nilearn
- plotly
- seaborn
App dependencies:
- Streamlit
- Docker
Metadata
Release files for autorad 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| autorad-0.1.2.tar.gz | 46.1 kB | Without provenance | Details for autorad-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| autorad-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for autorad-0.1.2-py3-none-any.whl |
Total release size: 100.4 kB
Release files / autorad-0.1.2.tar.gz
| Download URL | autorad-0.1.2.tar.gz |
|---|---|
| Size | 46.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c450204bb9657adca8993ba54547afa8dbd8be6e5a27c135c347d12e2d714db
|
|
BLAKE2b-256 checksum How to use checksums |
1b3d2dbecfe10141fb49e858c7d3435a13e2d1c9d7c5336e1869247b8214a3f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.2
|
Release files / autorad-0.1.2-py3-none-any.whl
| Download URL | autorad-0.1.2-py3-none-any.whl |
|---|---|
| Size | 54.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d997c1f2a0fc37b27323edda60e29e7264c3b07e30f776391b62e2f664ce02ec
|
|
BLAKE2b-256 checksum How to use checksums |
d8b7d662032b352285116098038bebf40bc44d8df2fb264c4d5cc965d7bd8c5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.2
|
Security for autorad 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.