taskGNU Astronomy Utilities - Tasks: task #14318, ImgCrop does not create the output...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

task #14318: ImgCrop does not create the output image when the center is blank

Submitter:  Mosè Giordano <giordano>
Submitted:  Sat 21 Jan 2017 05:42:29 PM UTC
   
 
Should Start On:  Fri 20 Jan 2017 11:00:00 PM UTC Should be Finished on:  Fri 20 Jan 2017 11:00:00 PM UTC
Category:  Crop Priority:  5 - Normal
Item Group:  Enhancement Status:  Done
Privacy:  Public Assigned to:  makhlaghi
Percent Complete:  100% Open/Closed:  Closed
Effort:  0.00

Jump to the original submission

Sun 22 Jan 2017 03:19:37 PM UTC, comment #6: 

Ok ok, I misread the commit message: I thought that the center is not checked by default in section mode, instead it isn't checked at all.  Anyway, good job!

Mosè Giordano <giordano>
Group Member
Sun 22 Jan 2017 03:03:53 PM UTC, comment #5: 

Thanks, yes this is the expected behavior: when you use the `--section' option, you have not defined the crop by its center, so it makes no sense to check the center of the crop (you might have done this to do some other thing in this region, e.g., add profiles/images and etc).

So even when you give a value to the `--checkcenter' (`-c') option, no center checking is done when the crop is not defined by its center.

As an alternative you can see the effect of checking the center with this command (in the `tests/' directory):


$ ../bin/imgcrop/astimgcrop --xc=25 --yc=25 --iwidth=51 --checkcenter=3 mkprofcat1.fits
ImageCrop started on Sun Jan 22 15:56:30 2017
  - Read metadata of 1 image.                     0.000624 seconds
  ---- mkprofcat1_cropped.fits        not created (blank center) from 1 input.
ImageCrop finished in:  0.012872 seconds


If you remove the `--checkcenter=3' option, then the exact same (fully NaN) image will be created as the one your command built:


$ ../bin/imgcrop/astimgcrop --xc=25 --yc=25 --iwidth=51 mkprofcat1.fits
$ astheader mkprofcat1_cropped.fits | grep ICF
ICF1_1  = 'mkprofcat1.fits'
ICF1PIX = '1:50,1:50'          / Range of pixels used for this output.


Could you have a look a the new "ImageCrop modes" section of the book (it has been fully re-written):


$ info gnuastro "ImageCrop modes"


After reading this, the new behavior should become more understandable, so your comments (on making it better/more-clear or resolving other issues) on it would be really great.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Sun 22 Jan 2017 02:13:16 PM UTC, comment #4: 

Sorry for coming late.  I didn't have a strong opinion on what could have been the best solution, my aim was just to point out that old behavior may be confusing.

In any case, your solution (if I understood it correctly) looks perfect!

However, running this command in tests/ directory

../bin/imgcrop/astimgcrop -c 3 --section=1:50,1:50 mkprofcat1.fits

results in a NaN-only file being created.  Am I missing something?

Mosè Giordano <giordano>
Group Member
Sun 22 Jan 2017 02:29:53 AM UTC, comment #3: 

This task has been done and pushed to master.

This task resulted in some interesting changes in ImageCrop which are fully described in the commit message. Thanks alot Mosè, for bringing up this issue.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Sat 21 Jan 2017 07:38:19 PM UTC, comment #2: 

I am now working on these corrections ...

But please feel free to post comments/suggestions in the meantime.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Sat 21 Jan 2017 06:09:38 PM UTC, comment #1: 

Thanks, you are right!

Ideally checking the center of a crop is useful when the user has defined the crop with a center (for example through a catalog, or the `--xc', `--yc', `--ra', or `--dec' options). But currently this center check is applied to any cropped region, for example even when the user specifies the cropped region with `--section' or `--polygon'.

So what do think about this list of actions to do with this task?

  • Only check the center when the user has defined the crop by its center coordinates (not in `--polygon' or `--section' mode).


  • Set the default `--checkcenter' value to 0. In this case, no check will be done even if the user gaves a center to define the crop. From the principle of least astonishment, the user would expect a cropped file even if its blank. Also the user might want to go through the files with a loop and having some missing numbers can mess up their work. If the user asks for any value larger than 0, then we will check the center (and not make an output file) when a center coordinate was input.


  • When a crop is blank in the center and no file is created, let the user know through a less cryptic way (currently its just the last `0' or `1' in the stdout and in the log file). For example explicity writing `created' or `not-created' (since the first column is the file name).
Mohammad Akhlaghi <makhlaghi>
Group administrator
Sat 21 Jan 2017 05:42:29 PM UTC, original submission:  

When an image is cropped and the center of the resulting image would have a blank pixel, the output file is not created (unless one uses "--checkcenter=N" with N high enough, or "--zeroisnotblank" when the original pixels are zeros).  This is somewhat confusing at first and the output message of the program doesn't clearly explain the reason what happened.

I see the point of not creating the file, but I'd suggest to print a warning.

Mosè Giordano <giordano>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by makhlaghi (Posted a comment)
  • -email is unavailable- added by giordano (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-01-22 makhlaghi StatusIn Progress Done
        Percent Complete10% 100%
        Open/ClosedOpen Closed
    2017-01-21 makhlaghi Item GroupNone Enhancement
        StatusNone In Progress
        Percent Complete0% 10%
        Assigned toNone makhlaghi

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code