"README.txt" did not exist on "245d84c1910453ded1ca95b13f8c9ee1356ba92a"
Newer
Older
function initialise_gt(ignore_id19)
% INITIALISE.M for Matlab installations on Windows, Macs, and Linux
% ADD DESIRED PATH ENTRIES TO THIS LIST FOLLOWING THE EXISTING FORMAT!!
% PT, big bug with image display due to openGL. crashed completely
% ganymedes. disabled the 03/12/07
% '/graintracking',... % Grain tracking project (WL,MHG,AK) * symlink *
% 24/05/2010 PT correction to ensure that personnal startup is read at the
% end of the initialisation if present for non DCT people
Nicola Vigano
committed
% 2011-2013, Modified and improved by Nicola Vigano', vigano@esrf.fr
% 2012, Modified and improved by Yoann Guilhem, guilhem@esrf.fr
Nicola Vigano
committed
% 2005, Create by Greg & Wolfgang
if (~exist('ignore_id19', 'var'))
Nicola Vigano
committed
ignore_id19 = true;
pathstruct={... % Tools from ID19's legacy code
{'/' },...
{'/art' },... % Algebraic reconstruction attempts
{'/util' },...
{'/stitching' },... % Image stitching code
{'/stitching/heprom' },...
{'/sliceomatic' },... % Viewing tool for volumes
{'/IBF' },... % IBF tools (Olivier Hignette & Greg Johnson)
{'/moretomo' },... % tomography tools in development
{'/tracking' },... % particle tracking (Weitzlab, www.harvard.edu)
{'/ringcorrection' },... % ring correction code
{'/imagej' },... % imagej support
{'/lsge-matlab' },... % fitting routines from the NPL in the UK
{'/lamino' }... % laminography specific (LH)
{'/tomotools', '-begin'}... % Tools for tomography
};
% {'/parallel' },... % embarrasingly parallel matlab (ML and GJ)
disp('Graintracking settings in progress...');
% No multi platform support, at the moment.
if (~ignore_id19)
deprecated_id19_paths = fullfile('/data','id19','archive','matlab');
% Linux machines
if (~exist(deprecated_id19_paths, 'dir'))
error(['ERROR: No folder called: "' deprecated_id19_paths '"']);
% Adding paths
for n = 1:length(pathstruct)
switch size(pathstruct{n}, 2)
case 1
addpath(fullfile(deprecated_id19_paths, pathstruct{n}{1}));
addpath(fullfile(deprecated_id19_paths, pathstruct{n}{1}), pathstruct{n}{2});
disp(['Wrong parameters number for entry "', n, '"(', pathstruct{n}{1} ,') of structure "pathstruct"']);
addpath(fullfile(deprecated_id19_paths, pathstruct{n}{1}));
% suppress extra linefeeds in command window
%%%%%%%%%%%%%%%%%%%%%%
% other special settings
% changing default settings at root level
set(0,'DefaultFigurePaperType','A4');
set(0,'DefaultFigurePaperUnits','centimeters');
% beamline (for alignment)
FT_BL = 'id19';
% volume selection in fasttomo; values are 'total', 'manual', 'graphics'
FT_VOLSELECT = 'graphics';
% initialise path for graintracking project
disp('Adding graintracking specific folders to the path');
global GT_MATLAB_HOME;
if (isempty(GT_MATLAB_HOME))
GT_MATLAB_HOME = pwd;
end
disp(['Using the DCT code in directory ' GT_MATLAB_HOME]);
addpath(fullfile(GT_MATLAB_HOME, '1_preprocessing'));
addpath(fullfile(GT_MATLAB_HOME, '1_preprocessing', 'gtSetup_Utils'));
addpath(fullfile(GT_MATLAB_HOME, '2_difspot'));
addpath(fullfile(GT_MATLAB_HOME, '3_pairmatching'));
Peter Reischig
committed
addpath(fullfile(GT_MATLAB_HOME, '3_pairmatchingGUI'));
addpath(fullfile(GT_MATLAB_HOME, '4_grains'));
addpath(fullfile(GT_MATLAB_HOME, '5_reconstruction'));
addpath(fullfile(GT_MATLAB_HOME, '6_rendering'));
addpath(fullfile(GT_MATLAB_HOME, '7_fed'));
addpath(fullfile(GT_MATLAB_HOME, '7_fed', 'AndyFunctions'));
addpath(fullfile(GT_MATLAB_HOME, '7_fed', 'geometry'));
addpath(fullfile(GT_MATLAB_HOME, '7_fed', 'Ccode_SpreadInt'));
addpath(fullfile(GT_MATLAB_HOME, '7_fed2'));
addpath(fullfile(GT_MATLAB_HOME, '8_optimization'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Analysis'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Boundaries'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Crack'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Cryst'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Cryst', 'file_cif'));
Nicola Vigano
committed
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_DataStructures'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Deformation'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_DB'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Distortion'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Drawing'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Drawing', 'cm_and_cb_utilities'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Drawing', 'freezeColors'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_EDF'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_ErrorHandling'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Fit'));
Nicola Vigano
committed
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_ForwardSim'));
Peter Reischig
committed
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Geo'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_GUI'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_GUI', 'GUILayout-v1p17'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_GUI', 'GUILayout-v1p17', 'Patch'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_GUI', 'FindJObj'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_GVF'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Help'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Help', 'ExportFig'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Help', 'cprintf'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_ICP'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_ID19'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Imaging'));
Peter Reischig
committed
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Indexter'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Maths'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_NoiseAnalysis'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_OAR'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Parameters'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Python'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Strain'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Strain2'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Taper'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_TIFF'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_TomoUtils'));
Laura Nervo
committed
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_Twins'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_VTK'));
addpath(fullfile(GT_MATLAB_HOME, 'zUtil_XML'));
addpath(fullfile(GT_MATLAB_HOME, 'FigureManagement'));
addpath(fullfile(GT_MATLAB_HOME, 'm2html'));
% matGeom toolbox
addpath(fullfile(GT_MATLAB_HOME, 'matGeom'));
% C Compiled code
addpath(fullfile(GT_MATLAB_HOME, 'bin', 'mex'));
Wolfgang Ludwig
committed
disp('Loading configuration about external libraries from conf.xml');
xmlConf = xml_read(fullfile(GT_MATLAB_HOME, 'conf.xml'));
% File and dirs patterns
GT_DB = [];
if isfield(xmlConf, 'database')
GT_DB.name = xmlConf.database.name;
GT_DB.host = xmlConf.database.host;
GT_DB.user = xmlConf.database.user;
GT_DB.password = xmlConf.database.password;
else
GT_DB.name = 'graintracking';
GT_DB.host = 'graindb.esrf.fr';
GT_DB.user = 'gtadmin';
GT_DB.password = 'gtadmin';
end
[~, hostname] = system('hostname');
try
inCellForm = iscell(xmlConf.astra.mex.path);
for n = 1:length(xmlConf.astra.mex.path)
if inCellForm
tmp_path = xmlConf.astra.mex.path{n};
else
tmp_path = xmlConf.astra.mex.path(n);
end
if isfield(tmp_path, 'ATTRIBUTE')
if isfield(tmp_path.('ATTRIBUTE'), 'hostname')
hosts = tmp_path.('ATTRIBUTE').('hostname');
for host = regexp(hosts, ',', 'split')
if ~isempty(regexp(hostname, host{1}, 'once'))
addpath(tmp_path.('CONTENT'));
end
end
else
end
else
addpath(tmp_path);
end
'No Astra Configuration. Using hardcoded paths for Astra mex files');
addpath('/scisoft/users/batenbur/gpu/matlab');
addpath('/scisoft/users/batenbur/gpu/matlab/algorithms');
end
Wolfgang Ludwig
committed
% Check which version of matlab compiled the oar executables
if isfield(xmlConf, 'matlab') && isfield(xmlConf.matlab, 'version')
matlabVersion = xmlConf.matlab.version;
currentMatlabRelease = version('-release');
if (~strcmpi(currentMatlabRelease, matlabVersion))
warning('MATLAB_COMPILED:version_mismatch', ...
['You are now running matlab "%s", but the matlab ' ...
'command specified in conf.xml is "%s".\nThere is no ' ...
'guarantee that OAR jobs will work'], ...
currentMatlabRelease, matlabVersion);
end
else
warning('XML:no_matlab_version', ...
'Couldn''t find matlab version in conf.xml');
end
disp('Finished adding.');
disp('Checking compiled functions...');
current_dir = pwd;
cd(fullfile(GT_MATLAB_HOME, 'bin', 'scripts'));
mFiles = compile(false, false);
funcNames = fieldnames(mFiles);
defaultColor = sprintf(gtGetANSIColour());
yellowColor = sprintf(gtGetANSIColour('yellow'));
boldColor = sprintf(gtGetANSIColour('bold'));
for funcName = reshape(funcNames, [1 numel(funcNames)])
func = mFiles.(funcName{1});
mat_file_path = func.('in_mfile');
comp_file_path = func.('out_file');
[upToDate, msg] = gtCheckFunctionUpToDate(mat_file_path, comp_file_path);
if (~upToDate)
out = [yellowColor 'Function should be recompiled: ' ...
defaultColor funcName{1}];
disp(out);
fprintf(msg);
end
end
cd(current_dir);
disp('Finished checking.');
% Warning when launched on a Windows PC
if (ispc())
% Rendering: the default renderer may have to be changed
disp('If you are running the code on a Windows PC and experiencing')
disp('problems with colormaps or graphics resolution, you may have to')
disp('change the default graphics rendering mode to one of these:')
disp(' set(0, ''DefaultFigureRenderer'', ''opengl'')')
disp(' set(0, ''DefaultFigureRenderer'', ''zbuffer'')')
disp(' set(0, ''DefaultFigureRenderer'', ''painters'')')
end
Nicola Vigano
committed
disp(' ')
cd(fullfile(GT_MATLAB_HOME, 'matGeom'));
setupMatGeom();
cd(current_dir);
disp(' ')
Nicola Vigano
committed
% load MTex toolbox if logged on rnice6-0101
% it has been installed only on this host
% to be generalized
Nicola Vigano
committed
% mtex_dir = '/sware/com/matlab-tbx/mtex-3.4.2/';
% if (~isdeployed && exist(mtex_dir, 'dir'))
% cd(mtex_dir);
% startup_mtex();
% cd(current_dir);
% else
% warning('MTex:not_installed', 'MTex toolbox is not installed')
% end
disp([boldColor 'To report a bug, create a ticket at https://sourceforge.net/p/dct/tickets' defaultColor]);