Crop suffix of some dimension using SpatialCrop
#1935
Unanswered
function2-llx
asked this question in
Q&A
Replies: 2 comments
-
Seems duplicate of #1929, I misunderstood that question at first. Sorry about that, please refer to that discussion. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi, suggested PR here. If you wanted to leave the last 16 in the z-direction and not touch anything else, this would be done with: SpatialCrop(roi_slices=[slice(None), slice(None), slice(-16, None)]) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone. For some purpose I'd like to use the last 16 slices of my each MRI scan. For a numpy array
x
this can be done withx[0:None, 0:None, -16:None]
. However currently I'm not able to find a way to achieve this with MONAI'sSpatialCrop
. In this case I need to passroi_start=(0, 0, -16)
androi_end=(None, None, None)
to constructSpatialCrop
, but this leads to an exception raised here saying that:While simple workaround by slicing it outside, or even using the transform of
Lambda
, is obvious, but it will be pretty cool if I could process my images only with transforms provided by MONAI, right?Any suggestion will be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions