0001 function setup()
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 
0013 
0014 
0015 
0016 
0017 
0018 
0019 
0020 
0021 
0022 
0023 
0024 
0025 
0026 
0027 
0028 
0029 
0030 
0031 
0032 
0033 
0034 
0035 
0036 
0037 
0038 addpath( pwd );
0039 
0040 addpath(genpath( [pwd filesep 'utilities']));
0041 addpath(genpath( [pwd filesep 'models']));
0042 addpath(genpath( [pwd filesep 'demos']));
0043 
0044 if ~isCompatible
0045     rmpath( genpath( pwd ) );
0046     rmpath(genpath( 'utilities' ));
0047     error( ['CellOrganizer: The current system is not ' ...
0048         'compatible with the toolbox']);
0049 end
0050 
0051 version = '1.9.3';
0052 versionURL = 'http://murphylab.web.cmu.edu/software/CellOrganizer/version';
0053 
0054 try
0055    fprintf(1,'%s',['Checking for new stable version... ']);
0056    latestVersion = urlread( versionURL );
0057    if latestVersion(end) == 10 
0058       latestVersion = latestVersion(1:end-1);
0059    end
0060 
0061    if upgrade( version, latestVersion )
0062       fprintf(1,'%s\n',['A newer version (' latestVersion ') is available.']);
0063    else
0064       fprintf(1,'%s\n',['Version is up to date.']);
0065    end
0066    
0067    javaaddpath( [ pwd filesep ...
0068        'utilities' filesep 'bioformats' filesep 'loci_tools.jar'] );
0069 catch
0070    fprintf(1,'%s\n',['Unable to connect.']);
0071 end
0072 
0073 end
0074 
0075 
0076 function answer = upgrade( version, latestVersion )
0077 version = sscanf(version, '%d.%d.%d')';
0078 if length(version) < 3
0079    version(3) = 0;
0080 end
0081 
0082 latestVersion = sscanf(latestVersion, '%d.%d.%d')';
0083 if length(latestVersion) < 3
0084    latestVersion(3) = 0;
0085 end
0086 
0087 answer = (sign(version - latestVersion) * [10; .1; .001]) < 0;
0088 
0089 end