|
Re: retaining ROI when rescaling? [message #60272 is a reply to message #60271] |
Thu, 08 May 2008 14:54  |
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  |
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  |
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  |
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.")
|
|
|