How to save processed 3D image tiff file as tiff file again, with same tag information?
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I load a 3D tiff image.
I processed the image.
Now I want to save the image again as tiff file, with the same information for imfinfo('image.tif')
How can I do that?
I want to save this information within the tiff file:
setTag(t,'FileModDate: '29-jan-2020 14:44:18'
FileSize: 84827
Format: 'tif'
FormatVersion: []
Width: 229
Height: 352
BitDepth: 8
ColorType: 'grayscale'
FormatSignature: [73 73 42 0]
ByteOrder: 'little-endian'
NewSubFileType: 0
BitsPerSample: 8
Compression: 'Uncompressed'
PhotometricInterpretation: 'BlackIsZero'
StripOffsets: []
SamplesPerPixel: 1
RowsPerStrip: 4.2950e+09
StripByteCounts: []
XResolution: 16.5657
YResolution: 24.0214
ResolutionUnit: 'Centimeter'
Colormap: []
PlanarConfiguration: 'Chunky'
TileWidth: 80
TileLength: 352
TileOffsets: [8 28168 56328]
TileByteCounts: [28160 28160 28160]
Orientation: 1
FillOrder: 1
GrayResponseUnit: 0.0100
MaxSampleValue: 254
MinSampleValue: 0
Thresholding: 1
Offset: 84488
ImageDescription: 'MeVisLab'
Software: 'MFL MeVis File Format Library, TIFF Module'
SampleFormat: 'Unsigned integer'
0 Kommentare
Antworten (1)
Sai Sri Pathuri
am 26 Feb. 2020
You may follow the steps below to save the processed image as Tiff file.
Create a Tiff object with ‘w’ mode to write the image data to a TIFF file.
t = Tiff('processedfile.tif','w');
For new tiff file to have the same information as existing tiff file, create a tag structure with fields having same values as existing file. Note that all the parameters of imfinfo cannot be set using this structure. You may refer properties section of Tiff documentation page for declaring the required fields of structure.
For example,
tagstruct. ImageLength = size(processedImage,1);
tagstruct. ImageWidth = size(processedImage,2);
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
setTag(t,tagstruct);
write(t,processedImage);
You may also refer the examples in write function documentation for defining the tag structure and writing image to a tiff file
6 Kommentare
Walter Roberson
am 1 Mär. 2020
At each IFD, you need to write() data that is exactly the same size as the image that is present at that IFD.
There is more than one way to write 3D data to TIFF. One of the ways is to write a single image with a lot of ExtraSamples. That approach does not appear to be used much in practice for 3D images: it tends to be used more for hyperspectral data, where there is no conceptual "distance" between the panes. It is more common for 3D TIFF to be implemented as a TIFF file with multiple IFD, each of which is a single layer. That single layer might be grayscale (SamplesPerPixel is 1) or RGB (SamplesPerPixel is 3); the error message you received suggests that the TIFF file is storing each layer as seperate IFD entries.
Siehe auch
Kategorien
Mehr zu Image Data finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!