In this thread I will share the code about getting specific information from standar medical format data by using MATLAB Code. There are at least two kinds of geometry format; cylindical and cartesian. In this thread I only use cartesian format .3ddose data. For cylindrical format will be write soon.
A File with 3ddose format consists of six line of data including information about :
Line 1 : Number of phantom pixel on x, y, and z direction.
Line 2 : Center location of each pixel on x axis.
Line 3 : Center location of each pixel on y axis.
Line 4 : Center location of each pixel on z axis.
Line 5 : Absorbed dose on each pixel
Line 6 : Error
Matlab Implementation
It is supposed that you are trying to get all absorbed dose data in line 5 from "sample.3ddose".
Here is the code,
% created 7/13/2017
filename = ('sample.3ddose') ;
Line = 5 ; % line to read
fid = fopen(filename);
tline = fgetl(fid);
gline = Line ;
i = 0 ;
while ischar(tline)
i = i+1 ;
if (i == gline)
output= str2num(tline) ; % convert string to numerical value
end
tline = fgetl(fid);
end
fclose(fid);
That all you need to get the absorbed dose value. You can also the code (M-File) on this LINK.
A File with 3ddose format consists of six line of data including information about :
Line 1 : Number of phantom pixel on x, y, and z direction.
Line 2 : Center location of each pixel on x axis.
Line 3 : Center location of each pixel on y axis.
Line 4 : Center location of each pixel on z axis.
Line 5 : Absorbed dose on each pixel
Line 6 : Error
Matlab Implementation
It is supposed that you are trying to get all absorbed dose data in line 5 from "sample.3ddose".
Here is the code,
% created 7/13/2017
filename = ('sample.3ddose') ;
Line = 5 ; % line to read
fid = fopen(filename);
tline = fgetl(fid);
gline = Line ;
i = 0 ;
while ischar(tline)
i = i+1 ;
if (i == gline)
output= str2num(tline) ; % convert string to numerical value
end
tline = fgetl(fid);
end
fclose(fid);
That all you need to get the absorbed dose value. You can also the code (M-File) on this LINK.