Skip to content

Commit

Permalink
Updates to VOI related classes
Browse files Browse the repository at this point in the history
Renamed Cubic and Spherical VOI classes
Added option to set HU for VOI
  • Loading branch information
tobiasbecher committed Apr 4, 2023
1 parent ba69a3b commit cf1e27b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
classdef matRad_CubicVOI < matRad_VOIVolume
classdef matRad_PhantomVOIBox < matRad_VOIVolume
% matRad_CubicVOI implements a class that helps to create cubic VOIs
%
% References
Expand All @@ -19,26 +19,31 @@
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
properties %additional property of cubic objects
dimensions;
boxDimensions;
end
methods
function obj = matRad_CubicVOI(name,type,dimensions,varargin)

methods (Access = public)

function obj = matRad_PhantomVOIBox(name,type,boxDimensions,varargin)
p = inputParser;
addOptional(p,'objectives',{});
addOptional(p,'offset',[0,0,0]);
addOptional(p,'HU',0);
parse(p,varargin{:});

obj@matRad_VOIVolume(name,type,p); %call superclass constructor
obj.dimensions = dimensions;
obj.boxDimensions = boxDimensions;
end

function [cst] = initializeParameters(obj,ct,cst)
%add this objective to the phantomBuilders cst

cst = initializeParameters@matRad_VOIVolume(obj,cst);
center = round(ct.cubeDim/2);
VOIHelper = zeros(ct.cubeDim);
offsets = obj.offset;
dims = obj.dimensions;

dims = obj.boxDimensions;
for x = center(1)+offsets(1) - dims(1)/2 :1: center(1) + offsets(1) + dims(1)/2
for y = center(2)+offsets(2) - dims(2)/2 :1: center(2) + offsets(2) + dims(2)/2
for z = round(center(3)+offsets(3) - dims(3)/2) :1: center(3) + offsets(3) + dims(3)/2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
classdef matRad_SphericalVOI < matRad_VOIVolume
classdef matRad_PhantomVOISphere < matRad_VOIVolume
% matRad_SphericalVOI implements a class that helps to create spheric VOIs
%
% References
Expand All @@ -21,18 +21,22 @@
properties
radius;
end
methods
function obj = matRad_SphericalVOI(name,type,radius,varargin)

methods (Access = public)
function obj = matRad_PhantomVOISphere(name,type,radius,varargin)
p = inputParser;
addOptional(p,'objectives',{});
addOptional(p,'offset',[0,0,0]);
addOptional(p,'HU',0);
parse(p,varargin{:});

obj@matRad_VOIVolume(name,type,p); %call superclass constructor
obj.radius = radius;
end

function [cst] = initializeParameters(obj,ct,cst)
%add this VOI to the phantomBuilders cst

cst = initializeParameters@matRad_VOIVolume(obj,cst);
center = round([ct.cubeDim/2]);
VOIHelper = zeros(ct.cubeDim);
Expand Down
10 changes: 6 additions & 4 deletions PhantomBuilder/matRad_VOIVolume.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
classdef (Abstract) matRad_VOIVolume < handle
% matRad_VOIVolume: Interface for VOI Volumes
% This abstract base class provides the structure of VOI Volumes.
% So far implemented: Cubic and spherical objectives
% So far implemented: Box and spherical objectives
%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down Expand Up @@ -29,6 +29,7 @@
Priority = 1;
Visible = 1;
visibleColor = [0 0 0];
HU = 0;
offset = [0,0,0]; %center of objective
objectives = {};
colors = [[1,0,0];[0,1,0];[0,0,1];[1,1,0];[1,0,1];[0,1,1];[1,1,1]];
Expand Down Expand Up @@ -63,15 +64,17 @@
matRad_VOIVolume.getOrIncrementCount(1);
obj.idx = matRad_VOIVolume.getOrIncrementCount();
if obj.idx <= size(obj.colors,1)
obj.visibleColor = obj.colors(obj.idx,:)
obj.visibleColor = obj.colors(obj.idx,:);
else
obj.visibleColor = [1 1 1];
end
obj.Priority = obj.idx;
obj.name = name;
obj.type = type;
obj.offset = p.Results.offset;

obj.HU = p.Results.HU;


%idea is that DoseObjectiveFunction can be either a single objective or an
%array of objectives. If it is a single objective store it as a cell array
if iscell(p.Results.objectives)
Expand All @@ -82,7 +85,6 @@
%}
end


function cst = initializeParameters(obj,cst)
%initialize entry for this VOI in cst
cst{obj.idx,1} = obj.idx-1;
Expand Down

0 comments on commit cf1e27b

Please sign in to comment.