-
Notifications
You must be signed in to change notification settings - Fork 3
Add basic README for auxiliary repository #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ba020a0
Initial plan
Copilot 13b06a3
Create comprehensive README.md with badges, features, and usage examples
Copilot 4005330
Remove Contributing section from README
Copilot be6e583
Reorganize README with I/O sections for each format (NIfTI, DICOM, TIFF)
Copilot c23433c
Add examples for writing NumPy arrays to DICOM with and without refer…
Copilot f170a74
Update pyproject.toml license to Apache-2.0
Copilot f1fab44
Add citation section to README
neuronflow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,128 @@ | ||
| [](https://pypi.python.org/pypi/auxiliary/) | ||
| # auxiliary | ||
|
|
||
| [](https://pypi.org/project/auxiliary/) | ||
| [](https://pypi.org/project/auxiliary/) | ||
| [](http://auxiliary.readthedocs.io/?badge=latest) | ||
| [](https://opensource.org/licenses/Apache-2.0) | ||
|
|
||
| # auxiliary | ||
| Auxiliary is a Python package providing utility functions for medical image processing. It is part of the [BrainLesion](https://github.com/BrainLesion) project and offers tools for: | ||
|
|
||
| TODO | ||
| - **Image I/O**: Reading and writing medical images (NIfTI, TIFF, DICOM) using SimpleITK | ||
| - **Image Normalization**: Percentile-based and windowing normalization methods | ||
| - **Format Conversion**: DICOM to NIfTI and NIfTI to DICOM conversion | ||
| - **Path Utilities**: Robust path handling with the turbopath module | ||
|
|
||
| ## Installation | ||
|
|
||
| ### PyPi | ||
| With a Python 3.10+ environment, you can install `auxiliary` directly from [PyPI](https://pypi.org/project/auxiliary/): | ||
|
|
||
| ```sh | ||
| ```bash | ||
| pip install auxiliary | ||
| ``` | ||
|
|
||
| ### Conda | ||
| Or via conda: | ||
|
|
||
| ```sh | ||
| ```bash | ||
| conda install conda-forge::auxiliary | ||
| ``` | ||
|
|
||
| ## deploy | ||
| ### Optional Dependencies | ||
|
|
||
| For DICOM to NIfTI conversion using `dcm2niix`: | ||
|
|
||
| ```bash | ||
| pip install auxiliary[dcm2niix] | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| ### NIfTI I/O | ||
|
|
||
| ```python | ||
| from auxiliary.io import read_image, write_image | ||
|
|
||
| # Read a NIfTI image | ||
| image_array = read_image("path/to/image.nii.gz") | ||
|
|
||
| # Write a NumPy array to a NIfTI file | ||
| write_image(image_array, "path/to/output.nii.gz") | ||
|
|
||
| # Write with reference image for spatial metadata | ||
| write_image(image_array, "path/to/output.nii.gz", reference_path="path/to/reference.nii.gz") | ||
| ``` | ||
|
|
||
| ### DICOM I/O | ||
|
|
||
| ```python | ||
| from auxiliary.conversion import dicom_to_nifti_itk, nifti_to_dicom_itk, dcm2niix | ||
| import numpy as np | ||
|
|
||
| # Read a DICOM series and convert to NIfTI using SimpleITK | ||
| dicom_to_nifti_itk("path/to/dicom_dir", "path/to/output_dir") | ||
|
|
||
| # Read a DICOM series and convert to NIfTI using dcm2niix (requires dcm2niix extra) | ||
| dcm2niix("path/to/dicom_dir", "path/to/output_dir") | ||
|
|
||
| # Write a NIfTI image to DICOM format | ||
| nifti_to_dicom_itk("path/to/image.nii.gz", "path/to/output_dicom_dir") | ||
|
|
||
| # Write a NumPy array to DICOM format | ||
| image_array = np.random.rand(128, 128, 64) # example 3D array | ||
| nifti_to_dicom_itk(image_array, "path/to/output_dicom_dir") | ||
|
|
||
| # Write a NumPy array to DICOM with reference DICOM for metadata | ||
| nifti_to_dicom_itk( | ||
| image_array, | ||
| "path/to/output_dicom_dir", | ||
| reference_dicom="path/to/reference_dicom_dir" | ||
| ) | ||
| ``` | ||
|
|
||
| ### TIFF I/O | ||
|
|
||
| ### build | ||
| ```python | ||
| from auxiliary.tiff.io import read_tiff, write_tiff | ||
|
|
||
| # Read a TIFF file | ||
| tiff_data = read_tiff("path/to/image.tiff") | ||
|
|
||
| # Write a NumPy array to a TIFF file | ||
| write_tiff(tiff_data, "path/to/output.tiff") | ||
| ``` | ||
| python -m build | ||
| poetry build | ||
|
|
||
| ### Image Normalization | ||
|
|
||
| ```python | ||
| from auxiliary.normalization.percentile_normalizer import PercentileNormalizer | ||
| from auxiliary.normalization.windowing_normalizer import WindowingNormalizer | ||
|
|
||
| # Percentile-based normalization | ||
| normalizer = PercentileNormalizer(lower_percentile=1.0, upper_percentile=99.0) | ||
| normalized_image = normalizer.normalize(image_array) | ||
|
|
||
| # Windowing normalization (e.g., for CT images) | ||
| normalizer = WindowingNormalizer(center=40, width=400) | ||
| windowed_image = normalizer.normalize(image_array) | ||
| ``` | ||
|
|
||
| ### upload to pypi | ||
|
|
||
|
|
||
| ## Citation | ||
|
|
||
| > [!IMPORTANT] | ||
| > If you use `auxiliary` in your research, please cite it to support the development! | ||
|
|
||
| Kofler, F., Rosier, M., Astaraki, M., Möller, H., Mekki, I. I., Buchner, J. A., Schmick, A., Pfiffer, A., Oswald, E., Zimmer, L., Rosa, E. de la, Pati, S., Canisius, J., Piffer, A., Baid, U., Valizadeh, M., Linardos, A., Peeken, J. C., Shit, S., … Menze, B. (2025). *BrainLesion Suite: A Flexible and User-Friendly Framework for Modular Brain Lesion Image Analysis* [arXiv preprint arXiv:2507.09036](https://doi.org/10.48550/arXiv.2507.09036) | ||
|
|
||
|
|
||
| ``` | ||
| twine upload dist/* | ||
| @misc{kofler2025brainlesionsuiteflexibleuserfriendly, | ||
| title={BrainLesion Suite: A Flexible and User-Friendly Framework for Modular Brain Lesion Image Analysis}, | ||
| author={Florian Kofler and Marcel Rosier and Mehdi Astaraki and Hendrik Möller and Ilhem Isra Mekki and Josef A. Buchner and Anton Schmick and Arianna Pfiffer and Eva Oswald and Lucas Zimmer and Ezequiel de la Rosa and Sarthak Pati and Julian Canisius and Arianna Piffer and Ujjwal Baid and Mahyar Valizadeh and Akis Linardos and Jan C. Peeken and Surprosanna Shit and Felix Steinbauer and Daniel Rueckert and Rolf Heckemann and Spyridon Bakas and Jan Kirschke and Constantin von See and Ivan Ezhov and Marie Piraud and Benedikt Wiestler and Bjoern Menze}, | ||
| year={2025}, | ||
| eprint={2507.09036}, | ||
| archivePrefix={arXiv}, | ||
| primaryClass={cs.CV}, | ||
| url={https://arxiv.org/abs/2507.09036}, | ||
| } | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The License badge indicates "Apache 2.0" but according to pyproject.toml (line 13), the project is licensed under "AGPL-3.0". The badge should be updated to reflect the correct license.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot no in this case please change the project license to Apache 2.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated pyproject.toml license from AGPL-3.0 to Apache-2.0 in f170a74. The LICENSE file already contained the Apache 2.0 license, so this makes everything consistent.