No valid Fits header

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

No valid Fits header

infocean
Hi,
I opened two different fits files and wen I wanted to sea the header the program said "No valid Fits header" with an <Ok> to push.
Ds9 has no problem displaying the header for both files.
Thanks ahead,
infocean
I attache here a picture of the header from ds9.
ds9 screenshotScreen_Shot_2014-09-24_at_15.png
Reply | Threaded
Open this post in threaded view
|

Re: No valid Fits header

karenacollins
Administrator
Hi, I'm not sure what AIJ is unhappy with in your header. Would it be
possible to forward one of your fits files to me at karenacollins
~~--aaattt--~~ outlook dot com? It would save me time over recreating a
file with your header values. If the data are sensitive, I will treat
the file as confidential.

Thanks,
Karen


Reply | Threaded
Open this post in threaded view
|

Re: No valid Fits header

infocean
Hi Karen,

Here is a file with 3 pictures in it.  I wrote it out from Mathematica.  Wolfram’s Export routine is cooked - messes up the header and writes its own stuff into it, but if other programs are able to open it your should also do that minimum. :-)

Thanks a lot to take the time out to look into it.  Unfortunately the other program is unable to do a copy paste under their Edit menu.

ImageJ is able to show the Info, which contain the header.  You might want to tap into that one.

Best,
János



On Sep 25, 2014, at 1:38, karenacollins [via AstroImageJ] <[hidden email]> wrote:

Hi, I'm not sure what AIJ is unhappy with in your header. Would it be
possible to forward one of your fits files to me at karenacollins
~~--aaattt--~~ outlook dot com? It would save me time over recreating a
file with your header values. If the data are sensitive, I will treat
the file as confidential.

Thanks,
Karen





If you reply to this email, your message will be added to the discussion below:
http://astroimagej.1065399.n5.nabble.com/No-valid-Fits-header-tp177p178.html
To unsubscribe from No valid Fits header, click here.
NAML


LessMin1sigma.fit (1M) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: No valid Fits header

karenacollins
Administrator
Thanks for sending the file János. I can reproduce the problem you are seeing with an older build of AIJ (v2.1.0), but I tried all builds from 2.1.1 up to 2.1.5 and your header will open with no problem on my computer. Here is the display:


If you are running v2.1.0, you should update to v2.1.5 by following these directions (many, many improvements have been made since v2.1.0):
http://astroimagej.1065399.n5.nabble.com/After-a-fresh-installation-of-AIJ-be-sure-to-update-to-the-latest-build-td142.html

If that doesn't solve your problem, send me a screen grab of the AIJ_Toolbar->Help->About AstroImageJ...
(it should look something like this)


... and let me know how are you accessing the header editor (i.e. are you pressing the shortcut icon () above the image?).

Karen
Reply | Threaded
Open this post in threaded view
|

Re: No valid Fits header

infocean
Hi Karen,

I am running 2.1.0 looks like.  See attached picture.  Later today I will try to hunt down the 2.1.5.  Thanks a lot for your effort.
Best,
János


On Sep 26, 2014, at 3:09, karenacollins [via AstroImageJ] <[hidden email]> wrote:

Thanks for sending the file János. I can reproduce the problem you are seeing with an older build of AIJ (v2.1.0), but I tried all builds from 2.1.1 up to 2.1.5 and your header will open with no problem on my computer. Here is the display:


If you are running v2.1.0, you should update to v2.1.5 by following these directions (many, many improvements have been made since v2.1.0):
http://astroimagej.1065399.n5.nabble.com/After-a-fresh-installation-of-AIJ-be-sure-to-update-to-the-latest-build-td142.html

If that doesn't solve your problem, send me a screen grab of the AIJ_Toolbar->Help->About AstroImageJ...
(it should look something like this)


... and let me know how are you accessing the header editor (i.e. are you pressing the shortcut icon () above the image?).

Karen



If you reply to this email, your message will be added to the discussion below:
http://astroimagej.1065399.n5.nabble.com/No-valid-Fits-header-tp177p180.html
To unsubscribe from No valid Fits header, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: No valid Fits header

infocean
In reply to this post by karenacollins
Hi Karen,

I updated to 2.1.5.  Now I see the header.  Thanks You.
Is it possible to fix the About AstriImageJ dialog in a release.  See attached picture.

