MATLAB Answers

Copy header file from a fits image to a new one.

16 ビュー (過去 30 日間)
Gaetano Zarcone
Gaetano Zarcone 2020 年 1 月 21 日
Hello everybody.
I have a problem with fits header file. In particular, after I read my fits image, maipulate it and so on I woul'd like to save the new image in a new fits file but with the header of the original one. Is it possible to copy the old header in the new image?
fitswrite(img_corr,'img_corr.fits'); % image modified
import matlab.io.*
Y = fits.openFile('SAT.00022692.fit','readwrite');
Z = fits.openFile('img_corr.fits','readwrite');
% Z = fits.createFile('img_corr.fits');
info = fitsinfo('SAT.00022692.fit');
header = info.PrimaryData.Keywords;
[r1,c1] = size(header);
for i = 1:r1
fits.writeKey(Z,header{i,1},header{i,2},header{i,3}); %keyname,value,comment
end
% fits.copyHDU(Y,Z);
% fits.movAbsHDU(Y,1);
fits.closeFile(Y);
fits.closeFile(Z);
I also tried to use the commented part but it doesn't work.
What is worng?
Thank you

  0 件のコメント

サインイン to comment.

回答 (0 件)

サインイン してこの質問に回答します。

タグ


Translated by