Author Topic: Opening ImagesPlus fits files  (Read 5119 times)

Offline Mike Reid

  • Newcomer
  • Posts: 47
    • Mike's Astro
Opening ImagesPlus fits files
« on: 2010 June 04 18:50:38 »
Has anybody figure out how to open a 32 bit uncompressed floating point fits file generated by ImagesPlus in PixInsight?  When I try opening one of these color fits files it opens as three separate grayscale images with one of them flipped top and bottom.

Thanks,
Mike

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: Opening ImagesPlus fits files
« Reply #1 on: 2010 June 06 01:03:46 »
Hi Mike,

You need to have a look at the 'FITS HEADER' for the image, and perhaps even post a copy of that here in the Forum.

The Header describes how the FITS image is put together. In this case it should not only describe how many 'Bits' make up the ADU value of each pixel (and whether the data is held in 'Floating Point' format or not), but it should also describe the 'physical dimensions' of the array that contains the image. It must also describe whether the image file contains a simple 'mono' or 'greyscale' representation of the image data, or whether there are multiple arrays with each array containing a separate mono/grey image.

There is no specific mechanism to determine that the 'first' array in a multiple-array FITS file will be assigned to the 'Red' channel, etc., that is a task left to the 'writing' software and to the 'reading' software. Fortunately, where multiple-array FITS images are used, it is 'common practice' to assign the first three to 'RGB' data.

There is also ne mechanism that would cause one of the channels to be 'flipped' - if this is happening then the fault exists either at the 'writing' end, or at the 'reading' end.

Whenever you have any doubts about the 'contents' of your FITS files, it is well worth your while running them through the ESA 'Fits Viewer' ('FV') package - which is a free download. I always use this if I am 'suspicious' about how a FITS image was created.

If one of your channels has been 'inverted', or of your image file does not meet the FITS 'standard', then these anomalies should show up in FV.

Let us know how you get on.

Cheers,
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Opening ImagesPlus fits files
« Reply #2 on: 2010 June 06 11:02:28 »
Hi Mike,

Each one of these FITS files store three independent images. More technically, it seems that individual RGB channels have been stored as independent HDUs (Header-Data Units) in these files. As PixInsight supports multiple-image FITS (for reading only), these files are being read as what they are: three independent images.

Besides that, you have discovered a bug in PixInsight's FITS support module: FITS orientation is being applied only to the first image in a multiple-image FITS file. I have already fixed this bug in the next version; thanks for catching it (I'll add the corresponding entry to the bug reports board later). In other words, in the next version all of the three images will be "flipped" (what actually happens is that the default FITS orientation is bottom-up; this is configurable via FITS preferences).

PixInsight stores multichannel FITS images as data cubes. A RGB image is stored as a single HDU with three dimensions: horizontal axis dimension, vertical axis dimension, and number of channels, respectively. This is IMO the logical way to store a multichannel image. FITS does not define a standard way to store multichannel data, so each application is free to use any valid (= standards compliant) data organization. Another instance of undefined as the true meaning of flexible.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Mike Reid

  • Newcomer
  • Posts: 47
    • Mike's Astro
Re: Opening ImagesPlus fits files
« Reply #3 on: 2010 June 06 13:40:23 »
Juan,

That makes sense.  Thanks for the explanation.  So I guess a simple ChannelCombination on the three images should get me back to a color image for further processing in PixInsight.

Mike

Offline h0ughy

  • PixInsight Addict
  • ***
  • Posts: 226
Re: Opening ImagesPlus fits files
« Reply #4 on: 2010 June 06 20:53:34 »
i have just come across this myself as i was given data in FITS format from IP.  Thanks for the fix Juan - be glad to see the "new" version so we get to use it soon ;)

So in the meantime - how do you go about using ChannelCombination?
Doghouse Observatory

Offline Mike Reid

  • Newcomer
  • Posts: 47
    • Mike's Astro
Re: Opening ImagesPlus fits files
« Reply #5 on: 2010 June 07 10:24:41 »
If you open a 32-bit color fits from ImagesPlus called FOO.fit in PixInsight you will have three grayscale images, FOO, FOO1 and FOO2. If, like me, you have edited the FITS format preferences in PixInsight and selected Coordinate Origin: Lower Left Corner then only FOO will be oriented as you expect, FOO1 and FOO2 will need to be flipped verically. Use Image->Geometry->Vertical Mirror command on FOO1 and FOO2. Then run Process->ColorSpaces->ChannelCombination and select FOO for red, FOO1 for green and FOO2 for blue.  After this you'll have a color image in PixInsight ready for further processing.

Mike