Update RandomLabelsToImage
See original GitHub issueNow that I’ve included the ICBM template, do you think it’s a good idea to simplify a bit the example in RandomLabelsToImage
? Also, Colin27 2008 is very large.
For example:
import torchio
from torchio import RandomLabelsToImage
from torchio.datasets import ICBM2009CNonlinearSymmetryc
icbm = ICBM2009CNonlinearSymmetryc(load_4d_tissues=False)
# Default Gaussian parameters
transform = RandomLabelsToImage(
pv_label_keys=['gm', 'wm', 'csf'],
)
transformed = transform(icbm)
transformed['image'].save('/tmp/lab2im.nii')
# Specify Gaussian parameters
gaussian_parameters = {
'gm': dict(mean=2, std=0.1),
'wm': dict(mean=4, std=0.1),
'csf': dict(mean=6, std=0.1),
}
transform = RandomLabelsToImage(
pv_label_keys=['gm', 'wm', 'csf'],
gaussian_parameters=gaussian_parameters,
)
transformed = transform(icbm)
transformed['image'].save('/tmp/lab2im.nii')
I can also add an option in the ICBM class to create a label map from the PV images.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:19 (19 by maintainers)
Top Results From Across the Web
Set random labels for images in tf.data.Dataset - Stack Overflow
What I would like to do is change each of these labels to a random number from 0 to 3. My code is...
Read more >Need Help on Image Label Randomly Changing
Hello. I'm trying to make this image label where it randomly changes airline logos. The problem is that it only works once and...
Read more >What Do Neural Networks Learn When Trained With Random ...
We study deep neural networks (DNNs) trained on natural image data with entirely random labels. Despite its popularity in the literature, where ...
Read more >Set up image labeling project - Azure Machine Learning
Learn how to create and run data labeling projects to label images in Azure Machine Learning. Use machine-learning-assisted data labeling, ...
Read more >randomPatchExtractionDatastore - MathWorks
Create a random patch extraction datastore to extract random patches of size 32-by-32 pixels from the images and corresponding pixel labels. Set the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Why not, however it means that you have to specify every mean and std (even when you specify that a tissue will not be used because it will be directly taken from the original image).
Sounds good thanks! I think an
if isinstance(path, list)
andtorch.cat(tensors)
inImage.load()
would do. Maybe also asserting that all affines are the same. This could be extended toImage.save()
(taking a path per channel).I guess you’re right. At the end of the day, they are just soft or hard assignments, in 4D volumes, that can sometimes be summarized in a 3D volume. However, the Colin27 2008 is an outlier, their volume is clearly wrong (I email the maintainer, no reply).