How do I specify crop images in order? #3707
-
Monai has the following transforms, I have a (512,512,512) size of data that I want to crop to 4 patches in order. The ROI locations is that [0-127,0-127,0-127],[128-255,128-255,128-255],[256-384,256-384,256-384],[385-511,385-511,385-511]. What should I do? SpatialCrop
CenterSpatialCrop
RandSpatialCrop
RandSpatialCropSamples
CropForeground
RandWeightedCrop
RandCropByPosNegLabel
RandCropByLabelClasses
ResizeWithPadOrCrop
BoundingRect
RandScaleCrop
CenterScaleCrop |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
Hi @cvlearn913 , Thanks for your interest here. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Thank you sincerely for your kind regards! @Nic-Ma But it seems that dictionary transforms = Compose(
[ LoadImaged(keys=["image", "label"]),
EnsureChannelFirstd(keys=["image", "label"]),
Resized(keys=["image","label"],spatial_size=[512,512,512]),
SpatialCropd(keys=["image","label"],roi_size=[128,128,128],roi_slices=[slice(0,128,1),slice(0,128,1),slice(0,128,1)]),
# The data has already changed to 128*128*128
EnsureTyped(keys=["image", "label"]),
]
)
|
Beta Was this translation helpful? Give feedback.
Hi @cvlearn913 ,
Thanks for your interest here.
I think you can (1) add channel dim, (2) copy the original image 3 times, (3) apply
SpatialCrop
transform to them with expected ROI start / end.Thanks.