필터 지우기
필터 지우기

Time information in TIFF files

조회 수: 10 (최근 30일)
Eric
Eric 2011년 1월 26일
댓글: Xiaoli 2017년 2월 9일
I am using "imwrite" and "WriteMode" "Append" to create a multi-tif file (a movie). I would like to include information about the time that each tif image was created in the multi-tif file. How do I add time information to the tif files?

채택된 답변

John
John 2011년 2월 18일
There is a tag called 'DateTime' that is intended for this purpose, but IMWRITE can only write a limited subset of TIFF tags, and 'DateTime' is not in that subset.
The Tiff object (introduced in R2009b) can manipulate a much broader set of tags, so it may suit your purposes better than IMWRITE. For example, to write out a multi-page TIFF consisting of the first through the 12th eigenfunctions of the L-shaped membrane, one could do something like the following:
t = Tiff('myfile.tif','w');
tagstruct.ImageWidth = 31;
tagstruct.ImageLength = 31;
tagstruct.Photometric = Tiff.Photometric.MinIsBlack;
tagstruct.BitsPerSample = 64;
tagstruct.SampleFormat = Tiff.SampleFormat.IEEEFP;
tagstruct.RowsPerStrip = 31;
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
for k = 1:12
data = membrane(k);
tagstruct.DateTime = datestr(now,31);
t.setTag(tagstruct);
t.write(data);
t.writeDirectory();
end
t.close();
The 'DateTime' tag is limited to 20 characters, so if you need more temporal resolution than that, you might have to hijack another tag for your purposes, such as 'ImageDescription' or 'XMP'.
  댓글 수: 4
Angelina
Angelina 2012년 9월 4일
I see, oversight on my part. Thank you for clarifying!
Xiaoli
Xiaoli 2017년 2월 9일
To write in append mode change 'w' to 'a'

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by