comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: retaining ROI when rescaling?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: retaining ROI when rescaling? [message #60286 is a reply to message #60273] Thu, 08 May 2008 03:22 Go to previous messageGo to previous message
Spon is currently offline  Spon
Messages: 178
Registered: September 2007
Senior Member
On May 7, 8:38 pm, Dave L <dave.le...@gmail.com> 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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: reading in a long line of data
Next Topic: A heartfelt thank you for MPFIT

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 03:52:44 PDT 2025

Total time taken to generate the page: 2.56126 seconds