Skip to content
Snippets Groups Projects
Commit c3fd9eb6 authored by Laura Nervo's avatar Laura Nervo Committed by Nicola Vigano
Browse files

Old and general formatting in the code...


Signed-off-by: default avatarLaura Nervo <laura.nervo@esrf.fr>

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@695 4c865b51-4357-4376-afb4-474e03ccb993
parent 282ce5da
No related branches found
No related tags found
No related merge requests found
......@@ -16,15 +16,16 @@ function missing = gtFsimCheckMissingGrains(phase_num)
% get number of jobs for that functions from OAR
arrays=logviewOar('gtForwardSimulate_v2',[],false);
if ~isempty(arrays.fname)
if ~isempty(arrays.('gtForwardSimulate_v2').logs)
filename = arrays.('gtForwardSimulate_v2').logs;
[~,njobs] = unix(['grep "njobs" ' filename ' | awk -F" = " ''{print $2}''']);
nof_jobs = str2double(njobs);
end
else
% if ~isempty(arrays.fname)
% if ~isempty(arrays.('gtForwardSimulate_v2').logs)
% filename = arrays.('gtForwardSimulate_v2').logs;
% [~,njobs] = unix(['grep "njobs" ' filename ' | awk -F" = " ''{print $2}''']);
% nof_jobs = str2double(njobs);
% end
% else
nof_jobs = 1;
end
% end
% get last gtForwardSimulate_v2 run date from oar.log file
o=fileread('oar.log');
......
subvol=grains(1:2:end, 1:2:end, 30:2:250);
map=gtRodriguezColormap(r_vectors);
list=unique(subvol(:,:,50));
list(find(list==0))=[];%don't render the background
figure;
%go through graini by grain
for i=1:length(list)
disp(sprintf('rendering grain %d of %d...', i, length(list)))
voltest=zeros(size(subvol));
voltest(find(subvol==list(i)))=1;
%pad for smoothing
voltest2=zeros(size(voltest)+10);
voltest2(6:end-5, 6:end-5, 6:end-5)=voltest;
voltest2=smooth3(voltest2, 'box', 3);
p(i)=patch(isosurface(voltest2, 0.5));
%set colour according to map (note map(1,:)=[0 0 0] for background, so +1
set(p(i), 'FaceColor', map(list(i)+1, :), 'EdgeColor', 'none');
end
camlight
lighting phong
axis equal
axis vis3d
set(gca, 'xTick', []);
set(gca, 'yTick', []);
set(gca, 'zTick', []);
function gtStatus()
% check status of a dataset, show progress where possible, and tell a user
% where one might have a problem.
% to add - prompts
% to add - look into most recent OAR stats to get more info
% GTSTATUS Checks the status of a dataset, show progress where possible
% and tell a user where one might have a problem.
% gtStatus()
% ----------
% to add - prompts
% - look into most recent OAR stats to get more info
%
% Version 001.2 23/08/2012 by LNervo
% Code formatting
%
% Version 001 by AKing
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FIRST THINGS FIRST - PARAMETERS FILE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% is there a parameters file?
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
if exist('parameters.mat', 'file')
load parameters
fprintf('Found a parameters file...\n')
fprintf('Dataset name is %s\n', parameters.acq.name)
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
else
fprintf('No parameters.mat file found! Are you in the analysis directory?\n')
a=pwd;
fprintf('Current directory is: %s\n', a)
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
return
end
......@@ -69,7 +70,7 @@ if exist('oar.log', 'file')
ndx=ndx+81;
end
launch_time=status((end-30):(end-12));
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
fprintf('Last OAR job was %s \n(array %d launched at %s) \n', lastoar_name, lastoar_array, launch_time)
% finished?
......@@ -93,7 +94,7 @@ else
fprintf('No oar.log file found... \n')
fprintf('Possible OAR problem? \n')
end
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......@@ -121,14 +122,15 @@ disp('checking what images are present')
% make the first check on the full images. If these are not all present,
% look into the other images to see what is missing:
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
d=dir(fullfile(parameters.acq.dir,'1_preprocessing/full', 'full*.edf'));
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
d=dir(fullfile(parameters.acq.dir,'1_preprocessing','full', 'full*.edf'));
nfull=length(d);
fprintf('found %d full images out of %d expected\n', nfull, totproj)
if nfull~=totproj
problem_list{end+1}='missing full images : possible gtCreateFullLive problem';
end
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
% was preprocessing successful?
if nfull==totproj
preprocessing_ok=true;
......@@ -137,30 +139,30 @@ else
fprintf('Checking raw, corrected and preprocessed images')
%% Orig images
d=dir(fullfile(parameters.acq.dir,'0_rawdata/Orig', [parameters.acq.name '*.edf']));
% Orig images
d=dir(fullfile(parameters.acq.dir,'0_rawdata','Orig', [parameters.acq.name '*.edf']));
n_orig=length(d);
fprintf('found %d raw images out of %d expected\n', n_orig, totproj)
if n_orig<totproj
problem_list{end+1}='missing raw images: possible gtCopyCorrectUndistortCondor problem';
end
d=dir(fullfile(parameters.acq.dir,'0_rawdata/Orig', 'ref*_*.edf'));
d=dir(fullfile(parameters.acq.dir,'0_rawdata','Orig', 'ref*_*.edf'));
nref_orig=length(d);
fprintf('found %d raw references out of %d expected\n', nref_orig, totref)
if nref_orig~=totref
problem_list{end+1}='missing raw reference images: possible gtCopyCorrectUndistortCondor problem';
end
d=dir(fullfile(parameters.acq.dir,'0_rawdata/Orig', 'dark*.edf'));
if length(d)>0
d=dir(fullfile(parameters.acq.dir,'0_rawdata','Orig', 'dark*.edf'));
if ~isempty(d)
fprintf('found at least one dark images\n')
else
fprintf('No raw dark image found\n')
problem_list{end+1}='missing raw dark image: possible gtCopyCorrectUndistortCondor problem';
end
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
%% Treated images
% Treated images
d=dir(fullfile(parameters.acq.dir,'0_rawdata', parameters.acq.name, [parameters.acq.name '*.edf']));
n_copy=length(d);
fprintf('found %d copied images out of %d expected\n', n_copy, totproj)
......@@ -180,16 +182,16 @@ else
if ndark_copy>0
fprintf('found at least one copied dark images\n')
end
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
% was copying successful?
if n_copy>=totproj & nref_copy==nref_copy & ndark_copy>0
if n_copy>=totproj && nref_copy==nref_copy && ndark_copy>0
copy_ok=true;
end
%% Preprocessed images
% Preprocessed images
disp('checking for other preprocessed images...')
d=dir(fullfile(parameters.acq.dir,'0_rawdata', parameters.acq.name, 'refHST*.edf'));
nrefHST=length(d);
......@@ -226,12 +228,13 @@ end % if full images present
% SEGMENTATION STATUS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
disp('Connecting to database to check segmentation...')
gtDBConnect;
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
gtDBConnect();
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
if strcmp(parameters.seg.method, 'doublethr')
fprintf('Segmentation method: Double threshold \n')
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
% seed segmentation status
cmd=sprintf('select count(*) from %sfullmedianvals', parameters.acq.name);
......@@ -243,7 +246,7 @@ if strcmp(parameters.seg.method, 'doublethr')
if n_fmv~=n_fmv_finished
problem_list{end+1}='gtSeedSegmentation_doublethr has not finished';
end
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
% blob segmentation progress
......@@ -259,10 +262,10 @@ if strcmp(parameters.seg.method, 'doublethr')
fprintf('Segmentation has treated %d out of %d seeds\n',done_seeds, tot_seeds)
fprintf('Segmentation has found %d blobs\n', n_blobs')
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
% was segmentation successful?
if done_seeds==tot_seeds & n_blobs>1
if done_seeds==tot_seeds && n_blobs>1
blobs_ok=true;
end
......@@ -270,11 +273,11 @@ if strcmp(parameters.seg.method, 'doublethr')
elseif strcmp(parameters.seg.method, 'singlethr')
fprintf('Segmentation method: Single threshold \n')
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
n_blobs=sprintf('select count(*) from %sdifblob', parameters.acq.name);
fprintf('Segmentation has found %d blobs\n',n_blobs)
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
% was segmentation successful?
if nblobs>1
......@@ -288,7 +291,7 @@ end
cmd=sprintf('select count(*) from %sdifspot', parameters.acq.name);
n_spots=mym(cmd);
fprintf('Database has %d difspots from %d blobs\n',n_spots, n_blobs)
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PAIRMATCHING STATUS
......@@ -304,7 +307,7 @@ end
fprintf('Database has %d spot pairs for phase %d from %d difspots (%0.1f%% matching) \n'...
,n_pairs(ii), ii, n_spots,pair_percentage )
end
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% INDEXING STATUS
......@@ -318,7 +321,7 @@ for ii=length(parameters.cryst)
fprintf('This file was created %s \n', d.date)
n_pairs_inp(ii)=length(inp.tot.pairid);
if n_pairs_inp(ii)~=n_pairs(ii)
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
fprintf('!!! Strong warning !!! \n')
fprintf('Number of pairs in the indexing input file does not match the spotpair table\n')
fprintf('If you have update the pair matching, un-check "use input file" in gtSetupIndexing\n')
......@@ -330,7 +333,7 @@ for ii=length(parameters.cryst)
end
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
% is there an output file?
d2=dir(sprintf('4_grains/phase_%02d/index.mat', ii));
......@@ -343,12 +346,12 @@ for ii=length(parameters.cryst)
else
fprintf('No indexing output found for phase %02d\n', ii)
end
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
if d.datenum>d2.datenum
fprintf('!!! Strong warning !!! \n')
fprintf('Input file is newer than the output file! Indexing has started but not been finished\n')
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
end
end
......@@ -369,7 +372,7 @@ for ii=1:length(parameters.cryst)
end
end
check=inputwdefault('use gtFsimCheckMissingGrains to check forward sim output?', 'n')
check=inputwdefault('use gtFsimCheckMissingGrains to check forward sim output?', 'n');
if strcmpi(check, 'y')
for ii=length(parameters.cryst)
fprintf('Check forward simulation for phase %02d:\n', ii)
......@@ -381,7 +384,7 @@ for ii=length(parameters.cryst)
fprintf('These grains failed:\n')
list.ind
end
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
end
end
......@@ -395,7 +398,7 @@ for ii=length(parameters.cryst)
if exist(sprintf('4_grains/phase_%02d/index.mat', ii), 'file')
a=load(sprintf('4_grains/phase_%02d/index.mat', ii));
check=zeros(length(a.grain), 2);
warning('off') % hide warning messages
warning('off','Warning OFF') % hide warning messages
for jj=1:length(a.grain)
fprintf('%04d/%04d', jj, length(a.grain));
b=load(sprintf('4_grains/phase_%02d/grain_%04d.mat', ii, jj), 'vol', 'seg');
......@@ -424,8 +427,8 @@ for ii=length(parameters.cryst)
fprintf('\nno indexter output found\n')
end
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
warning('on') % hide warning messages
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
warning('on','Warning ON') % hide warning messages
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment