[Top][All Lists]

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

[gnuastro-commits] master 8ae2e2a 2/2: Segment: accounting for blank pix

From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 8ae2e2a 2/2: Segment: accounting for blank pixels when checking detection map
Date: Sun, 26 Jul 2020 17:02:38 -0400 (EDT)

branch: master
commit 8ae2e2a4307a97253c4d6bfb5ddc1c529b4d4e52
Author: Mohammad Akhlaghi <>
Commit: Mohammad Akhlaghi <>

    Segment: accounting for blank pixels when checking detection map
    The input detection map in Segment is interpreted as a signed 32-bit
    integer type. So when it has blank values, they are stored as the smallest
    possible number in this format (a huge negative number). However, the
    checks at the start of Segment don't account for this, so when there are
    blank elements in the detection map, Segment crashes, by saying that there
    are negative pixel values in the detection map (which should be only
    With this commit, if the value is negative, AND it is equal to the standard
    blank value for this type, then it doesn't crash any more. fortunately all
    later parts of Segment can account for blank pixels, the problem was only
    in the check at the start.
    This bug was reported by Zahra Sharbaf.
    This fixes bug #58833.
 NEWS                  | 1 +
 bin/segment/segment.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 0a89eba..7d53e9a 100644
--- a/NEWS
+++ b/NEWS
@@ -85,6 +85,7 @@ See the end of the file for license conditions.
   bug #58696: Warp with --centeroncorner --scale making wrong size.
   bug #58774: Warp' s output on a cube is a 2D image or wrong size.
   bug #58809: NoiseChisel not removing negative outlier tiles.
+  bug #58833: Segment crashes when detetion map has blank pixels
diff --git a/bin/segment/segment.c b/bin/segment/segment.c
index 6dc3204..0f8a5bd 100644
--- a/bin/segment/segment.c
+++ b/bin/segment/segment.c
@@ -141,7 +141,7 @@ segment_initialize(struct segmentparams *p)
           *b = *o > 0;
           /* A small sanity check. */
-          if(*o<0)
+          if(*o<0 && *o!=GAL_BLANK_INT32)
             error(EXIT_FAILURE, 0, "%s (hdu: %s) has negative value(s). "
                   "Each non-zero pixel in this image must be positive (a "
                   "counter, counting from 1).", p->useddetectionname,

reply via email to

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