question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RuntimeError: If input is a dictionary, a value for "include" must be specified when instantiating the transform

See original GitHub issue

Hi @fepegar, I get the following error when I am trying to apply the CropOrPad Transform on my Subject Object.

RuntimeError: If input is a dictionary, a value for "include" must be specified when instantiating the transform

I am instantiating my transform as follows:

transform = torchio.CropOrPad(roi_shape, mask_name='roi_mask')
transformed = transform(subject)

I searched the documentation for the CropOrPad transform, but I do not seem to find the include parameter anywhere.

My Subject is a dictionary with the following keys: ['1', '2', '3', 'label', 'path_to_metadata', 'roi_mask']

Please do let me know if I am missing something. Thanks for your help, Megh

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
fepegarcommented, Jan 5, 2021

Thanks, @meghbhalerao.

1reaction
meghbhaleraocommented, Jan 5, 2021

Sure! Here is the way to use the include parameter while using CropOrPad function:

subject_dict['1'] = tio.ScalarImage("path/to/image")
subject_dict['roi_mask'] = torchio.LabelMap("path/to/roi")
subject_dict['path_to_metadata'] = "path/to/metadata"
subject = torchio.Subject(subject_dict)
roi_shape = subject['roi_mask']['data'][0].shape
transform = torchio.CropOrPad(roi_shape, mask_name='roi_mask',include=['1','roi_mask'])
transformed = transform(subject)
Read more comments on GitHub >

github_iconTop Results From Across the Web

linkedin-skill-assessments-quizzes/python-quiz.md at main
The function will return a RuntimeError if you don't return a value. If the return keyword is absent, the function will return None...
Read more >
Getting the exception value in Python - Stack Overflow
My take is that if you're printing it out, it's for an end user that doesn't care what the class is and just...
Read more >
Pipelines - Hugging Face
This text classification pipeline can currently be loaded from pipeline() using the following task identifier: "sentiment-analysis" (for classifying sequences ...
Read more >
Source code for monai.transforms.utility.dictionary
A collection of dictionary-based wrappers around the "vanilla" transforms for ... If the input array doesn't have a channel dim, this value should...
Read more >
Image - TorchIO - Read the Docs
Image whose pixel values represent categorical labels. Example ... independently of the specified interpolation type in the transform instantiation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found