gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 97845f9: NoiseChisel: new --pseudoconcomp for


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 97845f9: NoiseChisel: new --pseudoconcomp for connectivity of pseudo-dets
Date: Sat, 16 Feb 2019 21:17:57 -0500 (EST)

branch: master
commit 97845f99cfc16c2ca65b6a7b227f8f35dfcbd30c
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    NoiseChisel: new --pseudoconcomp for connectivity of pseudo-dets
    
    This new option allows specifying what kind of connectivity is used for
    identifying pseudo-detections. Until now this option was hard-coded in
    NoiseChisel, so it was necessary to allow the user to set any connectivity
    they prefer for their dataset.
---
 NEWS                                |  7 +++++++
 bin/noisechisel/args.h              | 13 +++++++++++++
 bin/noisechisel/astnoisechisel.conf |  1 +
 bin/noisechisel/detection.c         |  3 ++-
 bin/noisechisel/main.h              |  1 +
 bin/noisechisel/ui.c                |  4 ++++
 bin/noisechisel/ui.h                |  1 +
 doc/gnuastro.texi                   | 17 +++++++++++++++++
 8 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 0190a3b..6bacbd9 100644
--- a/NEWS
+++ b/NEWS
@@ -50,6 +50,13 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
      second input. This greatly simplifies the mergining of different table
      columns into one.
 
+  NoiseChisel:
+   --pseudoconcomp: allows setting the connectivity (4 or 8, in a 2D image)
+     to define separate pseudo-detections. If its stronger,
+     pseudo-detections that are touching on the corner will be identified
+     as one. Until this version, this was hard-written into the code and
+     was the weakest connectivity (4-connected in a 2D image).
+
   Library:
     GAL_BLANK_LONG: new macro for the `long' type blank value.
     GAL_BLANK_ULONG: new macro for the `unsigned long' type blank value.
