gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master c5bf881 4/4: gal_fits_img_read also reads WCS


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master c5bf881 4/4: gal_fits_img_read also reads WCS
Date: Sun, 1 Oct 2017 21:51:34 -0400 (EDT)

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

    gal_fits_img_read also reads WCS
    
    Until now the two library functions that were used to read a FITS
    image/array wouldn't read the WCS. In the programs, the separate
    `gal_wcs_read' function was used to read the WCS structure. However,
    ultimately the WCS structure of a FITS extension is part of that extension
    (and is also included in the generic data container). Therefore it is
    counter intuitive for `gal_fits_img_read' and `gal_fits_img_read_to_type'
    to not read the WCS structure.
    
    With this commit, these two FITS image extension reader functions also read
    the WCS information and put it in their output data container.
    
    Also, the default `--detgrowquant' was slightly raised to 0.7 (from 0.65)
    to be less affected by correlated noise.
---
 NEWS                                |  6 ++++++
 bin/arithmetic/arithmetic.c         |  9 ++++++---
 bin/arithmetic/operands.c           | 21 +++++++++++++++------
 bin/convertt/ui.c                   |  3 +--
 bin/convolve/ui.c                   | 10 +++++-----
 bin/mkcatalog/ui.c                  | 18 ++++++------------
 bin/mknoise/ui.c                    |  6 +-----
 bin/mkprof/ui.c                     | 17 +++++++++++++----
 bin/noisechisel/astnoisechisel.conf |  2 +-
 bin/noisechisel/ui.c                |  3 +--
 bin/statistics/ui.c                 |  5 +----
 bin/warp/ui.c                       |  6 ++----
 doc/gnuastro.texi                   | 27 ++++++++++++++++++---------
 lib/fits.c                          | 17 ++++++++++++-----
 lib/gnuastro/fits.h                 |  8 +++++---
 tests/buildprog/simpleio.c          |  2 +-
 tests/lib/multithread.c             |  2 +-
 17 files changed, 95 insertions(+), 67 deletions(-)

diff --git a/NEWS b/NEWS
index 04e9a28..ae40f2e 100644
--- a/NEWS
+++ b/NEWS
@@ -53,6 +53,12 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
   accept a new `withblank' option to set all pixels that are blank in the
   tile's block to be blank in the check image.
 
+  `gal_fits_img_read' and `gal_fits_img_read_to_type' now also read the WCS
+  structure of the extension/HDU in a FITS file and have two extra
+  arguments: `hstartwcs' and `hendwcs'. With these options it is possible
+  to limit the range of header keywords to read the WCS, similar to how
+  they are used in `gal_wcs_read'.
+
 ** Bug fixes
 
   ConvertType crash when changing values (bug #52010).
diff --git a/bin/arithmetic/arithmetic.c b/bin/arithmetic/arithmetic.c
index 622af73..b213e7d 100644
--- a/bin/arithmetic/arithmetic.c
+++ b/bin/arithmetic/arithmetic.c
@@ -335,7 +335,7 @@ reversepolish(struct arithmeticparams *p)
     error(EXIT_FAILURE, 0, "too many operands");
 
 
-  /* If the final operand has a filename, but it `data' element is NULL,
+  /* If the final operand has a filename, but its `data' element is NULL,
      then the file hasn't actually be read yet. In this case, we need to
      read the contents of the file and put the resulting dataset into the
      operands `data' element. This can happen for example if no operators
@@ -348,8 +348,11 @@ reversepolish(struct arithmeticparams *p)
       filename=p->operands->filename;
       if( gal_fits_name_is_fits(filename) )
         {
-          p->operands->data=gal_fits_img_read(filename,hdu,p->cp.minmapsize);
-          p->refdata.wcs=gal_wcs_read(filename, hdu, 0, 0, &p->refdata.nwcs);
+          p->operands->data=gal_fits_img_read(filename,hdu,p->cp.minmapsize,
+                                              0, 0);
+          p->refdata.wcs=p->operands->data->wcs;
+          p->refdata.nwcs=p->operands->data->nwcs;
+          p->operands->data->wcs=NULL;
           if(!p->cp.quiet) printf(" - %s (hdu %s) is read.\n", filename, hdu);
         }
       else
diff --git a/bin/arithmetic/operands.c b/bin/arithmetic/operands.c
index 585ea0b..76fd166 100644
--- a/bin/arithmetic/operands.c
+++ b/bin/arithmetic/operands.c
@@ -121,13 +121,22 @@ operands_pop(struct arithmeticparams *p, char *operator)
       hdu=operands->hdu;
       filename=operands->filename;
 
-      /* In case this is the first image that is read, then read the WCS
-         information.*/
-      if(p->popcounter==0)
-        p->refdata.wcs=gal_wcs_read(filename, hdu, 0, 0, &p->refdata.nwcs);
-
       /* Read the dataset. */
