RandRotated
#2139
Replies: 2 comments 4 replies
-
Ok found the error in the plotting. It's the same problem than in #1788 |
Beta Was this translation helpful? Give feedback.
2 replies
-
it works now but I still don't get it. This is how it works training_transform = Compose([
LoadImaged(keys=['image', 'label']),
AddChanneld(keys=["image", "label"]),
RandRotated(keys=["image", "label"], prob=1.0, range_x=1, range_y=1, range_z=1),
ToTensord(keys=['image', 'label']),`
training_dataset = PersistentDataset(data=training_data_dict, transform=training_transform)
plot_train = training_dataset[0] # here is the difference
figure1 = plt.figure(num="After_Pipeline", figsize=(8, 4))
plt.suptitle("Image label pair of {}. training-dataset with name: {}".format(i + 1, str3))
plt.subplot(1, 2, 1)
plt.title("image")
plt.xlabel(str1)
saggital_image = plot_train["image"][0, 60, :, :] # here is the difference
plt.imshow(saggital_image, cmap="gray")
plt.subplot(1, 2, 2)
plt.title("label")
plt.xlabel(str2)
saggital_label = plot_train["label"][0, 60, :, :] # here is the difference
plt.imshow(saggital_label, cmap="gray")
plt.show() An this how it didnt work: figure1 = plt.figure(num="After_Pipeline", figsize=(8, 4))
plt.suptitle("Image label pair of {}. training-dataset with name: {}".format(i + 1, str3))
plt.subplot(1, 2, 1)
plt.title("image")
plt.xlabel(str1)
saggital_image = training_dataset[0]["image"][0, 60, :, :] # here is the difference
plt.imshow(saggital_image, cmap="gray")
plt.subplot(1, 2, 2)
plt.title("label")
plt.xlabel(str2)
saggital_label = training_dataset[0]["label"][0, 60, :, :] # here is the difference
plt.imshow(saggital_label, cmap="gray")
plt.show() |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like to rotate my image label pairs with the RandRotated function to improve robustness:
RandRotated(keys=["image", "label"], prob=1.0, range_x=1, range_y=1, range_z=1)
But it ends up that it is rotating the image differently to the label, which doesn't make sense and screws up all the labeling. Is this a planned behaviour or am I missing something?
Help appreciated
Fabian
Beta Was this translation helpful? Give feedback.
All reactions