diff --git a/bin/noisechisel/args.h b/bin/noisechisel/args.h
index a775377..19bb426 100644
--- a/bin/noisechisel/args.h
+++ b/bin/noisechisel/args.h
@@ -422,6 +422,19 @@ struct argp_option program_options[] =
       GAL_OPTIONS_NOT_SET
     },
     {
+      "pseudoconcomp",
+      UI_KEY_PSEUDOCONCOMP,
+      "INT",
+      0,
+      "4 or 8 neighbors for labeling pseudo-dets.",
+      UI_GROUP_DETECTION,
+      &p->pseudoconcomp,
+      GAL_TYPE_SIZE_T,
+      GAL_OPTIONS_RANGE_GT_0,
+      GAL_OPTIONS_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
+    {
       "snminarea",
       UI_KEY_SNMINAREA,
       "INT",
diff --git a/bin/noisechisel/astnoisechisel.conf 
b/bin/noisechisel/astnoisechisel.conf
index 2362820..43c1476 100644
--- a/bin/noisechisel/astnoisechisel.conf
+++ b/bin/noisechisel/astnoisechisel.conf
@@ -40,6 +40,7 @@
  sigmaclip           3,0.2
  dthresh               0.0
  holengb                 8
+ pseudoconcomp           8
  snminarea              10
  minnumfalse           100
  snquant              0.99
diff --git a/bin/noisechisel/detection.c b/bin/noisechisel/detection.c
index 6a1786a..1af2355 100644
--- a/bin/noisechisel/detection.c
+++ b/bin/noisechisel/detection.c
@@ -327,6 +327,7 @@ detection_pseudo_find(struct noisechiselparams *p, 
gal_data_t *workbin,
   float *f;
   uint8_t *b, *bf;
   gal_data_t *bin;
+  int con=p->pseudoconcomp==4 ? 1 : 2;
   struct fho_params fho_prm={0, NULL, workbin, worklab, p};
 
 
@@ -441,7 +442,7 @@ detection_pseudo_find(struct noisechiselparams *p, 
gal_data_t *workbin,
       do if(*b==GAL_BLANK_UINT8) *b = !s0d1; while(++b<bf);
     }
   */
-  return gal_binary_connected_components(workbin, &worklab, 1);
+  return gal_binary_connected_components(workbin, &worklab, con);
 }
 
 
diff --git a/bin/noisechisel/main.h b/bin/noisechisel/main.h
index be10387..b38686e 100644
--- a/bin/noisechisel/main.h
+++ b/bin/noisechisel/main.h
@@ -74,6 +74,7 @@ struct noisechiselparams
   uint8_t         checkdetsky;  /* Check pseudo-detection sky value.      */
   float               dthresh;  /* Sigma threshold for Pseudo-detections. */
   size_t              holengb;  /* Connectivity for defining a hole.      */
+  size_t        pseudoconcomp;  /* Connectivity for connected components. */
   size_t            snminarea;  /* Minimum pseudo-detection area for S/N. */
   uint8_t             checksn;  /* Save pseudo-detection S/N values.      */
   size_t          minnumfalse;  /* Min No. of det/seg for true quantile.  */
diff --git a/bin/noisechisel/ui.c b/bin/noisechisel/ui.c
index 71747ea..e66a8d2 100644
--- a/bin/noisechisel/ui.c
+++ b/bin/noisechisel/ui.c
@@ -237,6 +237,10 @@ ui_read_check_only_options(struct noisechiselparams *p)
   if(p->holengb!=4 && p->holengb!=8)
     error(EXIT_FAILURE, 0, "%zu not acceptable for `--holengb'. It must "
           "be 4 or 8 (specifying the type of connectivity)", p->holengb);
+  if(p->pseudoconcomp!=4 && p->pseudoconcomp!=8)
+    error(EXIT_FAILURE, 0, "%zu not acceptable for `--pseudoconcomp'. It "
+          "must be 4 or 8 (specifying the type of connectivity)",
+          p->pseudoconcomp);
 
   /* 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 542a54a..66f32cc 100644
--- a/bin/noisechisel/ui.h
+++ b/bin/noisechisel/ui.h
@@ -93,6 +93,7 @@ enum option_keys_enum
   UI_KEY_SKYFRACNOBLANK,
   UI_KEY_CHECKDETSKY,
   UI_KEY_HOLENGB,
+  UI_KEY_PSEUDOCONCOMP,
   UI_KEY_CHECKSN,
   UI_KEY_DETGROWMAXHOLESIZE,
   UI_KEY_CLEANGROWNDET,
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 1739647..d056a75 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -16487,6 +16487,17 @@ the image. For more, see the description of this 
option in @ref{Detection
 options}.
 
 @item
address@hidden: The connectivity (defined by the number of neighbors)
+to fill holes after applying @option{--dthresh} (above) to find
+pseudo-detections. For more, see the description of this option in
address@hidden options}.
+
address@hidden
address@hidden: The connectivity (defined by the number of
+neighbors) to find individual pseudo-detections. For more, see the
+description of this option in @ref{Detection options}.
+
address@hidden
 @option{--detgrowquant}: is used to grow the final true detections until a
 given quantile in the same way that clumps are grown during segmentation
 (compare columns 2 and 3 in Figure 10 of the paper). It replaces the old
@@ -17002,6 +17013,12 @@ walls of the hole are 4-connected. If standard (near 
Sky level) values are
 given to @option{--dthresh}, setting @option{--holengb=4}, might fill the
 complete dataset and thus not create enough pseudo-detections.
 
address@hidden --pseudoconcomp=INT
+The connectivity (defined by the number of neighbors) to find individual
+pseudo-detections. If it is a weaker connectivity (4 in a 2D image), then
+pseudo-detections that are connected on the corners will be treated as
+separate.
+
 @item -m INT
 @itemx --snminarea=INT
 The minimum area to calculate the Signal to noise ratio on the



reply via email to

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