-      data=gal_fits_img_read(filename, hdu, p->cp.minmapsize);
+      data=gal_fits_img_read(filename, hdu, p->cp.minmapsize, 0, 0);
+
+      /* In case this is the first image that is read, then keep the WCS
+         information in the `refdata' structure. Otherwise, the WCS is not
+         necessary and we can safely free it. In any case, `data' must not
+         have a WCS structure. */
+      if(p->popcounter==0)
+        {
+          p->refdata.wcs=data->wcs;
+          p->refdata.nwcs=data->nwcs;
+        }
+      else
+        wcsfree(data->wcs);
+      data->wcs=NULL;
+      data->nwcs=0;
 
       /* When the reference data structure's dimensionality is non-zero, it
          means that this is not the first image read. So, write its basic
diff --git a/bin/convertt/ui.c b/bin/convertt/ui.c
index 2f9f4d2..e52d85b 100644
--- a/bin/convertt/ui.c
+++ b/bin/convertt/ui.c
@@ -433,8 +433,7 @@ ui_make_channels_ll(struct converttparams *p)
                   "for each input FITS image (in the same order)");
 
           /* Read in the array and its WCS information. */
-          data=gal_fits_img_read(name->v, hdu, p->cp.minmapsize);
-          data->wcs=gal_wcs_read(name->v, hdu, 0, 0, &data->nwcs);
+          data=gal_fits_img_read(name->v, hdu, p->cp.minmapsize, 0, 0);
           gal_list_data_add(&p->chll, data);
 
           /* A FITS file only has one channel. */
diff --git a/bin/convolve/ui.c b/bin/convolve/ui.c
index 3fbb912..cff73b9 100644
--- a/bin/convolve/ui.c
+++ b/bin/convolve/ui.c
@@ -304,8 +304,9 @@ ui_read_kernel(struct convolveparams *p)
 
   /* Read the image into file. */
   p->kernel = gal_fits_img_read_to_type(p->kernelname, p->khdu,
-                                        GAL_TYPE_FLOAT32,
-                                        p->cp.minmapsize);
+                                        GAL_TYPE_FLOAT32, p->cp.minmapsize,
+                                        0, 0);
+  if(p->kernel->wcs) { wcsfree(p->kernel->wcs); p->kernel->wcs=NULL; }
 
   /* Convert all the NaN pixels to zero if the kernel contains blank
      pixels, also update the flags so it is not checked any more. */
@@ -350,10 +351,9 @@ ui_preparations(struct convolveparams *p)
     }
 
 
-  /* Read the input image as a float64 array and its WCS info. */
+  /* Read the input image as a float64 array. */
   p->input=gal_fits_img_read_to_type(p->filename, cp->hdu,
-                                     GAL_TYPE_FLOAT32, cp->minmapsize);
-  p->input->wcs=gal_wcs_read(p->filename, cp->hdu, 0, 0, &p->input->nwcs);
+                                     GAL_TYPE_FLOAT32, cp->minmapsize, 0, 0);
 
 
   /* Currently Convolve only works on 2D images. */
