Reputation: 317
I stacked 10 images using the cat
function, getting an image stack labeled myImage, which has dimension: 100x100x10
(each image has 100x100
dimension). I want to convert this file into a GDF file using write_gdf
. However, when I try to run this conversion,
myImage = cat(3,X{1:NumberOfFiles});
s = write_gdf('stack.gdf',myImage);
I expected s
to be a 3D matrix with dimension 100x100x10
with values equal to that of myImage
. Instead,I simply get s to be a 1D variable: s=3
.
In the write_gdf
help, it is mentioned:
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
Please help. Thank you in advance!
Upvotes: 0
Views: 132
Reputation: 7895
I believe the help section to be misleading. If you examine the code, you will find the following:
function [fid]=write_gdf(fn, data)
fid=fopen(fn,'w');
Note: I have removed all unrelated parts of the code.
You provide a file name (fn
) and the data (data
) to the function. Internally, it calls fopen
on the file name an stores the file ID in fid
. From the fopen
documentation:
fileID: the File identifier of an open file, specified as an integer.
This is the only output of this function to Matlab. And this is what you see as s=3
.
Why the help paragraph says:
% 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.
I can only guess. Maybe it is meant that data
is the output to the file (but not to Matlab). This might just explain how the data is "output" to the file.
Upvotes: 1