Best,
János


On Sep 26, 2014, at 9:04, Information Ocean <[hidden email]> wrote:

Hi Karen,

I am running 2.1.0 looks like.  See attached picture.  Later today I will try to hunt down the 2.1.5.  Thanks a lot for your effort.
Best,
János


Reply | Threaded
Open this post in threaded view
|

Re: No valid Fits header

karenacollins
Administrator
Hi János,
 
Thanks for reporting that OS X specific issue. It was reported by another user recently too and has been fixed in the current "daily build". If you want to update to that pre-release version, you could test it and and let me know for sure it has fixed the issue. That build has been being used for about a month now by several users, and it seems stable. If you find a problem, you can always "update" backwards to 2.1.5.

Karen

On 9/26/2014 9:01 PM, infocean [via AstroImageJ] wrote:
Hi Karen,

I updated to 2.1.5.  Now I see the header.  Thanks You.
Is it possible to fix the About AstriImageJ dialog in a release.  See attached picture.

Best,
János


On Sep 26, 2014, at 9:04, Information Ocean <[hidden email]> wrote:

Hi Karen,

I am running 2.1.0 looks like.  See attached picture.  Later today I will try to hunt down the 2.1.5.  Thanks a lot for your effort.
Best,
János





If you reply to this email, your message will be added to the discussion below:
http://astroimagej.1065399.n5.nabble.com/No-valid-Fits-header-tp177p182.html
To start a new topic under AstroImageJ, email [hidden email]
To unsubscribe from AstroImageJ, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: No valid Fits header

Torsten Roehl
This post was updated on .
In reply to this post by karenacollins
Bug in FITS format!
Dear Karin Collins,
i wrote a little Plugin to create 1D-Spectrumfiles in fits-format from a 2D-Image, just for me as a hobby.
For this purpose i studied the FITS_WRITER code, implemented in ij and aij.
I detected a bug in the way the fits header in ij/aij are generated.

==================================
Problem
==================================

Fits files generated by ij/aij producing header error, because the NAXISX value
field are not in integer fixed format.

I checked my 1d-spectrum fits file with the
Nasa FITS File Verifier: https://fits.gsfc.nasa.gov/fits_verify.html
Then i checked arbitary ij/aij generated fits images e.g. the
output of an image of size 76x22 will result in this message from the NASA verifier:

----------------------HDU 1: Primary Array -------------------

*** Error: NAXIS1 mandatory keyword is not in integer fixed format:
NAXIS1 = 76 / length of data axis 1

-------------------^
*** Error: NAXIS2 mandatory keyword is not in integer fixed format:
NAXIS2 = 22 / length of data axis 2


==================================
Fix
==================================

plugin: ij.plugin
class: FITS_Writer
method: createHeader
---------------------------

orginal file:
appendFile(writeCard("NAXIS1", " "+ip.getWidth(), "length of data axis 1"), path);
appendFile(writeCard("NAXIS2", " "+ip.getHeight(), "length of data axis 2"), path);

possible bugfix:
appendFile(writeCard("NAXIS1", naxis(ip.getWidth()), "length of data axis 1"), path);
appendFile(writeCard("NAXIS2", naxis(ip.getHeight()), "length of data axis 2"), path);

private String naxis(int value) {
int length = 20 - String.valueOf(value).length();
String spaces = String.format("%" + length + "s", "");
return spaces + value;
}
--------------------------

The currently implemented method will create invalide header length, depending on the size of the image. This could be a problem wenn using third party software with very restriced fits-header handling.
kind regards torsten roehl
(because this is my first post i hope everthing is readable )
ps: should i report this mail also to ij?
Reply | Threaded
Open this post in threaded view
|

Re: No valid Fits header

karenacollins
Administrator
Hi Torsten, AIJ only supports 2D fits file writing at this time. That is likely causing NAXIS problems if you are trying to write a 1D fits file. I have added a feature request to our to-do list for 1D fits file writing support, but it would be a long term implementation.

Karen
Reply | Threaded
Open this post in threaded view
|

Re: No valid Fits header

Torsten Roehl
This post was updated on .
Hi, Karen this must be an misunderstanding.

The problem has nothing todo with 1D fits files.

