Skip to content

Commit

Permalink
feature: Recentering to iso center button
Browse files Browse the repository at this point in the history
  • Loading branch information
amitantony committed May 31, 2023
1 parent 37c2f02 commit 8c2d20e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gui/widgets/matRad_ViewingWidget.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
plotDose = true;
plotIsoDoseLines = true;
plotIsoDoseLinesLabels = false;
plotLegend = true;
plotLegend = false;
plotColorBar = true;
ProfileType = 'lateral';
SelectedDisplayOption = 'physicalDose';
Expand Down
44 changes: 40 additions & 4 deletions gui/widgets/matRad_VisualizationWidget.m
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,21 @@
'FontName',matRad_cfg.gui.fontName,...
'FontWeight',matRad_cfg.gui.fontWeight,...
'Tag','sliderOffset');
h25 = uicontrol(...
'Parent',h36,...
'Units','normalized',...
'String','Recenter',...
'Tooltip','Recenter ct to isocenter',...
'Position',gridPos{2,4},...
'BackgroundColor',[0.8 0.8 0.8],...
'Callback',@(hObject,eventdata) btnRecenter_Callback(this,hObject,eventdata),...
'Enable','off',...
'Tag','btnRecenter',...
'BackgroundColor',matRad_cfg.gui.elementColor,...
'ForegroundColor',matRad_cfg.gui.textColor,...
'FontSize',matRad_cfg.gui.fontSize,...
'FontName',matRad_cfg.gui.fontName,...
'FontWeight',matRad_cfg.gui.fontWeight);

%Third Column
h44 = uicontrol(...
Expand Down Expand Up @@ -617,7 +632,8 @@ function getFromViewingWidget(this)
set(handles.radiobtnIsoDoseLines,'Enable','on');
set(handles.radiobtnIsoDoseLinesLabels,'Enable','on');
set(handles.sliderSlice,'Enable','on');

set(handles.btnRecenter, 'Enable','on');

% profile plot
elseif this.viewingWidgetHandle.typeOfPlot == 2

Expand All @@ -630,8 +646,8 @@ function getFromViewingWidget(this)
set(handles.radiobtnIsoDoseLines,'Enable','off');
set(handles.sliderSlice,'Enable','off');
set(handles.radiobtnIsoDoseLinesLabels,'Enable','off');
set(handles.popupProfileType,'Enable','on')

set(handles.popupProfileType,'Enable','on');
set(handles.btnRecenter, 'Enable','off');
end

end
Expand Down Expand Up @@ -857,6 +873,26 @@ function radioBtnIsoCenter_Callback(this,hObject, eventdata)
%UpdatePlot(handles)
% Hint: get(hObject,'Value') returns toggle state of radioBtnIsoCenter
this.viewingWidgetHandle.plotIsoCenter = get(hObject,'Value');
end
end

% --- Executes on button press in btnRecenter
% currently imlpemented for one single isocenter for all beams
function btnRecenter_Callback(this,hObject, eventdata)
% hObject handle to radioBtnIsoCenter (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%UpdatePlot(handles)
% Hint: get(hObject,'Value') returns toggle state of radioBtnIsoCenter
if evalin('base','exist(''pln'')') && evalin('base','exist(''ct'')')
pln = evalin('base','pln');
ct = evalin('base','ct');
uniqueIsoCenters = unique(pln.propStf.isoCenter,'rows');
vIsoCenter = round(uniqueIsoCenters./[ct.resolution.x ct.resolution.y ct.resolution.z]);
isoSlice = vIsoCenter(this.viewingWidgetHandle.plane);
this.viewingWidgetHandle.slice = isoSlice;
end


end
end
end

0 comments on commit 8c2d20e

Please sign in to comment.