Home > SuperSegger > viz > intLoadDataViewer.m

intLoadDataViewer

PURPOSE ^

intLoadDataViewer : used to load data in superSeggerViewer

SYNOPSIS ^

function [data_r, data_c, data_f] = intLoadDataViewer(dirname, contents, nn, num_im, clist, FLAGS)

DESCRIPTION ^

 intLoadDataViewer : used to load data in superSeggerViewer
 INPUT :
       dirname : seg directory name
       contents: contains all names of files in the directory
       nn : image number to be loaded
       num_im : total number of images
       clist : clist 
       FLAGS : current flags

 OUTPUT : 
   data_r: reverse frame data file (err/seg)
   data_c: current frame data file (err/seg)
   data_f: forward frame data file (err/seg)

 Copyright (C) 2016 Wiggins Lab
 Written by Paul Wiggins, Stella Stylianidou, Connor Brennan.
 University of Washington, 2016
 This file is part of SuperSegger.

 SuperSegger is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 SuperSegger is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with SuperSegger.  If not, see <http://www.gnu.org/licenses/>.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function [data_r, data_c, data_f] = intLoadDataViewer(dirname, contents, nn, num_im, clist, FLAGS)
0002 % intLoadDataViewer : used to load data in superSeggerViewer
0003 % INPUT :
0004 %       dirname : seg directory name
0005 %       contents: contains all names of files in the directory
0006 %       nn : image number to be loaded
0007 %       num_im : total number of images
0008 %       clist : clist
0009 %       FLAGS : current flags
0010 %
0011 % OUTPUT :
0012 %   data_r: reverse frame data file (err/seg)
0013 %   data_c: current frame data file (err/seg)
0014 %   data_f: forward frame data file (err/seg)
0015 %
0016 % Copyright (C) 2016 Wiggins Lab
0017 % Written by Paul Wiggins, Stella Stylianidou, Connor Brennan.
0018 % University of Washington, 2016
0019 % This file is part of SuperSegger.
0020 %
0021 % SuperSegger is free software: you can redistribute it and/or modify
0022 % it under the terms of the GNU General Public License as published by
0023 % the Free Software Foundation, either version 3 of the License, or
0024 % (at your option) any later version.
0025 %
0026 % SuperSegger is distributed in the hope that it will be useful,
0027 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0028 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0029 % GNU General Public License for more details.
0030 %
0031 % You should have received a copy of the GNU General Public License
0032 % along with SuperSegger.  If not, see <http://www.gnu.org/licenses/>.
0033 
0034 
0035 data_c = loaderInternal([dirname,contents(nn).name], clist);
0036 data_r = [];
0037 data_f = [];
0038 if shouldLoadNeighborFrames(FLAGS)
0039     if nn > 1
0040         data_r = loaderInternal([dirname,contents(nn-1).name], clist);
0041     end
0042     if nn < num_im-1
0043         data_f = loaderInternal([dirname,contents(nn+1).name], clist);
0044     end
0045 end
0046 end
0047 
0048 function value = shouldLoadNeighborFrames(FLAGS)
0049 % shouldLoadNeighborFrames : checks if reverse and forward frame should be
0050 % loaded.
0051 value = FLAGS.m_flag == 1 || FLAGS.showLinks == 1;
0052 end
0053 
0054 function data = loaderInternal(filename, clist)
0055 % loaderInternal : loads the clist and creates outlines of the cells in the
0056 % clist.
0057 data = load(filename);
0058 ss = size(data.phase);
0059 if isfield( data, 'mask_cell' )
0060     data.outline = xor(bwmorph( data.mask_cell,'dilate'), data.mask_cell);
0061 end
0062 if ~isempty(clist)
0063     clist = gate(clist);
0064     data.cell_outline = false(ss);
0065     if isfield( data, 'regs' ) && isfield( data.regs, 'ID' )
0066         ind = find(ismember(data.regs.ID,clist.data(:,1)));
0067         mask_tmp = ismember( data.regs.regs_label, ind );
0068         data.cell_outline = xor(bwmorph( mask_tmp, 'dilate' ), mask_tmp);       
0069    end
0070 end
0071 end

Generated on Thu 19-Jan-2017 13:55:21 by m2html © 2005