The Problem is based solely in the source code of ij/aij.

Arbitrary 2D Fitsfiles produces the "integer fixed format Error"  (Nasa FITS File Verifier).

This is because this to lines in FITS_Write are not right implemented:

orginal file:
appendFile(writeCard("NAXIS1", " "+ip.getWidth(), "length of data axis 1"), path);
appendFile(writeCard("NAXIS2", " "+ip.getHeight(), "length of data axis 2"), path);

e.g:

Fitsformat requird a fixed valued length.
but  " "+ip.getWidth() will give variable lengths, depending on the choosen 2D fits file width!


Torsten

ps: by the way - my 1d fits file plugin works perfect
Reply | Threaded
Open this post in threaded view
|

Re: No valid Fits header

karenacollins
Administrator
I see the problem now and it is fixed in the latest daily build (3.3.1.08). The issue was that the left padding with spaces of NAXIS1 and NAXIS2 was not being done correctly for image dimensions less than 1000.

Karen

Reply | Threaded
Open this post in threaded view
|

Re: No valid Fits header

Torsten Roehl
This problem arise also in ij.  How we deal with that?
Will you fixed this also in ij.

greeting torsten
Reply | Threaded
Open this post in threaded view
|

Re: No valid Fits header

karenacollins
Administrator
Hi Torsten,

I have sent the updated code to Wayne Rasband in case he wants to update ImageJ.

Karen


Reply | Threaded
Open this post in threaded view
|

Re: No valid Fits header

karenacollins
Administrator
In reply to this post by Torsten Roehl
Hi Torsten, Wayne Rasband has confirmed that the updated FITS_Writer code is now in the latest ImageJ daily build. Please test it and let me know if you see a problem.

Karen
Reply | Threaded
Open this post in threaded view
|

Re: No valid Fits header

Torsten Roehl
This post was updated on .
Hi, Karen.
I'm not sure if  the problem is really solved or only shifted to images < 100000 in size.

For example: the file   1000000x1.fits with is easily generated in aij produced the fixed error (NASA VERIFIER) again.
*** Error:   NAXIS1   mandatory keyword is not in integer fixed format:


My posted solution used only a third of your code and solves this problem generally:

private String naxis(int value) {
int length = 20 - String.valueOf(value).length();
String spaces = String.format("%" + length + "s", "");
return spaces + value;
}

The question is how long can NAXIS1 or NAXIS2 be?
I have searched the fits-specification-documents, but interestingly i could not find anything about the maximal allowed length of NAXIS1/NAXIS2.
(If you know the maximal allowed length please let me know)

So if you say images can not be so big - then the naxis1/naxis2 header problem is (hopefully) solved.


Torsten
Reply | Threaded
Open this post in threaded view
|

Re: No valid Fits header

karenacollins
Administrator
Hi Torsten,

You are correct. I only fixed the code to handle images up to 99,999 x 99,999 using very simplistic straight line code. I had very little time to do corner case testing of all possible combinations of a more elegant solution. The fits writer code will eventually be replaced with non-custom code soon, so I don't plan to spend any more time on the custom version right now to handle hypothetical cases.

Karen

On 11/4/2019 5:20 AM, Torsten Roehl [via AstroImageJ] wrote:
Hi, Karen.
I'm not sure if  the problem really solved or only shifted to images < 100000 in size.

For example: the file   1000000x1.fits with is easily produced in aij produced the fixed error (NASA VERIFIER) again.
*** Error:   NAXIS1   mandatory keyword is not in integer fixed format:


My posted solution used only a third of your code and solves this problem generally:

private String naxis(int value) {
int length = 20 - String.valueOf(value).length();
String spaces = String.format("%" + length + "s", "");
return spaces + value;
}

The question is how long can NAXIS1 or NAXIS2 be?
I have searched the fits-specification-documents, but interestingly i could not find anything about the maximal allowed length of NAXIS1/NAXIS2.

So if you say images can not be so big - then the naxis1/naxis2 header problem is (hopefully) solved.


Torsten



If you reply to this email, your message will be added to the discussion below:
http://astroimagej.1065399.n5.nabble.com/No-valid-Fits-header-tp177p1244.html
To start a new topic under AstroImageJ, email [hidden email]
To unsubscribe from AstroImageJ, click here.
NAML