gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 8d5966c 1/3: Range corrected for makeCatalog's


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 8d5966c 1/3: Range corrected for makeCatalog's clump tiles for upperlimit
Date: Tue, 6 Mar 2018 09:20:21 -0500 (EST)

branch: master
commit 8d5966c295c222743aac857094895814cebcaa7b
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Range corrected for makeCatalog's clump tiles for upperlimit
    
    When a clump image is requested along with the upper limit measurements,
    MakeCatalog creates a "tile" for the clump to enable easy and fast parsing
    of the random positions. Until now, the area parsed for each clump when
    defining the tile was actually the whole image, not the detected object
    (due to a confusion between the actual image size and the object's tile
    size).
    
    Since the object label was checked, this didn't actually cause a bad
    measurement, but it could caused a crash when the object was close to the
    image edge. With this commit, the issue is solved.
    
    This fixes bug #53295.
---
 NEWS                       |  2 ++
 bin/mkcatalog/upperlimit.c | 12 +++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/NEWS b/NEWS
index d0b5f3a..24a1aaa 100644
--- a/NEWS
+++ b/NEWS
@@ -35,6 +35,8 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
 
   NoiseChisel crash when no growth is possible (bug #53268).
 
+  MakeCatalog parses area larger than clump (bug #53295).
+
 
 
 * Noteworthy changes in release 0.5 (library 3.0.0) (2017-12-22) [stable]
diff --git a/bin/mkcatalog/upperlimit.c b/bin/mkcatalog/upperlimit.c
index 0d4da2d..c767888 100644
--- a/bin/mkcatalog/upperlimit.c
+++ b/bin/mkcatalog/upperlimit.c
@@ -45,7 +45,7 @@ static gal_data_t *
 upperlimit_make_clump_tiles(struct mkcatalog_passparams *pp)
 {
   gal_data_t *input=pp->p->input;
-  size_t ndim=input->ndim, *dsize=input->dsize;
+  size_t ndim=input->ndim, *tsize=pp->tile->dsize;
 
   int32_t *O, *C;
   gal_data_t *tiles=NULL;
@@ -68,7 +68,8 @@ upperlimit_make_clump_tiles(struct mkcatalog_passparams *pp)
         minmax[ i * width + ndim + d ] = 0;                /* Maximum. */
       }
 
-  /* Parse over the object and get the clump's minimum and maximum. */
+  /* Parse over the object and get the clump's minimum and maximum
+     positions.*/
   while( pp->start_end_inc[0] + increment <= pp->start_end_inc[1] )
     {
       /* Set the pointers for this tile. */
@@ -77,14 +78,15 @@ upperlimit_make_clump_tiles(struct mkcatalog_passparams *pp)
       C = pp->st_c + increment;
 
       /* Go over the contiguous region. */
-      II = I + dsize[ndim-1];
+      II = I + tsize[ndim-1];
       do
         {
           /* Only consider clumps. */
           if( *O==pp->object && *C>0 )
             {
               /* Get the coordinates of this pixel. */
-              gal_dimension_index_to_coord(I-start, ndim, dsize, coord);
+              gal_dimension_index_to_coord(I-start, ndim, input->dsize,
+                                           coord);
 
               /* Check to see if this coordinate is the smallest/largest
                  found so far for this label. Note that labels start from
@@ -104,7 +106,7 @@ upperlimit_make_clump_tiles(struct mkcatalog_passparams *pp)
       while(++I<II);
 
       /* Increment to the next contiguous region. */
-      increment += ( gal_tile_block_increment(input, dsize, num_increment++,
+      increment += ( gal_tile_block_increment(input, tsize, num_increment++,
                                               NULL) );
     }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]