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

Home » Public Forums » archive » solutions for the nearest neighbour problem in IDL
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
solutions for the nearest neighbour problem in IDL [message #15737] Thu, 10 June 1999 00:00 Go to next message
Uwe Nolte is currently offline  Uwe Nolte
Messages: 3
Registered: April 1999
Junior Member
Hi,
does anyone know if, there are solutions for the
nearest neighbour problem in IDL?

Many thanks in advance.

with kind regards,

Uwe Nolte
Re: solutions for the nearest neighbour problem in IDL [message #15801 is a reply to message #15737] Fri, 11 June 1999 00:00 Go to previous message
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
Uwe Nolte wrote:
>
> Hi,
> does anyone know if, there are solutions for the
> nearest neighbour problem in IDL?
>
> Many thanks in advance.
>
> with kind regards,
>
> Uwe Nolte

Uwe -

The easiest way to use nearest-neighbor sampling is to compute and/or
transform your coordinates first, and then use them to index your
original data, using the ROUND() function to give you the "nearest
neighbors". An example of this is the following:

slice[*] = volume[0 > round(vol_ind[*,0]) < (xdim-1), $
0 > round(vol_ind[*,1]) < (ydim-1), $
0 > round(vol_ind[*,2]) < (zdim-1)]

where SLICE is a 2D array which is "extracted" from VOLUME using
transformed coordinates already computed and stored in VOL_IND.

I've written a C routine that does a special-case nearest-neighbor
sampling in which zero-valued voxels are "ignored", avoiding
aliasing effects at the interface between zero-valued and non-zero-
valued voxels. Email me if you're interested in it.

Dave Foster
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Utilities for converting IDL4 handles to IDL5 pointers
Next Topic: [Bug?] Reading TIFF Files

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

Current Time: Wed Oct 08 09:15:09 PDT 2025

Total time taken to generate the page: 0.00511 seconds