Image 将三维阵列转换为GDF格式
我使用Image 将三维阵列转换为GDF格式,image,matlab,Image,Matlab,我使用cat函数堆叠了10幅图像,得到了一个标记为myImage的图像堆栈,其维度为:100x100x10(每个图像都有100x100维度)。我想使用write\u GDF将此文件转换为GDF文件。但是,当我尝试运行此转换时 myImage = cat(3,X{1:NumberOfFiles}); s = write_gdf('stack.gdf',myImage); 我希望s是一个三维矩阵,尺寸100x100x10,其值等于myImage的值。相反,我只是简单地将s设为1D变量:s=3 在w
cat
函数堆叠了10幅图像,得到了一个标记为myImage的图像堆栈,其维度为:100x100x10
(每个图像都有100x100
维度)。我想使用write\u GDF
将此文件转换为GDF文件。但是,当我尝试运行此转换时
myImage = cat(3,X{1:NumberOfFiles});
s = write_gdf('stack.gdf',myImage);
我希望s
是一个三维矩阵,尺寸100x100x10
,其值等于myImage
的值。相反,我只是简单地将s设为1D变量:s=3
在write\u gdf
帮助中,提到:
NAME:
write_gdf
PURPOSE:
write data files in gdf format.
CATEGORY:
General Purpose Utility
CALLING SEQUENCE:
fid = write_gdf(filename,data)
INPUTS:
file: Complete pathname of the file to be written.
OUTPUTS:
data: Data structure. For example, if the original
data was stored as an array of bytes, then
DATA will be returned as an array of bytes also.
RESTRICTIONS:
Current implementation does not support structures or
arrays of structures.
PROCEDURE:
Reasonably straightforward.
Determines if the file is ASCII or binary, reads the size
and dimension info from the header, and reads in the data
请帮忙。提前谢谢你 我认为帮助部分有误导性。如果进行检查,您将发现以下内容:
function [fid]=write_gdf(fn, data)
fid=fopen(fn,'w');
注意:我已经删除了代码中所有不相关的部分。向函数提供文件名(
fn
)和数据(data
)。在内部,它对文件名调用fopen
,并将文件ID存储在fid
中。从文件中:
fileID:打开文件的文件标识符,指定为整数
这是该函数到Matlab的唯一输出。这就是你所看到的s=3
为什么“帮助”一段说:
% OUTPUTS:
% data: Data structure. For example, if the original
% data was stored as an array of bytes, then
% DATA will be returned as an array of bytes also.
我只能猜测。可能这意味着
数据
是文件(而不是Matlab)的输出。这可能只是解释了数据是如何“输出”到文件中的。@Schorsch,我希望s
也是一个维度为100x100x10
的三维文件。正在写入文件s
,但它是一个值为3的1D变量。我会修改这个问题,让它更清楚地表达我的期望。谢谢。是的,很抱歉回复晚了。