Comments (5)
Thanks!
I completely agree with this solution
I am going to make a PR to fix this !
from torchio.
Hi, @Zhack47. Can you please share a minimal example I can reproduce?
from torchio.
This is more minimal and should trigger the bug (tested on the same machine as above)
import numpy as np
import torch
from torch.utils.data import DataLoader
from torchio.data.sampler.label import LabelSampler
from torchio import DATA, TYPE, LABEL, INTENSITY, IntensityTransform
class SimulateLowResolutionTransform(IntensityTransform):
def __init__(self):
super().__init__(1)
def apply_transform(self, subject):
keys = sorted(subject.keys())
for key in keys:
subject[key][DATA] = subject[key][DATA].unsqueeze(0)
return subject
if __name__ == "__main__":
import torchio as tio
st = SimulateLowResolutionTransform()
colin_dataset = tio.datasets.mni.Colin27()
ds_train = tio.SubjectsDataset([colin_dataset], transform=st)
sampler = LabelSampler((120, 120, 80))
patches_queue_train = tio.Queue(ds_train, max_length=32, samples_per_volume=4, sampler=sampler,
shuffle_patches=True, shuffle_subjects=True, num_workers=8)
training_loader = DataLoader(patches_queue_train, batch_size=2, shuffle=True)
for batch in training_loader:
print(batch["t1"][DATA].shape)
from torchio.
Thanks, @Zhack47. Good catch!
I think adding raise exception
after line 330 would do. Do you agree?
Would you like to contribute with a PR?
from torchio.
Fixed in v0.19.1
.
from torchio.
Related Issues (20)
- Torchio Transformation Does not Working properly HOT 2
- `masked_select` on Z-Normalization slower than indexing HOT 2
- GridSampler without subject for validation HOT 3
- Resize sometimes adds a dimension to LabelMap images HOT 5
- Documentation is not built
- Patch Based Training With Queue Is Not Working Properly HOT 1
- Error when using a lambda function as masking_method in ZNormalization HOT 2
- Combined Affine/Elastic augmentations HOT 1
- The rotation given by Random Affine not accurate HOT 5
- (Optional) state_dict for each transform (reproducibility) HOT 2
- Wrong link to docs in Getting Started tutorial HOT 2
- Suggestions the modifying default value of prefetch_factor and the argument to set it for minimize the blocking-bottleneck between fetch subject and generate patch in Queue HOT 1
- Different transforms applied to CT and label HOT 11
- The Affine matrix does not change after applying the augmentations HOT 3
- Custom loader not used when loading data lazily HOT 2
- Seed is not working HOT 2
- Resample
- tio.Resample does not work with custom image class HOT 2
- Setting NUM_SAMPLES when using sampler with Queue HOT 3
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 torchio.