diff --git a/bin/mkcatalog/ui.c b/bin/mkcatalog/ui.c
index 87f95a1..4e89812 100644
--- a/bin/mkcatalog/ui.c
+++ b/bin/mkcatalog/ui.c
@@ -340,7 +340,7 @@ ui_preparations_read_inputs(struct mkcatalogparams *p)
 
   /* Read the input image. */
   p->input=gal_fits_img_read_to_type(p->inputname, p->cp.hdu,
-                                     GAL_TYPE_FLOAT32, p->cp.minmapsize);
+                                     GAL_TYPE_FLOAT32, p->cp.minmapsize, 0,0);
 
 
   /* Currently MakeCatalog is only implemented for 2D images. */
@@ -356,7 +356,7 @@ ui_preparations_read_inputs(struct mkcatalogparams *p)
 
   /* Read the object label image and check its size. */
   p->objects = gal_fits_img_read(objectsfile, p->objectshdu,
-                                 p->cp.minmapsize);
+                                 p->cp.minmapsize, 0, 0);
   if( gal_data_dsize_is_different(p->input, p->objects) )
     error(EXIT_FAILURE, 0, "`%s' (hdu: %s) and `%s' (hdu: %s) have a"
           "different dimension/size", objectsfile, p->objectshdu,
@@ -365,7 +365,7 @@ ui_preparations_read_inputs(struct mkcatalogparams *p)
 
   /* Read the Sky image and check its size. */
   p->sky=gal_fits_img_read_to_type(skyfile, p->skyhdu, GAL_TYPE_FLOAT32,
-                                   p->cp.minmapsize);
+                                   p->cp.minmapsize, 0, 0);
   if( gal_data_dsize_is_different(p->input, p->sky) )
     error(EXIT_FAILURE, 0, "`%s' (hdu: %s) and `%s' (hdu: %s) have a"
           "different dimension/size", skyfile, p->skyhdu, p->inputname,
@@ -374,7 +374,7 @@ ui_preparations_read_inputs(struct mkcatalogparams *p)
 
   /* Read the Sky standard deviation image and check its size. */
   p->std=gal_fits_img_read_to_type(stdfile, p->stdhdu, GAL_TYPE_FLOAT32,
-                                   p->cp.minmapsize);
+                                   p->cp.minmapsize, 0, 0);
   if( gal_data_dsize_is_different(p->input, p->std) )
     error(EXIT_FAILURE, 0, "`%s' (hdu: %s) and `%s' (hdu: %s) have a"
           "different dimension/size", stdfile, p->stdhdu, p->inputname,
@@ -386,7 +386,7 @@ ui_preparations_read_inputs(struct mkcatalogparams *p)
     {
       /* Read the mask image. */
       p->upmask = gal_fits_img_read(p->upmaskfile, p->upmaskhdu,
-                                    p->cp.minmapsize);
+                                    p->cp.minmapsize, 0, 0);
       if( gal_data_dsize_is_different(p->input, p->upmask) )
         error(EXIT_FAILURE, 0, "`%s' (hdu: %s) and `%s' (hdu: %s) have a"
               "different dimension/size", p->upmaskfile, p->upmaskhdu,
@@ -442,7 +442,7 @@ ui_preparations_read_inputs(struct mkcatalogparams *p)
 
       /* Read the clumps image and check its size. */
       p->clumps = gal_fits_img_read(clumpsfile, p->clumpshdu,
-                                    p->cp.minmapsize);
+                                    p->cp.minmapsize, 0, 0);
       if( gal_data_dsize_is_different(p->input, p->std) )
         error(EXIT_FAILURE, 0, "`%s' (hdu: %s) and `%s' (hdu: %s) have a"
               "different dimension/size", clumpsfile, p->clumpshdu,
@@ -481,12 +481,6 @@ ui_preparations_read_inputs(struct mkcatalogparams *p)
     p->clumps=gal_data_copy_to_new_type_free(p->clumps, GAL_TYPE_INT32);
 
 
-  /* Read the WCS structure of the input dataset. Even if no WCS-related
-     columns are requested, we still need it to report the pixel area of
-     the input dataset. */
-  p->input->wcs=gal_wcs_read(p->inputname, p->cp.hdu, 0, 0, &p->input->nwcs);
-
-
   /* Clean up. */
   key->name=NULL;
   gal_data_array_free(key, 1, 1);
diff --git a/bin/mknoise/ui.c b/bin/mknoise/ui.c
index 7388979..606e957 100644
--- a/bin/mknoise/ui.c
+++ b/bin/mknoise/ui.c
@@ -282,11 +282,7 @@ ui_preparations(struct mknoiseparams *p)
 {
   /* Read the input image as a double type */
   p->input=gal_fits_img_read_to_type(p->inputname, p->cp.hdu,
-                                     GAL_TYPE_FLOAT64, p->cp.minmapsize);
-
-
-  /* Read the WSC structure. */
-  p->input->wcs=gal_wcs_read(p->inputname, p->cp.hdu, 0, 0, &p->input->nwcs);
+                                     GAL_TYPE_FLOAT64, p->cp.minmapsize, 0,0);
 
 
   /* If we are dealing with an input table, make sure the format of the
diff --git a/bin/mkprof/ui.c b/bin/mkprof/ui.c
index 33c25bf..fb423ce 100644
--- a/bin/mkprof/ui.c
+++ b/bin/mkprof/ui.c
@@ -1091,14 +1091,26 @@ ui_prepare_canvas(struct mkprofparams *p)
           p->ndim = *(size_t *)(keysll->array);
           keysll->name=NULL;
           gal_data_array_free(keysll, 1, 1);
+
+          /* Read the WCS structure of the background image. */
+          p->wcs=gal_wcs_read(p->backname, p->backhdu, 0, 0, &p->nwcs);
         }
       else
         {
           /* Read the image. */
           p->out=gal_fits_img_read_to_type(p->backname, p->backhdu,
                                            GAL_TYPE_FLOAT32,
-                                           p->cp.minmapsize);
+                                           p->cp.minmapsize, 0, 0);
+
+          /* Put the WCS structure and number of dimensions in the
+             MakeProfiles's main structure for generality. The WCS
+             structure will be put back in the end when writing. */
+          p->wcs=p->out->wcs;
+          p->nwcs=p->out->nwcs;
           p->ndim=p->out->ndim;
+          p->out->wcs=NULL;
+          p->out->nwcs=0;
+
 
           /* If p->dsize was given as an option, free it. */
           if( p->dsize ) free(p->dsize);
@@ -1127,9 +1139,6 @@ ui_prepare_canvas(struct mkprofparams *p)
       if(p->shift) free(p->shift);
       p->shift=gal_data_calloc_array(GAL_TYPE_SIZE_T, p->ndim, __func__,
                                      "p->shift (1)");
-
-      /* Read the WCS structure of the background image. */
-      p->wcs=gal_wcs_read(p->backname, p->backhdu, 0, 0, &p->nwcs);
     }
   else
     {
diff --git a/bin/noisechisel/astnoisechisel.conf 
b/bin/noisechisel/astnoisechisel.conf
index b3ab828..bf44ac6 100644
--- a/bin/noisechisel/astnoisechisel.conf
+++ b/bin/noisechisel/astnoisechisel.conf
@@ -41,7 +41,7 @@
  dthresh            0.0
  detsnminarea        10
  detquant          0.95
- detgrowquant      0.65
+ detgrowquant      0.70
  detgrowmaxholesize 100
 
 # Segmentation
diff --git a/bin/noisechisel/ui.c b/bin/noisechisel/ui.c
index 96731ff..2c72873 100644
--- a/bin/noisechisel/ui.c
+++ b/bin/noisechisel/ui.c
@@ -581,8 +581,7 @@ ui_preparations(struct noisechiselparams *p)
   /* Read the input as a single precision floating point dataset. */
   p->input = gal_fits_img_read_to_type(p->inputname, p->cp.hdu,
                                        GAL_TYPE_FLOAT32,
-                                       p->cp.minmapsize);
-  p->input->wcs=gal_wcs_read(p->inputname, p->cp.hdu, 0, 0, &p->input->nwcs);
+                                       p->cp.minmapsize, 0, 0);
   if(p->input->name==NULL)
     gal_checkset_allocate_copy("INPUT", &p->input->name);
 
