0

*ストロング テキスト*ドキュメントの例に従って、2012a で MATLAB TIFF クラスを使用して複数ページの TIF ファイルを保存しようとしています。私の使用法は、約 -10,000 から 200,000 の範囲の値を持つ 32 ビットのグレースケール イメージを書いているという点で異なります。

% Use 'a' for 'append' since this code is in a loop that writes each page.
% Note: 'fileName' is defined elsewhere and the file is created.
t = Tiff(fileName, 'a');

tagstruct.ImageLength = size(result, 2);
tagstruct.ImageWidth = size(result, 1);
tagstruct.Photometric = Tiff.Photometric.MinIsBlack;
tagstruct.SampleFormat = Tiff.SampleFormat.IEEEFP;
tagstruct.Compression = Tiff.Compression.None;
tagstruct.BitsPerSample = 32;
tagstruct.SamplesPerPixel = 1;
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
tagstruct.Software = 'MATLAB';
t.setTag(tagstruct);

% Viewing the data immediately before the 'write' operation shows it correct.
% imtool(result(:, :, j));
% Tools -> Adjust Contrast                       
t.write(result(:, :, j));

t.close();

MATLAB と ImageJ の両方で調べた出力イメージは正しいサイズで、正しいメタデータを持っていますが、すべての値が 0 です。

アップデート:

MATLAB のドキュメントは、それ自体がLibTIFF ライブラリのラッパーである TIFF クラスについてはややまばらです。公式のTIFF 仕様バージョン 6は、各 TIF 画像タイプの必須フィールドの完全なリストを示しています。

4

1 に答える 1

1

MATLAB ドキュメントの例: Exporting to imagesには、コードにない行が 1 つあります。

tagstruct.RowsPerStrip = 16

RowsPerStripしたがって、フィールドが欠落tagstructしていることが、すべてゼロのイメージの原因である可能性があります。

于 2012-05-15T15:27:02.163 に答える