How to Read on Specific Line of Medical Format .3ddose Data

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
    tline = fgetl(fid);


That all you need to get the absorbed dose value. You can also the code (M-File) on this LINK

Post a Comment

* Please Don't Spam Here. All the Comments are Reviewed by Admin.
Post a Comment (0)

Disclaimer : Content provided on this page is for general informational purposes only. We make no representation or warranty of any kind, express or implied, regarding the accuracy, adequacy, validity, reliability, availability or completeness of any information.

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
To Top