diff --git a/bin/statistics/ui.c b/bin/statistics/ui.c
index dd705b5..d1a9de9 100644
--- a/bin/statistics/ui.c
+++ b/bin/statistics/ui.c
@@ -789,10 +789,7 @@ ui_preparations(struct statisticsparams *p)
   if(p->isfits && p->hdu_type==IMAGE_HDU)
     {
       p->inputformat=INPUT_FORMAT_IMAGE;
-      p->input=gal_fits_img_read(p->inputname, cp->hdu, cp->minmapsize);
-      if(p->ontile)
-        p->input->wcs=gal_wcs_read(p->inputname, cp->hdu, 0, 0,
-                                   &p->input->nwcs);
+      p->input=gal_fits_img_read(p->inputname, cp->hdu, cp->minmapsize, 0, 0);
     }
   else
     {
diff --git a/bin/warp/ui.c b/bin/warp/ui.c
index 041d02b..70fa80c 100644
--- a/bin/warp/ui.c
+++ b/bin/warp/ui.c
@@ -347,10 +347,8 @@ ui_check_options_and_arguments(struct warpparams *p)
 
       /* Read the input image as double type and its WCS structure. */
       p->input=gal_fits_img_read_to_type(p->inputname, p->cp.hdu,
-                                         GAL_TYPE_FLOAT64,
-                                         p->cp.minmapsize);
-      p->input->wcs=gal_wcs_read(p->inputname, p->cp.hdu, p->hstartwcs,
-                                 p->hendwcs, &p->input->nwcs);
+                                         GAL_TYPE_FLOAT64, p->cp.minmapsize,
+                                         p->hstartwcs, p->hendwcs);
       if(p->input->wcs)
         {
           p->pixelscale=gal_wcs_pixel_scale(p->input->wcs);
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index c2ce490..52c368e 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -19341,9 +19341,9 @@ this example multiple images are linked together as a 
list:
 @example
 size_t minmapsize=-1;
 gal_data_t *tmp, *list=NULL;
-tmp = gal_fits_img_read("file1.fits", "1", minmapsize);
+tmp = gal_fits_img_read("file1.fits", "1", minmapsize, 0, 0);
 gal_list_data_add( &list, tmp );
-tmp = gal_fits_img_read("file2.fits", "1", minmapsize);
+tmp = gal_fits_img_read("file2.fits", "1", minmapsize, 0, 0);
 gal_list_data_add( &list, tmp );
 @end example
 @end deftypefun
@@ -19779,23 +19779,30 @@ then if the image has a name and units, the 
respective string will be put
 in these pointers.
 @end deftypefun
 
address@hidden {gal_data_t *} gal_fits_img_read (char @code{*filename}, char 
@code{*hdu}, size_t @code{minmapsize})
address@hidden {gal_data_t *} gal_fits_img_read (char @code{*filename}, char 
@code{*hdu}, size_t @code{minmapsize}, size_t @code{hstartwcs}, size_t 
@code{hendwcs})
 Read the contents of the @code{hdu} extension/HDU of @code{filename} into a
 Gnuastro generic data container (see @ref{Generic data container}) and
 return it. If the necessary space is larger than @code{minmapsize}, then
 don't keep the data in RAM, but in a file on the HDD/SSD. For more on
 @code{minmapsize} see the description under the same name in @ref{Generic
 data container}.
+
+The @code{hstartwcs} and @code{hendwcs} arguments are the starting and
+ending header keywords to search for WCS information, if no limit is
+needed, set them to zero. For more on these two options, please see the
+description of @code{gal_wcs_read_fitsptr} in @ref{World Coordinate
+System}.
 @end deftypefun
 
address@hidden {gal_data_t *} gal_fits_img_read_to_type (char 
@code{*inputname}, char @code{*inhdu}, uint8_t @code{type}, size_t 
@code{minmapsize})
address@hidden {gal_data_t *} gal_fits_img_read_to_type (char 
@code{*inputname}, char @code{*inhdu}, uint8_t @code{type}, size_t 
@code{minmapsize}, )
 Read the contents of the @code{hdu} extension/HDU of @code{filename} into a
 Gnuastro generic data container (see @ref{Generic data container}) of type
 @code{type} and return it.
 
 This is just a wrapper around @code{gal_fits_img_read} (to read the
 image/array of any type) and @code{gal_data_copy_to_new_type_free} (to
-convert it to @code{type} and free the initially read dataset).
+convert it to @code{type} and free the initially read dataset). See the
+description there for more.
 @end deftypefun
 
 @cindex NaN
