Commit bd8086c1 authored by Robert Sprowson's avatar Robert Sprowson

Minor fixes

Having selected JPEG output format, you'd get an error clicking on one of the radio icons on the sprite output format window.
Look for BZERO and BSCALE in FITS astronomical image files, rather than subtracting a hardwired 0x8000 - this tended to result in any 16bpp images coming out solid green.
Mirror the FITS image output in the X axis so they're the right way up.

Version 1.45. Tagged as 'ChangeFSI-1_45'
parent ab4eef8c
......@@ -346,13 +346,17 @@ sized 1:2.
FITS astronomical format images
-------------------------------
The "Flexible Image Transport System" (FITS) format is used for astronomical
data. Up to 16 bits per pixel component.
data. The start of the file comprises human readable text such as which
equipment took the image and at what wavelength.
Recognised by 'SIMPLE ' at the start of the file.
Only 8 and 16 bit per pixel component formats tested.
Only 8, 16, 32 bit per pixel component formats tested, those images stored
in IEEE floating point format (BITPIX -32 and BITPIX -64) will be faulted.
Only two files ever seen!
Scientific data from far away galaxies suffer from using only a small fraction
of the dynamic range, so 16 and 32 bit per pixel images often appear almost
entirely black. An 8 bit per pixel image maps well into 256 greys.
No resolution specified; equal to mode 27 assumed.
......
/* (1.44)
/* (1.45)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.44
#define Module_MajorVersion_CMHG 1.45
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 08 Jan 2014
#define Module_Date_CMHG 11 Jan 2014
#define Module_MajorVersion "1.44"
#define Module_Version 144
#define Module_MajorVersion "1.45"
#define Module_Version 145
#define Module_MinorVersion ""
#define Module_Date "08 Jan 2014"
#define Module_Date "11 Jan 2014"
#define Module_ApplicationDate "08-Jan-14"
#define Module_ApplicationDate "11-Jan-14"
#define Module_ComponentName "ChangeFSI"
#define Module_ComponentPath "mixed/RiscOS/Sources/Apps/ChangeFSI"
#define Module_FullVersion "1.44"
#define Module_HelpVersion "1.44 (08 Jan 2014)"
#define Module_LibraryVersionInfo "1:44"
#define Module_FullVersion "1.45"
#define Module_HelpVersion "1.45 (11 Jan 2014)"
#define Module_LibraryVersionInfo "1:45"
......@@ -806,7 +806,7 @@ DEF PROCcheckmouse(mousex%,mousey%,b%,handle%,icon%,ob%)
IF b% AND 5 THEN
CASE handle% OF
WHEN output%
IF dest%=0 dest%=1 THEN PROCdomenu(101,imenu$,FNmsg0("_TaskName")):SYS Getcaret%,,q%:moved%= TRUE
IF dest%=0 THEN dest%=1:PROCdomenu(101,imenu$,FNmsg0("_TaskName")):SYS Getcaret%,,q%:moved%= TRUE
CASE icon% OF
WHEN 3,4,5,6
PROCkillcurrent( STR$(22+icon%))
......@@ -3529,6 +3529,7 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
WHEN 2800
REM FITS telescope format
PTR#c%=0
bzero=0:bscale=1
REPEAT
s$=""
FOR Z%=1 TO 80
......@@ -3538,7 +3539,11 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
WHEN "SIMPLE "
IF MID$(s$,30,1)<>"T" ERROR 42,"ChangeFSI can only read Simple FITS format"
WHEN "BITPIX "
input=VAL MID$(s$,10)
quant%=VAL MID$(s$,10)
WHEN "BZERO "
bzero=VAL MID$(s$,10)
WHEN "BSCALE "
bscale=VAL MID$(s$,10)
WHEN "NAXIS "
IF VAL MID$(s$,10)<>2 ERROR 42,"ChangeFSI can only read 2d FITS images"
WHEN "NAXIS1 "
......@@ -3553,25 +3558,29 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
st%=(PTR#c% DIV 2880 + 1)*2880
cache%= TRUE
PTR#c%=st%
CASE input OF
vflip%=NOT vflip%
CASE quant% OF
WHEN 8
r$="FN8"
input=8
rowbytes%=sx%
PROCnopal
WHEN 16
rowbytes%=2*sx%
WHEN 16,32
rowbytes%=(quant% DIV8)*sx%
DIM rpal%(255),gpal%(255)
step24=2
step24=quant% DIV8
r$="FN16"
input=16
S%=bzero/bscale:REM Adjust DC level
FOR C%=0 TO 255
gpal%(C%)=C%<<8
rpal%(C%)=C%
gpal%(C%)=((C%<<8)-S%) AND &FF00
rpal%(C%)=((C%<<8)-S%) AND &FF
NEXT
cheat%=0
IF invert% cheat%=F
FOR C%=0 TO 255
r%(C%)=cheat%+C%/65535*F
g%(C%)=((C% EOR &80)<<8)/65535*F
g%(C%)=(C%<<8)/65535*F
b%(C%)=cheat%
NEXT
rwt=1
......@@ -3580,7 +3589,7 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
OTHERWISE
ERROR 42,"ChangeFSI can't read a FITS image with this number of bits per pixel"
ENDCASE
info$="FITS file "+ STR$sx%+" by "+ STR$sy%+" pixels, "+FNbits(input)
info$="FITS file "+ STR$sx%+" by "+ STR$sy%+" pixels, "+FNbits(quant%)
WHEN 2900
REM Apollo GPR format
PTR#c%=4
......@@ -4711,13 +4720,12 @@ DEF FNChangeFSI(A$,spritearea%,workspace%,worklimit%,oksave%,okinfo%,RETURN ram%
REM test for as many colours as possible
CASE m OF
WHEN -1,-9
col=0
REM aim format is monochrome
col=0:REM Monochrome AIM and JPEG
WHEN -3,-4,-5,-6,-7,-8,-10
col=2
OTHERWISE
IF m$="D" IF ncol=3 m$=""
col=0
IF m$="D" IF ncol=3 m$=""
IF ncol>15 OR m$="C" OR m$="D" OR m$="R" col=2:REM depth of colour arrays
IF ncol=63 OR ncol=255 IF m$="D" col=0:ncol=256
ENDCASE
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment