[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master eadb72c: Configurable final dilation connectiv
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master eadb72c: Configurable final dilation connectivity in NoiseChisel |
Date: |
Tue, 29 Aug 2017 19:45:35 -0400 (EDT) |
branch: master
commit eadb72cd42804720847cb7f46a1dd15904d9d3b9
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
Configurable final dilation connectivity in NoiseChisel
Until now, NoiseChisel assumed maximum connectivity for the final dilation
(8), but in some cases, it may be desired to change it to 4. So with this
commit, NoiseChisel has the new `--dilatengb' option for this job.
---
NEWS | 3 +++
bin/noisechisel/args.h | 13 +++++++++++++
bin/noisechisel/astnoisechisel.conf | 1 +
bin/noisechisel/detection.c | 2 +-
bin/noisechisel/main.h | 1 +
bin/noisechisel/ui.c | 5 ++++-
bin/noisechisel/ui.h | 1 +
doc/gnuastro.texi | 9 +++++++++
8 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index bf17e5e..47a6032 100644
--- a/NEWS
+++ b/NEWS
@@ -34,6 +34,9 @@ GNU Astronomy Utilities NEWS -*-
outline -*-
option, the `--mcol' values of the catalog will be interpretted as total
brightness (sum of pixel values), not magnitude.
+ NoiseChisel: with the new `--dilatengb' option, it is now possible to
+ identify the connectivity of the final dilation.
+
Library: Functions that read data from an ASCII text file
(`gal_txt_table_info', `gal_txt_table_read', `gal_txt_image_read') now
also operate on files with CRLF line terminators.
diff --git a/bin/noisechisel/args.h b/bin/noisechisel/args.h
index 46f4dbf..772b09a 100644
--- a/bin/noisechisel/args.h
+++ b/bin/noisechisel/args.h
@@ -378,6 +378,19 @@ struct argp_option program_options[] =
GAL_OPTIONS_NOT_SET
},
{
+ "dilatengb",
+ UI_KEY_DILATENGB,
+ "INT",
+ 0,
+ "4 or 8 connectivity in final dilation.",
+ ARGS_GROUP_DETECTION,
+ &p->dilatengb,
+ GAL_TYPE_SIZE_T,
+ GAL_OPTIONS_RANGE_ANY,
+ GAL_OPTIONS_MANDATORY,
+ GAL_OPTIONS_NOT_SET
+ },
+ {
"cleandilated",
UI_KEY_CLEANDILATED,
0,
diff --git a/bin/noisechisel/astnoisechisel.conf
b/bin/noisechisel/astnoisechisel.conf
index b0e4f9b..6217e43 100644
--- a/bin/noisechisel/astnoisechisel.conf
+++ b/bin/noisechisel/astnoisechisel.conf
@@ -40,6 +40,7 @@
detsnminarea 10
detquant 0.95
dilate 3
+ dilatengb 8
# Segmentation
segsnminarea 15
diff --git a/bin/noisechisel/detection.c b/bin/noisechisel/detection.c
index e293107..839e8ad 100644
--- a/bin/noisechisel/detection.c
+++ b/bin/noisechisel/detection.c
@@ -976,7 +976,7 @@ detection(struct noisechiselparams *p)
/* If the user asked for dilation, then apply it. */
if(p->dilate)
{
- gal_binary_dilate(workbin, p->dilate, p->input->ndim, 1);
+ gal_binary_dilate(workbin, p->dilate, p->dilatengb==4 ? 1 : 2 , 1);
num_true_initial = gal_binary_connected_components(workbin, &p->olabel,
8);
}
diff --git a/bin/noisechisel/main.h b/bin/noisechisel/main.h
index 25dff0d..bdd7396 100644
--- a/bin/noisechisel/main.h
+++ b/bin/noisechisel/main.h
@@ -73,6 +73,7 @@ struct noisechiselparams
uint8_t checkdetsn; /* Save pseudo-detection S/N values. */
float detquant; /* True detection quantile. */
size_t dilate; /* Number of times to dilate true dets. */
+ size_t dilatengb; /* Connectivity for final dilation. */
uint8_t cleandilated; /* Remove dilated objects with small S/N. */
uint8_t checkdetection; /* Save all detection steps to a file. */
uint8_t checksky; /* Check the Sky value estimation. */
diff --git a/bin/noisechisel/ui.c b/bin/noisechisel/ui.c
index 3165f33..c09bc49 100644
--- a/bin/noisechisel/ui.c
+++ b/bin/noisechisel/ui.c
@@ -221,13 +221,16 @@ parse_opt(int key, char *arg, struct argp_state *state)
static void
ui_read_check_only_options(struct noisechiselparams *p)
{
- /* Make sure the connectivity is defined. */
+ /* Make sure the connectivities have the correct values. */
if(p->erodengb!=4 && p->erodengb!=8)
error(EXIT_FAILURE, 0, "%zu not acceptable for `--erodengb'. It must "
"be 4 or 8 (specifying the type of connectivity)", p->erodengb);
if(p->openingngb!=4 && p->openingngb!=8)
error(EXIT_FAILURE, 0, "%zu not acceptable for `--openingngb'. It must "
"be 4 or 8 (specifying the type of connectivity)", p->openingngb);
+ if(p->dilatengb!=4 && p->dilatengb!=8)
+ error(EXIT_FAILURE, 0, "%zu not acceptable for `--dilatengb'. It must "
+ "be 4 or 8 (specifying the type of connectivity)", p->dilatengb);
/* Make sure that the no-erode-quantile is not smaller or equal to
qthresh. */
diff --git a/bin/noisechisel/ui.h b/bin/noisechisel/ui.h
index 8c0d3d6..416cd76 100644
--- a/bin/noisechisel/ui.h
+++ b/bin/noisechisel/ui.h
@@ -71,6 +71,7 @@ enum option_keys_enum
UI_KEY_OPENINGNGB,
UI_KEY_CHECKDETSKY,
UI_KEY_CHECKDETSN,
+ UI_KEY_DILATENGB,
UI_KEY_CLEANDILATED,
UI_KEY_CHECKDETECTION,
UI_KEY_CHECKSKY,
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index ff175d9..818b5c7 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -12160,6 +12160,11 @@ give this option a value of 1 (only the largest valued
pixel in the input
will not be eroded).
@item
address@hidden: to specify the final dilation connectivity. Prior to
+Gnuastro 0.4, it was assumed to be 8 (maximum connectivity in a 2D image
+where each pixel has 8 neighbors).
+
address@hidden
@option{--cleandilated}: After dilation, if the signal-to-noise ratio of a
detection is less than the derived pseudo-detection S/N limit, that
detection will be discarded. In an ideal/clean noise, a true detection's
@@ -12629,6 +12634,10 @@ neighborhood. This is because astronomical objects,
except cosmic rays,
never have a clear cutoff, so all the 8-pixels connected to the border
pixels of a detection might harbor data.
address@hidden --dilatengb=INT
+The connectivity used for the final dilation, see @option{--erodengb} for
+more information about connectivity or a structuring element.
+
@item --checkdetection
Every step of the detection process will be added as an extension to a file
with the suffix @file{_det.fits}. Going through each would just be a repeat
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master eadb72c: Configurable final dilation connectivity in NoiseChisel,
Mohammad Akhlaghi <=