隐藏的 Matlab TIFF 品牌?
Hidden Matlab TIFF brand?
我正在对计算机断层扫描投影图像进行图像处理。原始图像是 CT 机输出的 .tiff。我将它导入 Matlab,在那里我处理它并使用 imwrite() 保存输出图像。
我之后用来重建 CT 图像的软件是专有的,但支持从任何 .tiff 图像重建,只要它们遵循特定标准。显然 Matlab 不遵循这个标准,因为它似乎以某种方式标记了它保存的所有 .tiff 图像。我可以通过使用第三方软件加载所有图像并再次保存它们来解决这个问题,这似乎可以擦除标签并允许重建。这既乏味又耗时,因为我每天必须多次这样做。
我尝试使用 Matlab Tiff -class 加载 'normal' 和 'scrubbed' .tiff。我手动遍历了结构中的所有字段,没有发现任何区别,尽管另一个不会加载到 CT 程序中,另一个很好。
Matlab 是否有一种隐藏的方式以某种方式标记这些图像?是否可以在 Matlab 中擦除这些图像?
我不能完全确定,但 Matlab 添加隐藏品牌的可能性很小。
根据tiff格式标准,添加隐藏品牌到tif
文件,不会导致tiff reader软件失败。
参考私人标签部分:
Developers can apply for a block of "private tags" to enable them to include their own proprietary information inside a TIFF file without causing problems for file interchange. TIFF readers are required to ignore tags that they do not recognize, and a registered developer's private tags are guaranteed not to clash with anyone else's tags or with the standard set of tags defined in the specification...
您使用的CT-images软件似乎不符合tiff标准。
该软件可能(但不太可能)符合 tiff 的旧版本(版本 5.0 而不是版本 6.0)。
失败的一个原因可能是,Matalb 创建了非常大的条带,并且没有遵循 8K 字节的建议。
参考https://www.itu.int/itudoc/itu-t/com16/tiff-fx/docs/tiff6.pdf:
Use of a single strip is not recommended. Choose RowsPerStrip such that each strip is
about 8K bytes, even if the data is not compressed, since it makes buffering simpler
for readers. The “8K” value is fairly arbitrary, but seems to work well.
查看以下代码(我已经贴出):
%Simulate large image (to be saved as tiff later)
I = imread('peppers.png');
I = repmat(I, [4, 4]);
t = Tiff('I.tif', 'w');
width = size(I, 2);
height = size(I, 1);
rows_per_strip = 1; %Select 1 row per strip (assume image row is less then 8K bytes).
setTag(t, 'ImageLength', height)
setTag(t, 'ImageWidth', width)
setTag(t, 'Photometric', Tiff.Photometric.RGB)
setTag(t, 'BitsPerSample', 8)
setTag(t, 'SamplesPerPixel', 3)
setTag(t, 'RowsPerStrip', rows_per_strip)
setTag(t, 'PlanarConfiguration', Tiff.PlanarConfiguration.Chunky)
%setTag(t, 'Compression', Tiff.Compression.LZW)
setTag(t, 'Compression', Tiff.Compression.None) %Try without compression
n_strips = ceil(height / rows_per_strip); %Total number of strips.
h = waitbar(0, 'In process');
%Write the tiff image strip by strip (and advance the waitbar).
for i = 1:n_strips
y0 = (i-1)*rows_per_strip + 1; %First row of current strip.
y1 = min(y0 + rows_per_strip - 1, height); %Last row of current strip.
writeEncodedStrip(t, i, I(y0:y1, :, :)) %Write strip rows y0 to y1.
waitbar(i/n_strips, h); %Update waitbar.
drawnow %Force GUI refresh.
end
close(t)
close(h)
失败可能有很多其他原因,因为 tiff 格式非常复杂(尤其是 reader 方面)。
我正在对计算机断层扫描投影图像进行图像处理。原始图像是 CT 机输出的 .tiff。我将它导入 Matlab,在那里我处理它并使用 imwrite() 保存输出图像。
我之后用来重建 CT 图像的软件是专有的,但支持从任何 .tiff 图像重建,只要它们遵循特定标准。显然 Matlab 不遵循这个标准,因为它似乎以某种方式标记了它保存的所有 .tiff 图像。我可以通过使用第三方软件加载所有图像并再次保存它们来解决这个问题,这似乎可以擦除标签并允许重建。这既乏味又耗时,因为我每天必须多次这样做。
我尝试使用 Matlab Tiff -class 加载 'normal' 和 'scrubbed' .tiff。我手动遍历了结构中的所有字段,没有发现任何区别,尽管另一个不会加载到 CT 程序中,另一个很好。
Matlab 是否有一种隐藏的方式以某种方式标记这些图像?是否可以在 Matlab 中擦除这些图像?
我不能完全确定,但 Matlab 添加隐藏品牌的可能性很小。
根据tiff格式标准,添加隐藏品牌到tif
文件,不会导致tiff reader软件失败。
参考私人标签部分:
Developers can apply for a block of "private tags" to enable them to include their own proprietary information inside a TIFF file without causing problems for file interchange. TIFF readers are required to ignore tags that they do not recognize, and a registered developer's private tags are guaranteed not to clash with anyone else's tags or with the standard set of tags defined in the specification...
您使用的CT-images软件似乎不符合tiff标准。
该软件可能(但不太可能)符合 tiff 的旧版本(版本 5.0 而不是版本 6.0)。
失败的一个原因可能是,Matalb 创建了非常大的条带,并且没有遵循 8K 字节的建议。
参考https://www.itu.int/itudoc/itu-t/com16/tiff-fx/docs/tiff6.pdf:
Use of a single strip is not recommended. Choose RowsPerStrip such that each strip is about 8K bytes, even if the data is not compressed, since it makes buffering simpler for readers. The “8K” value is fairly arbitrary, but seems to work well.
查看以下代码(我已经贴出
%Simulate large image (to be saved as tiff later)
I = imread('peppers.png');
I = repmat(I, [4, 4]);
t = Tiff('I.tif', 'w');
width = size(I, 2);
height = size(I, 1);
rows_per_strip = 1; %Select 1 row per strip (assume image row is less then 8K bytes).
setTag(t, 'ImageLength', height)
setTag(t, 'ImageWidth', width)
setTag(t, 'Photometric', Tiff.Photometric.RGB)
setTag(t, 'BitsPerSample', 8)
setTag(t, 'SamplesPerPixel', 3)
setTag(t, 'RowsPerStrip', rows_per_strip)
setTag(t, 'PlanarConfiguration', Tiff.PlanarConfiguration.Chunky)
%setTag(t, 'Compression', Tiff.Compression.LZW)
setTag(t, 'Compression', Tiff.Compression.None) %Try without compression
n_strips = ceil(height / rows_per_strip); %Total number of strips.
h = waitbar(0, 'In process');
%Write the tiff image strip by strip (and advance the waitbar).
for i = 1:n_strips
y0 = (i-1)*rows_per_strip + 1; %First row of current strip.
y1 = min(y0 + rows_per_strip - 1, height); %Last row of current strip.
writeEncodedStrip(t, i, I(y0:y1, :, :)) %Write strip rows y0 to y1.
waitbar(i/n_strips, h); %Update waitbar.
drawnow %Force GUI refresh.
end
close(t)
close(h)
失败可能有很多其他原因,因为 tiff 格式非常复杂(尤其是 reader 方面)。