taskGNU Astronomy Utilities - Tasks: task #13574, Utility to do arithmetic...

 
 

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

task #13574: Utility to do arithmetic operations on images

Submitter:  Mohammad Akhlaghi <makhlaghi>
Submitted:  Mon 20 Apr 2015 11:36:21 AM UTC
   
 
Should Start On:  Sun 19 Apr 2015 03:00:00 PM UTC Should be Finished on:  Sun 19 Apr 2015 03:00:00 PM UTC
Category:  Arithmetic Priority:  7 - High
Item Group:  None Status:  Done
Privacy:  Public Assigned to:  makhlaghi
Percent Complete:  100% Open/Closed:  Closed
Effort:  0.00

Tue 21 Apr 2015 11:33:01 AM UTC, comment #2: 

== Just a brainstorm ==

If it is decided to add functions (like where below), then add simple statistical functions too, for example `min' or `max'.

Adding functions will be hard work, but it will be extremely useful.

For example


$ astimgop -afile1.fits -bfile2.fits --output=out.fits \
           b[where(a!=0)]=min(b)


I know this is a lot of hard work! but Just for a brainstorm!

Mohammad Akhlaghi <makhlaghi>
Group administrator
Tue 21 Apr 2015 09:36:04 AM UTC, comment #1: 

==New suggestion==
Also adding an ability like Numpy's `where' function in Python would be really convenient to only do operations on certain pixels in an image.

For example
b[where(a>3)]=1

=Example=
Generally, what I have in mind would look something like the following.

ImageOperator (astimgop)

Multiple operations can be done with one command (separated by `;' like in C). The output will be the result of the final operation.


$ astimgop -afile1.fits -bfile2.fits --output=out.fits \
           a+b


or for the suggestion above and using multiple statements:


$ astimgop -afile1.fits -bfile2.fits --output=out.fits \
           "b[where(a>3)]=1;b+25"


Mohammad Akhlaghi <makhlaghi>
Group administrator
Mon 20 Apr 2015 11:36:21 AM UTC, original submission:  

This utility should get any number of input images and do any form of operations on them including arithmetic operations (to add, subtract or multiply images) or bitwise operations (mainly used in masks for astronomical data).

For a start the syntax can use prefix notation:

http://en.wikipedia.org/wiki/Polish_notation

or prefix notation:

http://en.wikipedia.org/wiki/Reverse_Polish_notation 

The good thing with these two notations is taht there is no need for parenthesis. There are also converters of infix notation (the ordinary method where parenthesis are needed for unambiguous results) to postfix notation, for example the Shunting-yard algorithm:

http://en.wikipedia.org/wiki/Shunting-yard_algorithm

There is a very nice explanation with a full program here:

http://en.literateprograms.org/Shunting_yard_algorithm_%28C%29

Mohammad Akhlaghi <makhlaghi>
Group administrator

 

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

    Date Changed by Updated Field Previous Value => Replaced by
    2016-01-28 makhlaghi Percent Complete10% 100%
        Open/ClosedOpen Closed
    2016-01-28 makhlaghi StatusIn Progress Done
    2016-01-26 makhlaghi CategoryNew program Arithmetic
    2016-01-25 makhlaghi StatusPostponed In Progress
        Percent Complete0% 10%
        Assigned toNone makhlaghi
    2015-04-20 makhlaghi Priority5 - Normal 7 - High
        StatusNone Postponed
    2015-04-20 makhlaghi SummaryUtility to do operations on images Utility to do arithmetic operations on images

    Back to the top

    Powered by Savane 3.13-04b1.
    Corresponding source code