Coding issue with nibabel--- + Torchio
See original GitHub issueHi. Thx for this wonderful repository.
I have a question. If I get the image + labels array for all my data, and corresponding ground truths with img=nib.load(os.path…), with gt… Then, I use img=img_getdata()…, then return them. So then, my question=> in order to use Torchio, which I guess whill be provided by the (subjects, channel, h,w,d)----nibabel, right? If that’s correct, do I need to use then as—
For example a class,
if transform is None:
if mode == 'train':
transform = ([
tio.RandomAffine(): 0.75,
tio.RandomElasticDeformation(): 0.25,
tio.RandomAffine(scales=(0.9, 1.2), degrees=(10)),
tio.RandomFlip(axes=('LR'))..... Likewise
])
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Dataloader fails for some images #669 - fepegar/torchio - GitHub
Although I am able to load the image without issue witth Nibabel along with on ITKSnap, 3DSlicer and FSLeyes.
Read more >torchio.transforms.preprocessing.spatial.to_canonical
Source code for torchio.transforms.preprocessing.spatial.to_canonical. import nibabel as nib import numpy as np import torch from ... import ...
Read more >TorchIO: a Python library for efficient loading ... - arXiv Vanity
TorchIO is an open-source project with code, comprehensive examples and extensive ... tool for solving problems related to image understanding and analysis.
Read more >Working with nibabel source code - Nipy
Working with nibabel source code¶ · Introduction · Install git · Overview · In detail · Following the latest source · Get the...
Read more >TorchIO: A Python library for efficient loading ... - arXiv
Source code, comprehensive tutorials and extensive documentation for ... TorchIO uses the medical imaging libraries NiBabel and SimpleITK to ...
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
Typically,
array = img.get_data()
will return a NumPy array of shape(w, h, d)
. You can add a channels dimension doing for examplearray[np.newaxis]
and passing that to thetensor
kwarg oftio.ScalarImage
. But this is probably not necessary. Just pass the image path totio.ScalarImage
and it will take care of reading it.I suggest you take a look at the Getting started section in the docs, and go through all the notebooks.
I’m not sure what the question is. Can you maybe try to be more specific?