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 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: retaining ROI when rescaling? [message #60271] Thu, 08 May 2008 14:58
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
pgrigis@gmail.com writes:

> Mixing medicine and geography? That's interesting ... ;-)

Do you see what we are reduced to when people don't ask
good questions!!

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: retaining ROI when rescaling? [message #60272 is a reply to message #60271] Thu, 08 May 2008 14:54 Go to previous message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
Jean H wrote:
> Spon wrote:
>> 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.
>
> if the two images does not cover the same area, you would have to
> transform your ROI coordinates to lat-long,
Mixing medicine and geography? That's interesting ... ;-)

Ciao,
Paolo

and transform them back to
> image coordinates of your second image...
>
> Jean
Re: retaining ROI when rescaling? [message #60273 is a reply to message #60272] Thu, 08 May 2008 14:38 Go to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Spon wrote:
> 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.

if the two images does not cover the same area, you would have to
transform your ROI coordinates to lat-long, and transform them back to
image coordinates of your second image...

Jean
Re: retaining ROI when rescaling? [message #60286 is a reply to message #60273] Thu, 08 May 2008 03:22 Go 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
Re: retaining ROI when rescaling? [message #60294 is a reply to message #60286] Wed, 07 May 2008 12:49 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Dave L writes:

> 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?

Uh, these two images don't seem to have the same aspect
ratio. :-)

Why don't you tell us more about the non-linear scaling
you are using.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
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: Wed Oct 08 19:12:22 PDT 2025

Total time taken to generate the page: 0.00504 seconds