Saving an array to a fits file
古いコメントを表示
I have an array called frames_out. It's a 100x100x3000 array of images (3000 images, each image 100x100 pixels). I want to save this array as a FITS file. I've tried using the fitswrite function:
%%%%%%%%%
A = frames_out(:,:,1);
fitswrite(A,'fitsfile.fits')
for i = 2:size(frames_out,3)
A = frames_out(:,:,i);
fitswrite(A,'fitsfile.fits','writemode','append');
end
%%%%%%%%
But when I use the "fitsread" function on the FITS file I've created, that gives me an array with just one frame (the first frame of the original array), and I want all the images to be there. The weird thing is that if I use the code on just one frame, like this:
%%%%%%%%%
A = frames_out(:,:,1);
fitswrite(A,'fitsfile.fits')
%%%%%%%%
I get a FITS file whose size is a few hundred KB, and with the first code I get a much bigger file. So there's more information on the file from all the frames, but I can't seem to "extract" or see it anywhere.
Thanks a lot for your help,
Yael.
1 件のコメント
Kelly Miller
2016 年 4 月 15 日
Did you ever find a way around this issue? I am having the same problem, and can't find anything online. I'm running Matlab R2015a. Thanks!
回答 (1 件)
Thorsten
2014 年 11 月 20 日
Reading the ith image: (adapted from the Mathwork's help for fitsread)
info = fitsinfo('fitsfile.fits');
rowend = info.Image.Size(1);
colend = info.Image.Size(2);
frames_in(:,:,i) = fitsread('fitsfile.fits','image',...
'Info', info,...
'PixelRegion',{[1 rowend], [1 colend], i });
1 件のコメント
カテゴリ
ヘルプ センター および File Exchange で Image Arithmetic についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!