[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 4627ddf 021/113: NoiseChisel segmentation work
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 4627ddf 021/113: NoiseChisel segmentation working in 3D, test added |
Date: |
Fri, 16 Apr 2021 10:33:34 -0400 (EDT) |
branch: master
commit 4627ddf04fc2da50faca89faba53ddd45585e6e3
Author: Mohammad Akhlaghi <akhlaghi@gnu.org>
Commit: Mohammad Akhlaghi <akhlaghi@gnu.org>
NoiseChisel segmentation working in 3D, test added
NoiseChisel's segmentation is now also working in 3D. Only a small
correction was necessary in classifying the edges of the tiles. Also, a
test was written to run NoiseChisel fully on a noised image created by
MakeNoise's test.
---
bin/noisechisel/clumps.c | 22 +++++++++++-----
bin/noisechisel/noisechisel.c | 8 ------
tests/Makefile.am | 4 ++-
tests/noisechisel/noisechisel-3d.sh | 52 +++++++++++++++++++++++++++++++++++++
4 files changed, 70 insertions(+), 16 deletions(-)
diff --git a/bin/noisechisel/clumps.c b/bin/noisechisel/clumps.c
index 459b212..dd560f7 100644
--- a/bin/noisechisel/clumps.c
+++ b/bin/noisechisel/clumps.c
@@ -987,10 +987,11 @@ clumps_find_make_sn_table(void *in_prm)
void *tarray;
double numdet;
+ int pixonedge;
gal_data_t *tile, *tblock, *tmp;
uint8_t *binary=p->binary->array;
struct clumps_thread_params cltprm;
- size_t i, c, ind, tind, num, numsky, *indarr;
+ size_t i, j, c, ind, tind, num, numsky, *indarr;
size_t *scoord=gal_data_malloc_array(GAL_TYPE_SIZE_T, ndim, __func__,
"scoord");
size_t *icoord=gal_data_malloc_array(GAL_TYPE_SIZE_T, ndim, __func__,
@@ -1080,12 +1081,19 @@ clumps_find_make_sn_table(void *in_prm)
ind = (int32_t *)i - (int32_t *)(p->clabel->array);
gal_dimension_index_to_coord(ind, ndim, dsize, icoord);
- /* If the pixel is on the tile edge, set it as river and
- don't include it in the indexs. */
- if( icoord[0]==scoord[0]
- || icoord[0]==scoord[0]+tile->dsize[0]-1
- || icoord[1]==scoord[1]
- || icoord[1]==scoord[1]+tile->dsize[1]-1 )
+ /* Check if the pixel is on the tile edge. */
+ pixonedge=0;
+ for(j=0;j<ndim;++j)
+ if( icoord[j]==scoord[j]
+ || icoord[j]==scoord[j]+tile->dsize[j]-1 )
+ {
+ pixonedge=1;
+ break;
+ }
+
+ /* If this pixel is on the edge, then it should be a
+ river. */
+ if(pixonedge)
*(int32_t *)i=CLUMPS_RIVER;
/* This pixel is not on the edge, check if it had a value of
diff --git a/bin/noisechisel/noisechisel.c b/bin/noisechisel/noisechisel.c
index 71b808c..e73850b 100644
--- a/bin/noisechisel/noisechisel.c
+++ b/bin/noisechisel/noisechisel.c
@@ -289,14 +289,6 @@ noisechisel(struct noisechiselparams *p)
images. */
noisechisel_find_sky_subtract(p);
- /***********************************************/
- if(p->conv->ndim==3)
- {
- printf("\n... end of %s ...\n", __func__);
- exit(0);
- }
- /***********************************************/
-
/* If the user only wanted detection, ignore the segmentation steps. */
if(p->onlydetection==0)
{
diff --git a/tests/Makefile.am b/tests/Makefile.am
index bf4e135..cca7d8a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -144,9 +144,11 @@ if COND_MKPROF
mkprof/clearcanvas.sh: mknoise/addnoise.sh.log
endif
if COND_NOISECHISEL
- MAYBE_NOISECHISEL_TESTS = noisechisel/noisechisel.sh
+ MAYBE_NOISECHISEL_TESTS = noisechisel/noisechisel.sh \
+ noisechisel/noisechisel-3d.sh
noisechisel/noisechisel.sh: mknoise/addnoise.sh.log
+ noisechisel/noisechisel-3d.sh: mknoise/addnoise-3d.sh.log
endif
if COND_STATISTICS
MAYBE_STATISTICS_TESTS = statistics/basicstats.sh statistics/estimate_sky.sh
diff --git a/tests/noisechisel/noisechisel-3d.sh
b/tests/noisechisel/noisechisel-3d.sh
new file mode 100755
index 0000000..a08ad5a
--- /dev/null
+++ b/tests/noisechisel/noisechisel-3d.sh
@@ -0,0 +1,52 @@
+# Detect objects and clumps in an image using NoiseChisel.
+#
+# See the Tests subsection of the manual for a complete explanation
+# (in the Installing gnuastro section).
+#
+# Original author:
+# Mohammad Akhlaghi <akhlaghi@gnu.org>
+# Contributing author(s):
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved. This file is offered as-is,
+# without any warranty.
+
+
+
+
+
+# Preliminaries
+# =============
+#
+# Set the variables (The executable is in the build tree). Do the
+# basic checks to see if the executable is made or if the defaults
+# file exists (basicchecks.sh is in the source tree).
+prog=noisechisel
+img=3d-cat_noised.fits
+execname=../bin/$prog/ast$prog
+
+
+
+
+
+# Skip?
+# =====
+#
+# If the dependencies of the test don't exist, then skip it. There are two
+# types of dependencies:
+#
+# - The executable was not made (for example due to a configure option),
+#
+# - The input data was not made (for example the test that created the
+# data file failed).
+if [ ! -f $execname ]; then echo "$execname not created."; exit 77; fi
+if [ ! -f $img ]; then echo "$img does not exist."; exit 77; fi
+
+
+
+
+
+# Actual test script
+# ==================
+$execname $img --config=.gnuastro/astnoisechisel-3d.conf
- [gnuastro-commits] master 73fdf0c 006/113: MakeProfiles builds 3D ellipsoids, (continued)
- [gnuastro-commits] master 73fdf0c 006/113: MakeProfiles builds 3D ellipsoids, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 03d73fe 011/113: Some minor corrections in code and comments, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 87ab805 014/113: Identifiers for integer constants in BZERO comparisons, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 1483201 009/113: Noised cube created in make check, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master bdeaba9 012/113: Corrected name of 3D catalog for tarball inclusion, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 6b53c5e 015/113: Bug fixes in master: commits 1ff1c25 and 540af65, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master adeb1c6 016/113: NoiseChisel's convolution step in 3D completed, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master ace4160 017/113: New --mcolisbrightness option for MakeProfiles, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master f06acc5 018/113: Merged recent work from master, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 61aec7b 019/113: Convolve name and dimensionality checks, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 4627ddf 021/113: NoiseChisel segmentation working in 3D, test added,
Mohammad Akhlaghi <=
- [gnuastro-commits] master 1560a54 022/113: Default NoiseChisel kernel in 3D changed to 1.5 pixels, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 4d2508f 028/113: Fixed NoiseChisel opening and dilation and merged with master, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 4223e60 025/113: Suggestions on viewing/inspecting NoiseChisel's output, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 6086579 031/113: Merged recent work in master (corrected conflicts), Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master b0d5fab 034/113: Merged recent work from master, no conflicts, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 06798a5 035/113: Crop's --checkcenter works on 3D dataset, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master fd51c80 050/113: Imported recent work from master, no conflicts, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master a4dbaba 055/113: Recent work in master imported, minor conflict fixed, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master 0597cea 058/113: Imported work in master, no conflicts, Mohammad Akhlaghi, 2021/04/16
- [gnuastro-commits] master e11098d 053/113: Recent work in master imported, minor conflicts fixed, Mohammad Akhlaghi, 2021/04/16