[Scipy-tickets] [SciPy] #796: ndimage.shift destroys data from edges

SciPy scipy-tickets@scipy....
Sat Nov 29 09:44:57 CST 2008


#796: ndimage.shift destroys data from edges
---------------------------+------------------------------------------------
 Reporter:  0ion9          |        Owner:  somebody
     Type:  defect         |       Status:  new     
 Priority:  normal         |    Milestone:          
Component:  scipy.ndimage  |      Version:  devel   
 Severity:  normal         |   Resolution:          
 Keywords:                 |  
---------------------------+------------------------------------------------
Comment (by NeilMuller):

 Format patch correctly

 {{{
 --- scipy/ndimage/src/ni_interpolation.c        (revision 5203)
 +++ scipy/ndimage/src/ni_interpolation.c        (working copy)
 @@ -140,10 +140,14 @@
              if (len <= 1) {
                  in = 0;
              } else {
 -                maybelong sz = len - 1;
 +                maybelong sz = len;
                  // Integer division of -in/sz gives (-in mod sz)
                  // Note that 'in' is negative
                  in += sz * ((maybelong)(-in / sz) + 1);
 +                // This maps to the range [1, len], so we need to wrap to
 +                // make this [0, len-1]
 +                if (in == len)
 +                   in = 0;
              }
              break;
          case NI_EXTEND_NEAREST:
 @@ -179,7 +183,7 @@
              if (len <= 1) {
                  in = 0;
              } else {
 -                maybelong sz = len - 1;
 +                maybelong sz = len;
                  in -= sz * (maybelong)(in / sz);
              }
              break;



 }}}

-- 
Ticket URL: <http://scipy.org/scipy/scipy/ticket/796#comment:3>
SciPy <http://www.scipy.org/>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list