bugGNU Astronomy Utilities - Bugs: bug #50099, Cropping of small regions fails

 
 

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

bug #50099: Cropping of small regions fails

Submitter:  Lee Kelvin <leeskelvin>
Submitted:  Thu 19 Jan 2017 09:46:43 PM UTC
 
Category:  Crop Severity:  4 - Important
Item Group:  Crash Status:  Fixed
Privacy:  Public Assigned to:  makhlaghi
Open/Closed:  Closed

Thu 19 Jan 2017 10:13:02 PM UTC, comment #3: 

By the way, with that commit, the second bug you reported is also corrected (where ImageCrop aborts with: the bottom left corner coordinates). It was indeed an independent bug, caused when the section region would be one pixel wide.

Mohammad Akhlaghi <makhlaghi>
Project Administrator
Thu 19 Jan 2017 10:05:47 PM UTC, comment #2: 

Great bug report. Thanks ;-). I was able to reproduce the problem and fix it thanks to the tests you had already done.

The problem was in the region that is used to check the center of the image (see the explanation under the `--checkcenter' option in the book). When the total number of pixels in the image was smaller than the area of this central region to check we got this problem.

So I added a check to use the image's width (along the dimension(s) that is smaller) when it is smaller than the `--checkcenter' area the user asked for. It has been pushed to the main repo.

Mohammad Akhlaghi <makhlaghi>
Project Administrator
Thu 19 Jan 2017 09:46:43 PM UTC, comment #1: 

This item has been reassigned from the project GNU Astronomy Utilities support tracker to your tracker.

The original report is still available at support #109227

Following are the information included in the original report:

[field #0]                  Item ID: 109227
[field #1]                 Group ID: 11425
[field #2]              Open/Closed: Open
[field #3]                 Severity: 4 - Important
[field #4]                  Privacy: Public
[field #8]                         : Unknown support Field Display Type
[field #9]                 Category: ImageCrop
[field #10]             Submitted by: leeskelvin
[field #11]              Assigned to: None
[field #12]             Submitted on: Fri 20 Jan 2017 02:21:21 AM JST
[field #13]                  Summary: Cropping of small regions fails
[field #14]      Original Submission: When attempting to crop a region with either axis of length 1 pixel or 2 pixels, ImageCrop fails, with different errors.

The attached file 'input.fits' was used to test. This file is a 9x9 FITS image which was cropped from a larger image using the NASA HEASARC program 'fitscopy'. Note that this file was initially produced to test the feature request in support item #109226.

First, I attempted to crop a 2x2 pixel region from the lower-left corner of the image. The command and resultant FITSIO error are shown below:

$ astimgcrop --section=1:3,1:3 input.fits
ImageCrop started on Thu Jan 19 17:06:39 2017
  - Read metadata of 1 images.                    0.000293 seconds

FITSIO status = 307: bad first row number
Attempt to read past end of array:
  Image has  4 elements;
  Tried to read 3 elements starting at element 3.
astimgcrop: Error in CFITSIO, see above.

An output file was produced of size 0 bytes.

Curiously, running this command with an aim to crop regions of varying rectangular size fail, but only to a point. In my testing these dimensions failed: 1:3,1:3; 1:3,1:4; 1:3,1:5. However, 1:3,1:6 succeeded. Note however that varying the dimension of the 1st axis whilst keeping the second axis length fixed always fails (e.g. 1:9,1:3 fails).

Second, I attempted to crop a 1x1 pixel region from the lower-left corner of the image. The command and resultant error are shown below:

$ astimgcrop --section=1:2,1:2 input.fits
ImageCrop started on Thu Jan 19 17:08:08 2017
  - Read metadata of 1 images.                    0.000493 seconds
astimgcrop: the bottom left corner coordinates cannot be larger or equal to the top right's! Your section string (1:2,1:2) has been read as: bottom left coordinate (1, 1) to top right coordinate (1, 1)

No output file is produced after running this second command.

This second command always fails in my testing for any dimension rectangular region where one of the axes is of length 1 pixel.

I believe the causes of these two errors to be separate, but I am unsure, hence my listing them together in this bug report. I'm unsure what may be the cause for the former bug, but it seems like the cause of the latter may be an overly restrictive internal hard-coded limitation.

Regards,
Lee Kelvin

[field #16]               Item Group: Crash
[field #17]                   Status: None
[field #18]        Component Version: None
[field #19]         Operating System: GNU/Linux
[field #20]          Reproducibility: None
[field #21]               Size (loc): None
[field #22]            Fixed Release: None
[field #23]          Planned Release: None
[field #24]                   Effort: 0.00
[field #28]                 Priority: 5 - Normal
[field #31]         Percent Complete: 0%
[field #33]                  Release: None
[field #58]     Custom Select Box #1: None
[field #59]     Custom Select Box #2: None
[field #60]     Custom Select Box #3: None
[field #61]     Custom Select Box #4: None
[field #62]     Custom Select Box #5: None
[field #63]     Custom Select Box #6: None
[field #64]     Custom Select Box #7: None
[field #65]     Custom Select Box #8: None
[field #66]     Custom Select Box #9: None
[field #67]    Custom Select Box #10: None

Mohammad Akhlaghi <makhlaghi>
Project Administrator
Thu 19 Jan 2017 09:46:43 PM UTC, original submission:  

When attempting to crop a region with either axis of length 1 pixel or 2 pixels, ImageCrop fails, with different errors.

The attached file 'input.fits' was used to test. This file is a 9x9 FITS image which was cropped from a larger image using the NASA HEASARC program 'fitscopy'. Note that this file was initially produced to test the feature request in support item #109226.

First, I attempted to crop a 2x2 pixel region from the lower-left corner of the image. The command and resultant FITSIO error are shown below:

$ astimgcrop --section=1:3,1:3 input.fits
ImageCrop started on Thu Jan 19 17:06:39 2017
  - Read metadata of 1 images.                    0.000293 seconds

FITSIO status = 307: bad first row number
Attempt to read past end of array:
  Image has  4 elements;
  Tried to read 3 elements starting at element 3.
astimgcrop: Error in CFITSIO, see above.

An output file was produced of size 0 bytes.

Curiously, running this command with an aim to crop regions of varying rectangular size fail, but only to a point. In my testing these dimensions failed: 1:3,1:3; 1:3,1:4; 1:3,1:5. However, 1:3,1:6 succeeded. Note however that varying the dimension of the 1st axis whilst keeping the second axis length fixed always fails (e.g. 1:9,1:3 fails).

Second, I attempted to crop a 1x1 pixel region from the lower-left corner of the image. The command and resultant error are shown below:

$ astimgcrop --section=1:2,1:2 input.fits
ImageCrop started on Thu Jan 19 17:08:08 2017
  - Read metadata of 1 images.                    0.000493 seconds
astimgcrop: the bottom left corner coordinates cannot be larger or equal to the top right's! Your section string (1:2,1:2) has been read as: bottom left coordinate (1, 1) to top right coordinate (1, 1)

No output file is produced after running this second command.

This second command always fails in my testing for any dimension rectangular region where one of the axes is of length 1 pixel.

I believe the causes of these two errors to be separate, but I am unsure, hence my listing them together in this bug report. I'm unsure what may be the cause for the former bug, but it seems like the cause of the latter may be an overly restrictive internal hard-coded limitation.

Regards,
Lee Kelvin

Lee Kelvin <leeskelvin>
Project Member

 

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

Attached Files
file #39514:  input.fits added by leeskelvin (8KiB - image/fits)

 

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 leeskelvin (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-01-19 makhlaghi CategoryNone Crop
        Item GroupNone Crash
        StatusNone Fixed
        Assigned toNone makhlaghi
        Open/ClosedOpen Closed
    2017-01-19 makhlaghi Reassign itemGNU Astronomy Utilities, sr #109227 GNU Astronomy Utilities, bug #50099

    Back to the top


    Powered by Savane 3.9