Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Idl-pvware > Re: retaining R...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 6 Topic 5717 of 5734
Post > Topic >>

Re: retaining ROI when rescaling?

by Spon <christoph.blau@[EMAIL PROTECTED] > May 8, 2008 at 03:22 AM

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




 6 Posts in Topic:
retaining ROI when rescaling?
Dave L <dave.lenar@[EM  2008-05-07 12:38:24 
Re: retaining ROI when rescaling?
David Fanning <news@[E  2008-05-07 13:49:23 
Re: retaining ROI when rescaling?
Spon <christoph.blau@[  2008-05-08 03:22:26 
Re: retaining ROI when rescaling?
Jean H <jghasban@[EMAI  2008-05-08 15:38:21 
Re: retaining ROI when rescaling?
pgrigis@[EMAIL PROTECTED]  2008-05-08 14:54:43 
Re: retaining ROI when rescaling?
David Fanning <news@[E  2008-05-08 15:58:43 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu May 15 22:06:55 CDT 2008.