Skip to content

ROI larger than image size #4087

@ouyuxuanbridge

Description

@ouyuxuanbridge

Hi scientists,

I encounter a problem regarding random crop when I'm implementing your tutorial of UNETR.

My image size is(80,80,80), and roi size is (48,48,48)

but it raises a error

raise ValueError("The size of the proposed random crop ROI is larger than the image size.")
ValueError: The size of the proposed random crop ROI is larger than the image size.

I am confused because it is actually smaller.

Could you please help me ?

Thanks!

The changes I have done:

model = UNETR(
in_channels=1,
out_channels=5,
img_size=(80, 80, 80),
feature_size=16,
hidden_size=768,
mlp_dim=3072,
num_heads=12,
pos_embed="perceptron",
norm_name="instance",
res_block=True,
dropout_rate=0.0,
).to(device)

RandCropByPosNegLabeld(
keys=["image", "label"],
label_key="label",
spatial_size=(48, 48, 48),
pos=1,
neg=1,
num_samples=4,
image_key="image",
image_threshold=0,
),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions