On May 7, 8:38 pm, Dave L <dave.le...@[EMAIL PROTECTED]
> wrote:
> Hi,
>
> I have a 384X512 MRI image that I want to select an ROI in then
> rescale it to overlay on a second MRI image measuring 110X110. I
> would then select the same ROI on the second image. My question is
> how can I retain the ROI selection when I rescale the image?
>
> Thanks,
> Dave
For a quick-and-dirty result, I would use CONGRID. You may well want
better interpolation though. I'm making a big assumption: that your
second image is a distorted version of the first one (or a distorted
image of the same field of view). If this isn't the case, it won't
work.
Regards,
Chris
; Generate an image
seed = -42l
image1 = 1e-4*findgen(384, 512)
image1 += randomu(seed, 384, 512)
; Highlight a part of image
image1[100:120,250:270] = 0.95 * max(image1)
; Define a region
window, xsize = 384, ysize = 512
tvscl, image1
im1_inds = defroi(384, 512)
n_inds = n_elements(im1_inds)
if n_inds eq 0 then message, 'Invalid RoI.'
; Make RoI mask using one-dimensional subscripts
mask = bytarr(384, 512)
mask[im1_inds] = 1b
new_mask = congrid(mask, 110, 110)
; Proof of concept - use your own image2 here :-)
image2 = congrid(image1, 110, 110)
window, /free
tvscl, image2, 0
tvscl, image2*new_mask, 1


|