09-09-2020 09:43 AM
I tried to handle FITS images with the plug-in gfitsio but the image produced by the example.vi 'does appear to be a FITS image' according to ImageJ.
Does anyone already had this problem ?
Thank you for your help.
09-14-2020 04:16 AM
If you can, post what you have.
Both the image as the code, and some links maybe, would help us help you.
09-14-2020 05:27 AM
Hello,
Thanks for looking at my problem.
Here are the elements.
I modified example.vi (giving in gfitsio library) to read a working image (example_GS12.fits created by ImageJ and that can be opened by imageJ) and to write a new one (example_GS12_2.fits that cn not be opened by ImageJ)
I tried to open the second image with python (astropy) and I can access the data but I got a strange structure (I am guessing the problem comes from that ..).
Any though will be welcome.
Cedric
hdu_list = fits.open('E:\Temp\gfitsio\example_GS16_2.fits')
hdu_list.info()
Filename: E:\Temp\gfitsio\example_GS16_3.fits No. Name Ver Type Cards Dimensions Format 0 PRIMARY 1 PrimaryHDU 6 () 1 1 ImageHDU 10 (298, 280) int16 (rescales to uint16)
image_data = hdu_list[1].data
print(type(image_data))
print(image_data.shape)
<type 'numpy.ndarray'> (280L, 298L)
plt.imshow(image_data, cmap='gray')
plt.colorbar()
09-14-2020 06:10 AM
I have all kinds of problems running that code. For starters, I have 64 bit LabVIEW, and the library is for 32 bit...
Examining those image files in notepad does show that they are quite different. It seems your file is opened, and then added to. There seem to be two headers? I don't know anything about those image files. Should it be possible to have more than one image in a file?
I'd try to first create a new image (e.g. delete the old file, don't use open or create, but create). The first image I'd try to make would have the same data type as the original image. In other words, try to get something working, than try to move towards the goal one small step at the time...