-
Hi, I am really amazed with torchio as a toolkit for medical image analysis, but I am having trouble understanding what am I doing wrong when trying to plot subject images. For example, I have a simple function: def plot_subject(self, subject_id=None):
""" Plots subject that corresponds to the specified subject ID, or
random if not specfiied..
:param subject_id - string by which subjects are uniquely identified.
"""
if subject_id:
subject_idx = [idx for idx, subject in enumerate(self.data.dry_iter(), 0)
if subject.__dict__['subject_id'] == subject_id][0]
if not subject_idx:
raise ValueError(f"[ERROR]: Subject with {subject_id} does not exist in the dataset!")
else:
subject_ids = [subject.__dict__['subject_id'] for subject in self.data.dry_iter()]
subject_idx = random.randint(0, len(subject_ids))
subject = self.data[subject_idx]
images = subject.get_images()
for img in images:
print(f"[INFO]: {img.shape}")
print(f"[INFO]: Plotting subject with ID - {self.data[subject_idx].__dict__['subject_id']}")
self.data[subject_idx].plot()This takes REALLY long time to process. NOTE: self.data is This is what I get as the output: What is strange is that I am getting different results for different patients: My question is, am I doing something wrong here, is this maybe data related, or? Here is list of transforms being applied:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
I've added a new dataset class and written a notebook motivated by your questions, it might be useful for you: https://www.kaggle.com/fepegar/preprocessing-mri-with-torchio I now have the dataset, so I can try plotting a troublesome subject myself and diagnose the issue. |
Beta Was this translation helpful? Give feedback.
I've added a new dataset class and written a notebook motivated by your questions, it might be useful for you: https://www.kaggle.com/fepegar/preprocessing-mri-with-torchio
I now have the dataset, so I can try plotting a troublesome subject myself and diagnose the issue.