Skip to content
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

confusion about input for dataset #116

Closed
romainVala opened this issue Apr 6, 2020 · 3 comments
Closed

confusion about input for dataset #116

romainVala opened this issue Apr 6, 2020 · 3 comments

Comments

@romainVala
Copy link
Contributor

romainVala commented Apr 6, 2020

Hello

Sorry if this is obvious but I get confuse with the dataset input

Previously I was just using list of images,

suj = [[ Image('T1', 'path/T1', INTENSITY), 
            Image('mask', 'path/label', LABEL), ]]

and then
dataset = ImagesDataset(suj)

After a recent update I get know an error
TypeError: Subjects list must contain instances of torchio.Subject, not "<class 'list'>"

so I now need a subject and thought I could do :
suj = [ Subject(ss) for ss in suj ]
but Subject does not accept a list of image : why that ?

this make the code, quite verbose, The only way is to do (as found in example_motion)

suj = [ Subject( Image('T1', 'path/T1', INTENSITY), 
                          Image('mask', 'path/label', LABEL)), ]

it is less convenient than a list of image ...
may be I miss the point ... ?

@romainVala
Copy link
Contributor Author

it may be not a big deal, I found out the way to addapt :
suj = [ Subject(*ss) for ss in suj ]
I find it easier with a list, but I am not a python expert ...

@fepegar
Copy link
Owner

fepegar commented Apr 6, 2020

I once changed the code to accept only *images and not images, but it was still working with lists of images. I recently modified it so that only one option is allowed.

I thought creating a list every time you want to create a new subject would be even more verbose, so implemented it like this, although I don't have strong arguments to support my decision. Using Subject(*ss) should indeed work for you.

@romainVala
Copy link
Contributor Author

ok fine

@fepegar fepegar closed this as completed Apr 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants