c# pdf viewer winforms : Reorder pages in pdf file Library control class asp.net azure windows ajax Users_Manual12-part270

3
C
HAPTER
2:
FITS Headers
In this chapter . . .
In the next three chapters, , more e detailed information as well l as
exampleswillbeexplainedformanipulatingtheheader,theimagedata,
and the table data respectively.
2.1    Header of an HDU
EveryHDUnormallyhastwocomponents:headeranddata. InPyFITS
thesetwocomponentsareaccessedthroughthetwoattributesoftheHDU,
.header
and
.data
.
WhileanHDUmayhaveemptydata,i.e.the
.data
attributeisNone,
anyHDUwillalwayshave aheader. . WhenanHDUiscreatedwith h a
constructor,e.g.
hdu=PrimaryHDU(data, header)
,theusermaysupplythe
header
valuefromanexistingHDU’sheaderandthe
data
value froma
2.1 Header of an HDU / 3
2.2 The Header Attribute / 4
2.3 Card Images / 6
2.4 Card List / 7
2.5 CONTINUE Cards / 8
2.6 HIERARCH Cards / 9
Reorder pages in pdf file - re-order PDF pages in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Support Customizing Page Order of PDF Document in C# Project
pdf move pages; move pages in pdf file
Reorder pages in pdf file - VB.NET PDF Page Move Library: re-order PDF pages in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Sort PDF Document Pages Using VB.NET Demo Code
how to move pages in pdf reader; how to change page order in pdf acrobat
4
Chapter 2: FITS Headers
numarray. Ifthe e defaults(None)areused, the newHDUwillhavethe
minimal require keyword:
Ausercan use e any y headerand any data to construct t a a newHDU.
PyFITSwillstriptherequiredkeywordsfromtheinputheaderfirstand
thenaddbacktherequiredkeywordscompatibletothenewHDU. So,a
usercanuseatableHDU’sheadertoconstructanimageHDUandvice
versa. The e constructor will l also o ensure the e data a type and dimension
information in the header agree with the data.
2.2     The Header Attribute
2.2.1  Value Access and Update
AsshownintheQuick Tutorial, keywordvaluescanbeaccessedvia
keyword name orindexofan HDU’sheaderattribute. . Hereisaquick
summary:
When reference e by y the e keyword d name, itiscase insensitive. Thus,
prihdr[’abc’]
,
prihdr[’ABC’]
, or
prihdr[’aBc’]
are all equivalent.
akeyword(anditscorrespondingCard)canbedeletedusingthesame
index/name syntax:
>>> hdu = pyfits.PrimaryHDU()
>>> print hdu.header.ascardlist()        # show the keywords
SIMPLE  =                    T / conforms to FITS standard
BITPIX  =                    8 / array data type
NAXIS   =                    0 / number of array dimensions
EXTEND  =                    T
>>> hdulist = pyfits.open(’input.fits’)  # open a FITS file
>>> prihdr = hdulist[0].header           # the primary HDU header
>>> print t prihdr[3]
# get t the e 4th h keyword’s s value
10
>>> prihdr[3] = 20                       # change it’s value
>>> print prihdr[’darkcorr’] ] # # get the value of f the e keyword ’darkcorr’
’OMIT’
>>> prihdr[’darkcorr’]= ’PERFORM’        # change darkcorr’s value
>>> del prihdr[3]
# delete e the 2nd keyword
>>> del prihdr[’abc’]  # get the value of the keyword ’abc’
C# TIFF: How to Reorder, Rearrange & Sort TIFF Pages Using C# Code
C# TIFF - Sort TIFF File Pages Order in C#.NET. Reorder, Rearrange and Sort TIFF Document Pages in C#.NET Application. C# TIFF Page Sorting Overview.
pdf reverse page order online; how to move pages in a pdf file
C# PDF Page Rotate Library: rotate PDF page permanently in C#.net
C# .NET, add new PDF page, delete certain PDF page, reorder existing PDF pages and split may choose to only rotate a single page of PDF file or all
rearrange pdf pages reader; reverse page order pdf
The Header Attribute
5
Note that,like a regularPython list, theindexing updatesaftereach
delete,soif
del prihdr[3]
isdonetwotimesinarow,the2ndand3rd
keywords are removed from the original header.
Slicesarenotacceptedbytheheaderattribute,soitisnotpossibletodo
del prihdr[3:5]
, for example.
Themethod
update(key, value, comment)
isamoreversatilewayto
updatekeywords. Ithastheflexibilitytoupdateanexistingkeywordandin
casethekeyworddoesnotexist,addittotheheader. Italsoallowstheuse
toupdateboththevalueanditscomment. Ifitisanewkeyword,theuser
can also specify where to put t it, using the e before or r after optional
argument.  The default is to append at the end of the header.
2.2.2  COMMENT, HISTORY, and Blank Keywords
MostkeywordsinaFITSheaderhaveuniquenames. Iftherearemore
thantwo cardssharing thesamename,itisthefirstoneaccessedwhen
referred by y name. The duplicates s can only be e accessed d by y numeric
indexing.
Therearethreespecialkeywords(theirassociatedcardsaresometimes
referred to o as commentary cards), which h commonly appear in FITS
headersmorethanonce.Theyare(1)blankkeyword,(2)HISTORY,and
(3)COMMENT. Again,togettheirvalues(exceptforthefirstone),auser
must use indexing.
The following header methods are provided in PyFITS to add new
commentarycards:
add_history()
,
add_comment()
,and
add_blank()
. They
areprovidedbecausethe
update()
methodwillnotwork-itwillreplace
the first card of the same keyword.
Users can n control l where in the header to add d the new commentary
card(s)byusingtheoptional
before
and
after
arguments,similartothe
update()
methodusedforregularcards. Ifno
before
or
after
isspecified,
the newcard willbeplaced afterthelastoneofthesamekind(except
>>> prihdr.update(’target’, ’NGC1234’, ’target name’)
>>> # place the next new keyword before the ’target’ keyword
>>> prihdr.update(’newkey’, 666, before=’target’) ) # # comment is optional
>>> # place the next new keyword after the 21st keyword
>>> prihdr.update(’newkey2’, 42.0, ’another new key’, after=20)
VB.NET PowerPoint: Sort and Reorder PowerPoint Slides by Using VB.
Sort and Reorder PowerPoint Slides Range with VB amount of robust PPT slides/pages editing methods powerful & profession imaging controls, PDF document, image
rearrange pages in pdf document; reorder pages in pdf
VB.NET TIFF: Modify TIFF File by Adding, Deleting & Sort TIFF
Users can use it to reorder TIFF pages in ''' &ltsummary> ''' Sort TIFF document pages in designed powerful & profession imaging controls, PDF document, image
how to move pdf pages around; how to reorder pages in pdf reader
6
Chapter 2: FITS Headers
blank-keycardswhichwillalwaysbeplacedattheend). Ifnocardofthe
same kind exists, it will be placed at the end.  Here is an example:
and the part in the modified header becomes:
Ironically,thereisnocommentinacommentarycard, onlya string
value.
2.3     Card Images
A FITS header consists ofcard images.
AcardimagesinaFITSheaderconsistsofakeywordname,avalue,
andoptionallyacomment.Physically,ittakes80columns(bytes)-without
carriagereturn-inaFITSfile’sstorageform. InPyFITS,eachcardimage
is manifested by a
Card
object. There are also o special kinds of cards:
commentary cards (see above) and card images taking more than one
80-column card image. The latter will be discussed in 3.4 below.
>>> hdu.header.add_history(’history 1’)
>>> hdu.header.add_blank(’blank 1’)
>>> hdu.header.add_comment(’comment 1’)
>>> hdu.header.add_history(’history 2’)
>>> hdu.header.add_blank(’blank 2’)
>>> hdu.header.add_comment(’comment 2’))
HISTORY history 1
HISTORY history 2
blank 1
COMMENT comment 1
COMMENT comment 2
blank 2
C# PDF: C# Code to Process PDF Document Page Using C#.NET PDF
delete or remove certain page from PDF document file. C# PDF Page Processing: Sort PDF Pages - online C#.NET tutorial page for how to reorder, sort, reorganize
reordering pages in pdf; move pdf pages in preview
Read PDF in Web Image Viewer| Online Tutorials
for image viewing to read, edit, create or write PDF documents from file or stream in Extract images from PDF documents; Add, reorder pages in PDF
moving pages in pdf; how to rearrange pages in pdf using reader
Card List
7
Mostofthetime,anew
Card
objectiscreatedwiththe
Card
constructor:
Card(key, value, comment).
For example:
Cardshavetheattributes.
key
,.
value
,and.
comment.
Both
.value
and
.commet
can be changed but not the
.key
attribute.
The
Card()
constructor will l check k if the arguments given are
conformingtotheFITSstarndardandhasafixedcardimageformat. Ifthe
userwantstocreateacardwithacustomizedformatorevenacardwhich
isnotconformingtotheFITSstandard(e.g.fortestingpurposes),thecard
method
fromstring()
can be used.
Cardscanbeverifiedbythe
verify()
method. Thenon-standardcard
c2 in the example below, isflagged d by y such verification. More e about
verification in PyFITS will be discussed in Chapter 6.
2.4     Card List
TheHeaderitselfonlyhaslimitedfunctionalities. Manylowerelevel
operations can only be achieved by going through its
CardList
object.
TheheaderisbasicallyalistofCards. Thislistcanbemanifestedasa
CardList
objectinPyFITS. Itisaccessedviathe
ascardlist()
method(or
the
.ascard
attribute,forshort)ofHeader. Sincetheheaderattributeonly
refers to o a a card d value, so o when n a a user needs to accessa card’s other
properties(e.g.thecomment)inaheader,ithastogothroughtheCardList.
>>> c1 = pyfits.Card(’temp’, 80.0, ’temperature, floating value’)
>>> c2 = pyfits.Card(’detector’, 1) # comment is optional
>>> c3 = pyfits.Card(’mir_revr’, True, ’mirror reversed? Boolean value)
>>> c4 = pyfits.Card(’abc’, 2+3j, ’complex value’)
>>> c5 = pyfits.Card(’observer’, ’Hubble’, ’string value’)
>>> print c1; print c2; print c3; print t c4; ; print c5 # show the card images
TEMP    =                 80.0 / temperature, floating value
DETECTOR=                    1 /
MIR_REVR=                    T / mirror reversed? Boolean value
ABC     =           (2.0, 3.0) / complex value
OBSERVER= ’Hubble  ’           / string value
>>> c1 = pyfits.Card().fromstring(’ABC     =    3.456D023’)
>>> c2 = pyfits.Card().fromstring("P.I.    =’Hubble’")
>>> print c1; print c2
ABC     =    3.456D023
P.I.    =’Hubble’
>>> c2.verify()
Output verification result:
Unfixable error: Illegal keyword name ’P.I.’
VB.NET TIFF: VB.NET Sample Code to Process & Manage TIFF Page
certain TIFF page, and sort & reorder TIFF pages in Process TIFF Pages Independently in VB.NET Code. powerful & profession imaging controls, PDF document, image
reorder pages in pdf document; move pages in pdf online
C# Word: How to Create Word Document Viewer in C#.NET Imaging
in C#.NET; Offer mature Word file page manipulation functions (add, delete & reorder pages) in document viewer; Rich options to add
pdf rearrange pages; rearrange pdf pages
8
Chapter 2: FITS Headers
Liketheheader’sitem,theCardList’sitemcanbeaccessedthrougheither
the keyword name or index.
2.5    CONTINUE Cards
ThefactthattheFITSstandardonlyallowsupto8charactersforthe
keywordnameand80characterstocontainthekeyword,thevalue,andthe
commentisrestrictiveforcertainapplications. Toallowlongstringvalues
for keywords, a proposal was made in:
http://legacy.gsfc.nasa.gov/docs/heasarc/ofwg/docs/ofwg_recomm/r13.
html
by using the e CONTINUE E keyword d after r the regular r 80-column
containing the e keyword. PyFITS S does s support this convention, , even
though itisnotaFITSstandard. . Theexamplesbelowshowtheuse e of
CONTINUE is automatic for long string values.
Note that t when n CONTINUE E card d is s used, , at t the e end of f each
80-characterscardimage,anampersandispresent. Theampersandisnot
part ofthe string g value. Also, , there is s no"="atthe e 9th column after
CONTINUE. Inthefirstexample,theentire240charactersisconsidereda
>>> cards = prihdr.header.ascardlist()
>>> cards[’abc’].comment=’new comment’ # update the keyword ABC’s comment
>>> cards[3].key
# see the keyword name of the 4th card
>>> cards[10:20].keys()        # see keyword names from cards 11 to 20
>>> c=pyfits.Card(’abc’,’abcdefg’*20)
>>> print c
ABC     = ’abcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcd&’
CONTINUE  ’efgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefga&’
CONTINUE  ’bcdefg&’
>>> c.value
’abcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgab
cdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefg’
# both value and comments are long
>>> c=pyfits.Card(’abc’,’abcdefg’*10,’abcdefg’*10)
>>> print c
ABC     = ’abcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcd&’
CONTINUE  ’efg&’
CONTINUE  ’&’ / abcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefgabcdefga
CONTINUE  ’&’ / bcdefg
HIERARCH Cards
9
Card. So,ifitisthenthcardinaheader,the(n+1)thcardreferstothenext
keyword,notthe80-characterscontainingCONTINUE. Thesekeywords
having long string valuescan beaccessed and updated just t like e regular
keywords.
2.6    HIERARCH Cards
Forkeywordslongerthan8characters,thereisaconventionoriginated
at ESOtofacilitatesuchuse. . ItusesaspecialkeywordHIERARCHwith
the actual l long g keyword following. PyFITSsupports s this convention n as
well.
When creating or r updating using the header.update() ) method, , it is
necessarytoprepend’hierarch’(caseinsensitive). Butifthekeywordis
alreadyintheheader,itcanbeaccessedorupdatedbyassignmentbyusing
thekeywordnamediretly,withorwithoutthe’hierarch’prepending. The
>>> c = pyfits.Card(’abcdefghi’,10)
...
ValueError: keyword name abcdefghi is too long (> 8), use HIERARCH.
>>> c=pyfits.Card(’hierarch abcdefghi’,10)
>>> print c
HIERARCH abcdefghi = 10
>>> h=pyfits.PrimaryHDU()
>>> h.header.update(’hierarch abcdefghi’, 99)
>>> h.header.update(’hierarch abcdefghi’, 99)
>>> h.header[’abcdefghi’]
99
>>> h.header[’abcdefghi’]=10
>>> h.header[’hierarch abcdefghi’]
10
# case insensitive
--> h.header.update(’hierarch ABCdefghi’, 1000)
--> print h.header
SIMPLE  =                    T / conforms to FITS standard
BITPIX  =                    8 / array data type
NAXIS   =                    0 / number of array dimensions
EXTEND  =                    T
HIERARCH ABCdefghi = 1000
--> h.header[’hierarch abcdefghi’]
1000
10
Chapter 2: FITS Headers
keywordnamewillpreserveitscasesfromitsconstructor,butwhenrefer
to the keyword, it is case insensitive.
11
C
HAPTER
3:
Image Data
In this chapter . . .
In this chapter, we’ll discuss the data component in an image HDU.
3.1    Image Data as an Array
AFITSprimaryHDUoranimageextensionHDUmaycontainimage
data. ThefollowingdiscussionsapplytobothoftheseHDUclasses. In
PyFITS, formostcases, it t isjusta a simple numarray, having the shape
specified by the e NAXIS S keywords s and d the data type e specified d by the
BITPIXkeyword-unlessthedataisscaled,seenextsection. Hereisa
quickcrossreferencebetweenallowedBITPIXvaluesinFITSimagesand
the numarray data types:.
3.1 Image Data as an Array / 11
3.2 Scaled Data / 12
3.3 Data Section / 14
BITPIX      numarray data type
8         UInt8   (note it is UNsigned integer)
16         Int16
32         Int32
-32         Float32
-64         Float64
12
Chapter 3: Image Data
Torecapthefactthatinnumarraythearraysare0-indexedandtheaxes
areorderedfromslowtofast. So,ifaFITSimagehasNAXIS1=300and
NAXIS2=400, the numarray of its data will have the shape of (400, 300).
Here is a summary of reading and updating image data values:
Herearesomemorecomplicatedexamplesbyusingtheconceptofthe
"maskarray".Thefirstexampleistochangeallnegativepixelvaluesin
scidata
tozero.Thesecondoneistotakelogarithmofthepixelvalues
which are positive:
These examples show the concise nature of numarray operations.
3.2     Scaled Data
Sometimesanimageisscaled,i.e.thedatastoredinthefileisnotthe
image’sphysical(true)values,butlinearlytransformedaccordingtothe
equation:
BSCALEandBZEROarestoredaskeywordsofthesamenamesinthe
headerofthe sameHDU. . Themostcommonuseofscaledimageisto
storeunsigned16-bitintegerdatabecauseFITSstandarddoesnotallowit.
In thiscase, the stored data issigned 16-bitinteger(BITPIX=16) ) with
BZERO=32768 (2**15),  BSCALE=1.
3.2.1  Reading Scaled Image Data
ImagesarescaledonlywheneitheroftheBSCALE/BZEROkeywords
arepresentintheheaderandeitheroftheirvaluesisnotthedefaultvalue
(BSCALE=1, BZERO=0).
>>> f = pyfits.open(’image.fits’)  # open a FITS file
>>> scidata = f[1].data       # assume the first extension is an image
>>> print scidata[1,4]        # get the pixel value at x=5, y=2
>>> scidata[30:40, 10:20]     # get values of the subsection
# from x=11 to 20, y=31 to 40 (inclusive)
>>> scidata[1,4] = 999        # update a pixel value
>>> scidata[30:40, 10:20] = 0 # update values of a subsection
>>> scidata[3] = scidata[2]   # copy the 3rd row to the 4th row
>>> scidata[scidata<0] = 0
>>> scidata[scidata>0] = numarray.log(scidata[scidata>0])
physical value = BSCALE*(storage value) + BZERO
Documents you may be interested
Documents you may be interested