[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 8ae2e2a 2/2: Segment: accounting for blank pix
[gnuastro-commits] master 8ae2e2a 2/2: Segment: accounting for blank pixels when checking detection map
Sun, 26 Jul 2020 17:02:38 -0400 (EDT)
Author: Mohammad Akhlaghi <firstname.lastname@example.org>
Commit: Mohammad Akhlaghi <email@example.com>
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
@@ -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
@@ -141,7 +141,7 @@ segment_initialize(struct segmentparams *p)
*b = *o > 0;
/* A small sanity check. */
+ 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,