diff --git a/software/setROIfromForcemap.m b/software/setROIfromForcemap.m index 6bb59a6..82dfc06 100644 --- a/software/setROIfromForcemap.m +++ b/software/setROIfromForcemap.m @@ -28,18 +28,20 @@ forceProc = tfmPackage.getProcess(4); p = forceProc.funParams_; % Load displ process -try - displProc = tfmPackage.getProcess(3); -catch +% ---------- Modified by Waddah Moghram on 3/7/2019 +displProc = tfmPackage.getProcess(3); +if isempty(displProc) % No correction to displacement step displProc = tfmPackage.getProcess(2); end displField=displProc.loadChannelOutput; -% SDC proc -try - SDCProc = tfmPackage.getProcess(1); -catch +%------------------------------------ +% % SDC proc--------------- +% ----------- Lines below commented out and corrected by Waddah Moghram on 3/7/2019 +SDCProc = tfmPackage.getProcess(1); +if isempty(SDCProc) % No Stage Drift Step was Done SDCProc = tfmPackage.getProcess(2); end +%----------------------- % Get force map % try % tMap = load(forceProc.outFilePaths_{2}); @@ -63,7 +65,9 @@ % tMap = load(forceProc.outFilePaths_{2}); % tMap = tMap.tMap; % end -refFrame = double(imread(SDCProc.outFilePaths_{2,1})); +%---------------- Corrected by Waddah Moghram. Should be reference frame, not dispMaps.mat on 3/7/2019 +refFrame = imread(SDCProc.funParams_.referenceFramePath); +%---------------------------------- % Use mask of first frame to filter bead detection firstMask = refFrame>0; %false(size(refFrame)); @@ -80,7 +84,10 @@ else roiMask=imread(MD.roiMaskPath_); boundROI=bwboundaries(roiMask); - hold on, plot(boundROI{1}(:,2),boundROI{1}(:,1),'w') + % ----- if-statement added by Waddah Moghram on 3/7/2019 + if ~isempty(boundROI) + hold on, plot(boundROI{1}(:,2),boundROI{1}(:,1),'w') + end % ------------------------- h=imrect; end ROI_rect = wait(h); @@ -95,19 +102,3 @@ % maskArray = MD.getROIMask; close(h2) disp('ROI created!') - - - - - - - - - - - - - - - -