@@ -21104,7 +21111,7 @@ char *filename="input.fits", *hdu="1";
 ...
 
 /* Read the input dataset. */
-input=gal_fits_img_read(filename, hdu, -1);
+input=gal_fits_img_read(filename, hdu, -1, 0, 0);
 
 /* Do a sanity check and preparations. */
 gal_tile_full_sanity_check(filename, hdu, input, &tl);
@@ -22140,7 +22147,8 @@ main(void)
 
 
   /* Read `img.fits' (HDU: 1) as a float32 array. */
-  image=gal_fits_img_read_to_type(filename, hdu, GAL_TYPE_FLOAT32, -1);
+  image=gal_fits_img_read_to_type(filename, hdu, GAL_TYPE_FLOAT32, -1,
+                                  0, 0);
 
 
   /* Use the allocated space as a single precision floating
@@ -22189,7 +22197,8 @@ main(void)
   float *array;
   size_t i, num, *dinc;
   gal_data_t *input=gal_fits_img_read_to_type("input.fits", "1",
-                                              GAL_TYPE_FLOAT32, -1);
+                                              GAL_TYPE_FLOAT32, -1,
+                                              0, 0);
 
   /* To avoid the `void *' pointer and have `dinc'. */
   array=input->array;
@@ -22330,7 +22339,7 @@ main(void)
    * `-1' for `minmapsize' to ensure that the image is read into
    * memory. */
   p.image=gal_fits_img_read_to_type(filename, hdu, GAL_TYPE_FLOAT32,
-                                    -1);
+                                    -1, 0, 0);
 
 
   /* Print some basic information before the actual contents: */
