Comments (2)
I added support for this for Nyul and LSQ. Re-install the package. Make sure your version is v2.0.1.
Fitting and using for arbitrary images is supported in the Python API. For example, you can run:
# load images
import nibabel as nib
image_paths = ["path/to/image1.nii", "path/to/image2.nii", ...]
images = [nib.load(image_path) for image_path in image_paths]
# normalize the images and save the standard histogram
from intensity_normalization.normalize.nyul import NyulNormalize
nyul_normalizer = NyulNormalize()
nyul_normalizer.fit(images)
normalized = [nyul_normalizer(image) for image in images]
nyul_normalizer.save_standard_histogram("standard_histogram.npy")
# load new images and normalize those
new_image_paths = ["path/to/another/image1.nii", "path/to/another/image2.nii", ...]
new_images = [nib.load(image_path) for image_path in new_image_paths]
normalized = [nyul_normalizer(image) for image in images]
# load the standard histogram
new_nyul_normalizer = NyulNormalize()
new_nyul_normalizer.load_standard_histogram("standard_histogram.npy")
normalized = [new_nyul_normalizer(image) for image in images]
For LSQ:
from intensity_normalization.normalize.lsq import LSQNormalize
lsq_normalizer = LSQNormalize()
lsq_normalizer.fit(images)
normalized = [lsq_normalizer(image) for image in images]
lsq_normalizer.save_standard_tissue_means("tissue_means.npy")
# reload the tissue means and use
lsq_normalizer = LSQNormalize()
lsq_normalizer.load_standard_tissue_means("tissue_means.npy")
normalized = [lsq_normalizer(image) for image in images]
RAVEL is only meant to work on a particular batch, so you need to refit it if you add new data to your batch or want to use it to normalize new data.
Similar options are added to the CLI. For nyul-normalize
the relevant new options are --save-standard-histogram
and --load-standard-histogram
. For LSQ, --save-standard-tissue-means
and --load-standard-tissue-means
.
Let me know if you run into a bug. Reopen the issue if so.
from intensity-normalization.
Thanks a lot for your quick response.
from intensity-normalization.
Related Issues (20)
- Add a citation file
- Improve contributing information
- Add numpy mypy plugin HOT 1
- Improve unit tests HOT 1
- Verify correctness of update to use pymedio HOT 1
- Fix mypy issues in update to use pymedio HOT 2
- Add note about scanner gain in MR pulse sequence equations
- Add pre-commit hooks HOT 1
- Add option to specify output file type
- What is the "MD" modality? And other questions. HOT 14
- Out-of-memory error in Nyul for large amounts of data HOT 4
- `intensity-normalization` not working in Google Colab HOT 1
- "TypeError: Axis must be specified when shapes of a and weights differ." in the LSQ method
- problems when importing the API HOT 1
- request for tutorial of Z score HOT 9
- Update docs in the style of Diátaxis
- Fix histogram plotting when passing in a tissue mask in FCM normalizer
- Using normalization methods -- bash HOT 1
- error when importing HOT 4
- Skfuzzy dependency breaks compatibility with Python 3.12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from intensity-normalization.