MATLAB Answers


how to calculate maximum, minimum dose in some specific region.

Asked by Muhammad on 24 Sep 2013
Dear All
i want to make GUI it will work as we contoure some region of interest in the patient CT in Pinnacle treatment planning system and then calculate the dose and find mean maximum dose in that region.
But i have a image file and a dose file. i want to use these to calculate the maximum, minimum, and mean doses inside the contour region. i want to make contoure in the image and use that in dose to find the dose in that region and calculate maximum, minimum, and mean dose in that region.
till now, i made a GUI i can open a image (there are 55 image Slices, i can open one at a time) on the axis then i can contour by imfreehand. i thoght if i have the all x,y cooridnates inside the region then i will find these coordinate in the dose file which is in excel for the same slice to calculate the mean maximum doses but it vain. please find some time and help me.
regards Muhammad


Sign in to comment.

1 Answer

Answer by Image Analyst
on 24 Sep 2013

Once you draw the mask and use .CreateMask to get your binary image, you can get the x,y coordinates from find()
[rows, columns] = find(binaryImage); % [y,x], not (x,y) because rows = y.
Then call xlsread() to read in the x,y coordinates from your workbook and find the max.


OK so read it in as a 2D array of numbers, called dose. Then convert your binary image to dose like this:
doseImage = zeros(size(binaryImage)); % Preallocate dose image.
doseImage(binaryImage) = dose(binaryImage);
This assumes that your dose array in the workbook corresponds column for column and row for row with your image.
Dear Dr. i ma new in MATLAB envirment but trying to learn this. i want to clear more so that it will be better understandable. i upload image on Axis GUI then i zoom the image and contoure some part and created a excel sheet. that contains [y,x] values. i want to calculate the dose of these [y,x]values using the another excel file which is dose file of the same image and have 127 rows and 127 columns and contains dose at every coordinate. i think now this will be more understandable. the code i used is given below.
if true
function Contourpushbutton_Callback(hObject, eventdata, handles)
% imfreehand
% waitfor(h);
pos = getPosition(h);
% sz = size(handles.listbox1);
handles.output = hObject;
index = get(handles.listbox1,'value');
sz = size(handles.I{index});
handles.maskedImage = poly2mask(pos(:,1), pos(:,2), sz(1), sz(2));
guidata(hObject, handles); %use this line to save the handles structure during callbacks
if true
[x, y] = find(handles.maskedImage ~= 0);
[FileName,PathName] = uiputfile('*.xls','Save data to spreadsheet');
xlswrite([PathName '/' FileName],Data);
You can use the .createMask method to create a binary image directly, instead of using poly2mask, as shown in the attached demo below.
But I'm not sure how the image and the mask you draw on it is related to the table of dose numbers in the workbook, and what you want as a final output.

Sign in to comment.