Skip to content
Discussion options

You must be logged in to vote

Hi @jl3282, if you want to crop the image based on the label, you could simply use CropForeground, and use margin arg to add some margin to the crop area, then use ResizeWithPadOrCrop to make all images the same size. Here I give you an example.

CropForegroundd(keys=['image', 'label'], source_key='label', margin=[30, 30, 30]),
ResizeWithPadOrCropd(keys=['image', 'label'], spatial_size=(128, 128, 128))

Hope it can help you, thanks!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jl3282
Comment options

Answer selected by jl3282
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants