gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 8eb178da: fits-view: adding support for DS9 re


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 8eb178da: fits-view: adding support for DS9 region(s)
Date: Mon, 3 Jun 2024 14:24:08 -0400 (EDT)

branch: master
commit 8eb178da88228222f65e174c27561ae25788dda6
Author: Giacomo Lorenzetti <glorenzetti@cefca.es>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    fits-view: adding support for DS9 region(s)
    
    Until now, DS9 regions could either be loaded manually inside the DS9
    window, or to give the DS9 commands to load regions with the '--ds9extra'
    option of this script. But both were inconvenient.
    
    With this commit, a new option ('--ds9region') is added to the script,
    allowing to load any number of regions with a simple interface.
---
 bin/script/fits-view.sh | 16 ++++++++++++++++
 doc/gnuastro.texi       |  5 +++++
 2 files changed, 21 insertions(+)

diff --git a/bin/script/fits-view.sh b/bin/script/fits-view.sh
index 3742cc2f..b979d531 100644
--- a/bin/script/fits-view.sh
+++ b/bin/script/fits-view.sh
@@ -46,6 +46,7 @@ ds9mode=""
 ds9scale=""
 ds9extra=""
 ds9center=""
+ds9region=""
 globalhdu=""
 ds9geometry=""
 version=@VERSION@
@@ -100,6 +101,7 @@ $scriptname options:
   -e, --ds9extra=STR      Extra options to pass to DS9 after default ones.
   -s, --ds9scale=STR      Custom value to '-scale' option in DS9.
   -c, --ds9center=FLT,FLT Coordinates of center in shown DS9 window.
+  -r, --ds9region=STR[,...] DS9 region(s) to load.
   -O, --ds9mode=img/wcs   Coord system to interpret '--ds9center' (img/wcs).
   -m, --ds9colorbarmulti  Separate color bars for each loaded image.
   -p, --prefix=STR        Directory containing DS9 or TOPCAT executables.
@@ -214,6 +216,9 @@ do
         -c|--ds9center)       ds9center="$2";                      check_v 
"$1" "$ds9center"; shift;shift;;
         -c=*|--ds9center=*)   ds9center="${1#*=}";                 check_v 
"$1" "$ds9center"; shift;;
         -c*)                  ds9center=$(echo "$1"  | sed -e's/-s//');  
check_v "$1" "$ds9center"; shift;;
+        -r|--ds9region)       ds9region="$2";                      check_v 
"$1" "$ds9region"; shift;shift;;
+        -r=*|--ds9region=*)   ds9region="${1#*=}";                 check_v 
"$1" "$ds9region"; shift;;
+        -r*)                  ds9region=$(echo "$1"  | sed -e's/-r//');  
check_v "$1" "$ds9region"; shift;;
         -O|--ds9mode)         ds9mode="$2";                       check_v "$1" 
"$ds9mode"; shift;shift;;
         -O=*|--ds9mode=*)     ds9mode="${1#*=}";                  check_v "$1" 
"$ds9mode"; shift;;
         -O*)                  ds9mode=$(echo "$1"  | sed -e's/-s//');  check_v 
"$1" "$ds9mode"; shift;;
@@ -351,6 +356,15 @@ ds9scaleopt="-scale $ds9scale"
 
 
 
+#Set the DS9 region(s) to load.
+if [ ! x"$ds9region" = x ]; then
+  ds9region="-region "$(echo $ds9region | sed 's/,/ -region /g')
+fi
+
+
+
+
+
 # Set the DS9 pan option.
 ds9pan=""
 if [ x"$ds9center" != x ]; then
@@ -472,6 +486,7 @@ else
                                      -view multi $multicolorbars \
                                      -lock slice image \
                                      $ds9pan \
+                                     $ds9region \
                                      $ds9extra"
                 else
 
@@ -499,6 +514,7 @@ else
                                      -colorbar lock yes \
                                      -view multi $multicolorbars \
                                      $ds9pan \
+                                     $ds9region \
                                      $ds9extra"
                 fi
 
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 193dfe5f..e92f699d 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -34341,6 +34341,11 @@ The central coordinate for DS9's view of the FITS 
image after it opens.
 This is equivalent to the ``Pan'' button in DS9.
 The nature of the coordinates will be determined by the @option{--ds9mode} 
option that is described below.
 
+@item -r=STR[,STR[,STR]]
+@itemx --ds9region=STR[,STR[,STR]]
+Name of DS9 region file(s) to load within the DS9 window once it opens.
+Any number of region files can be loaded with a single call to this command 
(separated by comas).
+
 @item -O img/wcs
 @itemx --ds9mode=img/wcs
 The coordinate system (or mode) to interpret the values given to 
@option{--ds9center}.



reply via email to

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