-
Hello. I am a graduate student studying medical imaging. Is there an api that puts the cropped image to the desired location of the original image? 3D patches were extracted from brain MRI through "SpatialCrop". Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It's fairly easy to replace a portion of an image with another. You would do this with: You mention that you're using Let me know if this doesn't quite answer your question. |
Beta Was this translation helpful? Give feedback.
It's fairly easy to replace a portion of an image with another. You would do this with:
image[start_c:end_c, start_h:end_h, start_w:end_w, start_d:end_d] = inferred_image
.You mention that you're using
SpatialCrop
, which implies that you know the parameters of the cropped region, so can determinestart_c
,end_c
, etc. However, you also mentioned that you're doing this as data augmentation, which might mean that you're doing some random cropping (e.g.,RandSpatialCrop
). In this case, you should be able to determined the cropping parameters by inspecting theimage_transforms
key in your data (assuming you are using dictionary transforms).Let me know if this doesn't quite answer your question.