diff --git a/zUtil_TomoUtils/GtGrainsManager.m b/zUtil_TomoUtils/GtGrainsManager.m index 89fa878a9c7613ab47cda250d2971a222484a61e..54e78e2b67c8b483b568677726478253cae2f671 100644 --- a/zUtil_TomoUtils/GtGrainsManager.m +++ b/zUtil_TomoUtils/GtGrainsManager.m @@ -470,14 +470,25 @@ classdef GtGrainsManager < GtVolView end function toggleAbsorptionVolume(obj) - if (isempty(obj.conf.overlay)) - obj.changeOverlay([obj.sample.absVolFile ':abs']); - newValueAbsVol = get(obj.conf.h_abs_butt, 'Max'); - else - obj.changeOverlay([]); - newValueAbsVol = get(obj.conf.h_abs_butt, 'Min'); + try + if (isempty(obj.conf.overlay)) + if (isempty(obj.sample.absVolFile)) + error('GUI:GtGrainsManager:wrong_argument', ... + 'Absorption volume file not specified!') + end + absFile = [obj.sample.absVolFile ':abs']; + obj.changeOverlay(absFile); + newValueAbsVol = get(obj.conf.h_abs_butt, 'Max'); + else + obj.changeOverlay([]); + newValueAbsVol = get(obj.conf.h_abs_butt, 'Min'); + end + set(obj.conf.h_abs_butt, 'Value', newValueAbsVol); + catch mexc + gtPrintException(mexc) + d = errordlg(['Error: ' mexc.message], mexc.identifier, 'modal'); + uiwait(d); end - set(obj.conf.h_abs_butt, 'Value', newValueAbsVol); end function setVolumeToLoad(obj, volume_str) diff --git a/zUtil_TomoUtils/GtVolView.m b/zUtil_TomoUtils/GtVolView.m index cdac0ba194c930edcac758d5ba8e932f501392dc..868de00848efb998cb055e0d8fc8054b8cd9410b 100644 --- a/zUtil_TomoUtils/GtVolView.m +++ b/zUtil_TomoUtils/GtVolView.m @@ -736,6 +736,11 @@ classdef GtVolView < GtBaseGuiElem % already a volume or a filename. In case of filename, tries to guess % also the format if isa(vol, 'char') % user has specified a filename + if (isempty(vol)) + error('GtVolView:loadVolume:wrong_argument', 'Empty volume filename') + elseif (strfind(vol, ':') == 1) + error('GtVolView:loadVolume:wrong_argument', 'Invalid volume filename: %s', vol) + end [~, ~, ext] = fileparts(vol); ext = regexp(ext, ':', 'split'); switch (ext{1})