diff --git a/lib/fits.c b/lib/fits.c
index f56a13c..052a5df 100644
--- a/lib/fits.c
+++ b/lib/fits.c
@@ -1502,7 +1502,8 @@ gal_fits_img_info(fitsfile *fptr, int *type, size_t 
*ndim, size_t **dsize,
 
 /* Read a FITS image HDU into a Gnuastro data structure. */
 gal_data_t *
-gal_fits_img_read(char *filename, char *hdu, size_t minmapsize)
+gal_fits_img_read(char *filename, char *hdu, size_t minmapsize,
+                  size_t hstartwcs, size_t hendwcs)
 {
   void *blank;
   long *fpixel;
@@ -1558,6 +1559,10 @@ gal_fits_img_read(char *filename, char *hdu, size_t 
minmapsize)
   free(blank);
 
 
+  /* Read the WCS structure (if the FITS file has any). */
+  img->wcs=gal_wcs_read_fitsptr(fptr, hstartwcs, hendwcs, &img->nwcs);
+
+
   /* Close the input FITS file. */
   fits_close_file(fptr, &status);
   gal_fits_io_error(status, NULL);
@@ -1576,12 +1581,13 @@ gal_fits_img_read(char *filename, char *hdu, size_t 
minmapsize)
    used to convert the input file to the desired type. */
 gal_data_t *
 gal_fits_img_read_to_type(char *inputname, char *hdu, uint8_t type,
-                          size_t minmapsize)
+                          size_t minmapsize, size_t hstartwcs,
+                          size_t hendwcs)
 {
   gal_data_t *in, *converted;
 
   /* Read the specified input image HDU. */
-  in=gal_fits_img_read(inputname, hdu, minmapsize);
+  in=gal_fits_img_read(inputname, hdu, minmapsize, hstartwcs, hendwcs);
 
   /* If the input had another type, convert it to float. */
   if(in->type!=type)
@@ -1608,9 +1614,10 @@ gal_fits_img_read_kernel(char *filename, char *hdu, 
size_t minmapsize)
   gal_data_t *kernel;
   float *f, *fp, tmp;
 
-  /* Read the image as a float */
+  /* Read the image as a float and if it has a WCS structure, free it. */
   kernel=gal_fits_img_read_to_type(filename, hdu, GAL_TYPE_FLOAT32,
-                                   minmapsize);
+                                   minmapsize, 0, 0);
+  if(kernel->wcs) { wcsfree(kernel->wcs); kernel->wcs=NULL; }
 
   /* Check if the size along each dimension of the kernel is an odd
      number. If they are all an odd number, then the for each dimension,
diff --git a/lib/gnuastro/fits.h b/lib/gnuastro/fits.h
index 2744062..906fa63 100644
--- a/lib/gnuastro/fits.h
+++ b/lib/gnuastro/fits.h
@@ -209,11 +209,13 @@ gal_fits_img_info(fitsfile *fptr, int *type, size_t 
*ndim, size_t **dsize,
                   char **name, char **unit);
 
 gal_data_t *
-gal_fits_img_read(char *filename, char *hdu, size_t minmapsize);
+gal_fits_img_read(char *filename, char *hdu, size_t minmapsize,
+                  size_t hstartwcs, size_t hendwcs);
 
 gal_data_t *
-gal_fits_img_read_to_type(char *inputname, char *inhdu, uint8_t type,
-                          size_t minmapsize);
+gal_fits_img_read_to_type(char *inputname, char *hdu, uint8_t type,
+                          size_t minmapsize, size_t hstartwcs,
+                          size_t hendwcs);
 
 gal_data_t *
 gal_fits_img_read_kernel(char *filename, char *hdu, size_t minmapsize);
diff --git a/tests/buildprog/simpleio.c b/tests/buildprog/simpleio.c
index ac34d41..6be745e 100644
--- a/tests/buildprog/simpleio.c
+++ b/tests/buildprog/simpleio.c
@@ -39,7 +39,7 @@ main(int argc, char *argv[])
     }
 
   /* Read the image into memory. */
-  image=gal_fits_img_read(argv[1], argv[2], -1);
+  image=gal_fits_img_read(argv[1], argv[2], -1, 0, 0);
 
   /* Let the user know. */
   printf("%s (hdu %s) is read into memory.\n", argv[1], argv[2]);
diff --git a/tests/lib/multithread.c b/tests/lib/multithread.c
index 1043a41..eaa2945 100644
--- a/tests/lib/multithread.c
+++ b/tests/lib/multithread.c
@@ -95,7 +95,7 @@ main(void)
 
 
   /* Read the image into memory as a float32 data type. */
-  p.image=gal_fits_img_read_to_type(filename, hdu, GAL_TYPE_FLOAT32, -1);
+  p.image=gal_fits_img_read_to_type(filename, hdu, GAL_TYPE_FLOAT32, -1,0,0);
 
 
   /* Print some basic information before the actual contents: */



reply via email to

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