diff --git a/4_grains/gtLoadCluster.m b/4_grains/gtLoadCluster.m index 4d6043350dc41e7b9da68a11cfe326cd117cc1d8..b8493056c0265a3b639baa78f5689e6a0a96afb6 100644 --- a/4_grains/gtLoadCluster.m +++ b/4_grains/gtLoadCluster.m @@ -1,17 +1,4 @@ -function cluster = gtLoadCluster(phase_id, cl_or_gr_ids, varargin) -% GTLOADCLUSTER load the projection input of a grain cluster -% cl = function cluster = gtLoadCluster(phase_id, cl_or_gr_ids, varargin) -% INPUT: -% phaseID = <int> phase ID -% cl_or_gr_ids = <int> either the cluster_id (->sample) or -% list of grain_ids composing the -% cluster -% -% OPTIONAL INPUT (p/v pairs): -% fields = <string> only load specific fields from -% cluster structure ('ODF6D', 'SEG') -% parameters = <struct> for security (make sure to load from right directory) -% +function cluster = gtLoadCluster(phase_id, grain_ids, varargin) conf = struct('fields', {{}}, 'parameters', {[]}); conf = parse_pv_pairs(conf, varargin); @@ -21,18 +8,12 @@ function cluster = gtLoadCluster(phase_id, cl_or_gr_ids, varargin) phase_dir = fullfile(conf.parameters.acq.dir, '4_grains', sprintf('phase_%02d', phase_id)); end - if numel(cl_or_gr_ids) == 1 %if only one element we assume it refers to a cluster - sample = GtSample.loadFromFile; - grain_ids_sorted = sample.phases{phase_id}.clusters(cl_or_gr_ids).included_ids; - else - grain_ids_sorted = sort(cl_or_gr_ids); - if (any(grain_ids_sorted ~= cl_or_gr_ids)) - warning('gtLoadCluster:wrong_argumet', ... - 'Some grain IDs were no sorted: %s', sprintf(' %d', cl_or_gr_ids)); - end - end - + grain_ids_sorted = sort(grain_ids); + if (any(grain_ids_sorted ~= grain_ids)) + warning('gtLoadCluster:wrong_argumet', ... + 'Some grain IDs were no sorted: %s', sprintf(' %d', grain_ids)); + end str_ids = sprintf('_%04d', grain_ids_sorted); cluster_file = fullfile(phase_dir, sprintf('grain_cluster%s.mat', str_ids)); diff --git a/4_grains/gtLoadClusterRec.m b/4_grains/gtLoadClusterRec.m index 75bb4e456c95d3ff60d5db75e3f1421bb0f77580..f4128239cc00e31a8766e71db7e07ee1e1ff58b2 100644 --- a/4_grains/gtLoadClusterRec.m +++ b/4_grains/gtLoadClusterRec.m @@ -1,18 +1,4 @@ -function cluster_rec = gtLoadClusterRec(phase_id, cl_or_gr_ids, varargin) -% GTLOADCLUSTERREC load the 6D reconstruction output of a grain cluster -% cl = function cluster_rec = gtLoadClusterRec(phase_id, cl_or_gr_ids, varargin) -% INPUT: -% phaseID = <int> phase ID -% cl_or_gr_ids = <int> either the cluster_id (->sample) or -% list of grain_ids composing the -% cluster -% -% OPTIONAL INPUT (p/v pairs): -% fields = <string> only load specific fields from -% cluster structure ('ODF6D', 'SEG') -% parameters = <struct> for security (make sure to load from right directory) -% - +function cluster_rec = gtLoadClusterRec(phase_id, grain_ids, varargin) conf = struct('fields', {{}}, 'parameters', {[]}); conf = parse_pv_pairs(conf, varargin); @@ -22,15 +8,11 @@ function cluster_rec = gtLoadClusterRec(phase_id, cl_or_gr_ids, varargin) phase_dir = fullfile(conf.parameters.acq.dir, '4_grains', sprintf('phase_%02d', phase_id)); end - if numel(cl_or_gr_ids) == 1 %only one element - it refers to a cluster - sample = GtSample.loadFromFile; - grain_ids_sorted = sample.phases{phase_id}.clusters(cl_or_gr_ids).included_ids; - else - grain_ids_sorted = sort(cl_or_gr_ids); - if (any(grain_ids_sorted ~= cl_or_gr_ids)) - warning('gtLoadCluster:wrong_argumet', ... - 'Some grain IDs were no sorted: %s', sprintf(' %d', cl_or_gr_ids)); - end + grain_ids_sorted = sort(grain_ids); + + if (any(grain_ids_sorted ~= grain_ids)) + warning('gtLoadCluster:wrong_argumet', ... + 'Some grain IDs were no sorted: %s', sprintf(' %d', grain_ids)); end str_ids = sprintf('_%04d', grain_ids_sorted); diff --git a/5_reconstruction/gtReconstructGrainTwinCluster.m b/5_reconstruction/gtReconstructGrainTwinCluster.m index fb407da3de04996f70090d7f3d0a470d220737d7..72747aee40758c537c9445e19369e4e6b3afe81a 100644 --- a/5_reconstruction/gtReconstructGrainTwinCluster.m +++ b/5_reconstruction/gtReconstructGrainTwinCluster.m @@ -1,20 +1,7 @@ -function gtReconstructGrainTwinCluster(phase_id, cluster_id, workingdirectory, parameters, varargin) +function gtReconstructGrainTwinCluster(grain_ids, phase_id, parameters, varargin) % gtReconstructGrainOrientation 6D reconstructions on a GPU machine -% gtReconstructGrainTwinCluster(phase_id, cluster_id, workingdirectory, parameters, varargin) +% gtAstraReconstructGrain(grainIDs, phaseID, [parameters]) % ------------------------------------------------------- - cd(workingdirectory); - - if (isdeployed) - global GT_DB %#ok<NUSED,TLEV> - global GT_MATLAB_HOME %#ok<NUSED,TLEV> - load('workspaceGlobal.mat'); - phase_id = str2double(phase_id); - cluster_id = str2double(cluster_id); - end - - sample = GtSample.loadFromFile; - grain_ids = sample.phases{phase_id}.clusters(cluster_id).included_ids; - if (~exist('parameters', 'var') || isempty(parameters)) parameters = gtLoadParameters(); end @@ -163,3 +150,4 @@ function gtReconstructGrainTwinCluster(phase_id, cluster_id, workingdirectory, p save(grain_full_details_file, 'ODF6D', '-v7.3'); end end + diff --git a/5_reconstruction/gtSetupReconstruction.m b/5_reconstruction/gtSetupReconstruction.m index 9efebf03e76a1ea2322d45556a4560a6d3c0adc5..57f1f6448a309c57d508261ee257193b5bb167a2 100644 --- a/5_reconstruction/gtSetupReconstruction.m +++ b/5_reconstruction/gtSetupReconstruction.m @@ -1,19 +1,14 @@ -function gtSetupReconstruction(phaseID, varargin) +function gtSetupReconstruction(phaseID, list) % GTSETUPRECONSTRUCTION Simple helper function to launch reconstruction and segmentation of % absorption volume - as well as reconstruction and segmentation of grain volumes % -% gtSetupReconstruction(phaseID, varargin) +% gtSetupReconstruction(phaseID, list) % ------------------------------ % % INPUT: % phaseID = number of the phase <double> {1} +% list = vector of grainids, default value is {[1: num_grains]} % -% OPTIONAL INPUT: -% grain_ids = vector of grain_ids, default value is {[1: num_grains]} -% cluster_ids = vector of cluster_ids, default value is {[1: num_clusters]} -% 'is_cluster -% Version 005 12-10-2016 by W. Ludwig -% Add possibility to launch grain-cluster reconstructions % Version 004 25-05-2016 by W. Ludwig % Add possibility to specify a list of grainids - which will be % handled by OAR @@ -28,12 +23,6 @@ function gtSetupReconstruction(phaseID, varargin) % Move gtModifyStructure to before the abs reconstruction is done. GPU_OK = gtCheckGpu(); -conf.grain_ids = []; -conf.cluster_ids = []; - -if (~isempty(varargin)) - conf = parse_pv_pairs(conf, varargin); -end if (~GPU_OK) disp('Not on a GPU machine, you won''t be able to reconstruct localy!'); @@ -68,7 +57,7 @@ gtSaveParameters(parameters); nof_phases = numel(parameters.cryst); -if (nof_phases > 1) && isempty(phaseID) +if (nof_phases > 1) phaseID = inputwdefaultnumeric('Enter phaseID', num2str(1)); end phaseID_str = sprintf('%02d', phaseID); @@ -139,21 +128,16 @@ else end end -% If input parameter grain_ids is empty, we will use all grains by default +% If input parameter list is empty, we will use all grains by default +first = 1; +last = sample.phases{phaseID}.getNumberOfGrains(); - -if ~isempty(varargin) - conf = parse_pv_pairs(conf, varargin); +if (~exist('list', 'var') || isempty(list)) + list = [first : last]; end -if isempty(conf.grain_ids) - first = 1; - last = sample.phases{phaseID}.getNumberOfGrains(); - list = [first : last]; -end - -check = inputwdefault('Launch grain reconstruction? [y/n]', 'y'); +check = inputwdefault('Launch reconstruction? [y/n]', 'y'); rec_on_OAR = false; if strcmpi(check, 'y') if (GPU_OK) @@ -164,35 +148,13 @@ if strcmpi(check, 'y') end if (rec_on_OAR) launch_on_OAR('gtReconstructGrains', first, last, phaseID_str, ... - parameters, 'njobs', 8, 'walltime', 3600 * 16, ... - 'gpu', true, 'distribute', true, 'list', list); + parameters, 'njobs', 8, 'walltime', 3600 * 16, ... + 'gpu', true, 'distribute', true, 'list', list); else gtReconstructGrains(first, last, parameters.acq.dir, phaseID, parameters, 'list', list); end end -if ~isempty(conf.cluster_ids) - list = conf.cluster_ids; - check = inputwdefault('Launch cluster reconstruction? [y/n]', 'y'); - rec_on_OAR = false; - if strcmpi(check, 'y') - if (GPU_OK) - check2 = inputwdefault('Launch grain reconstruction via OAR? [y/n]', 'y'); - rec_on_OAR = strcmpi(check2, 'y'); - else - rec_on_OAR = true; - end - if (rec_on_OAR) - launch_on_OAR('gtReconstructGrainTwinClusters', first, last, phaseID_str, ... - parameters, 'njobs', 8, 'walltime', 3600 * 16, ... - 'gpu', true, 'distribute', true, 'list', list); - else - gtReconstructGrainTwinClusters(first, last, parameters.acq.dir, phaseID, parameters, 'list', list); - end - - end -end - if (~rec_on_OAR) check = inputwdefault('Launch grain segmentation? [y/n]', 'y'); if strcmpi(check, 'y') diff --git a/zUtil_Conf/batch-dev-conf.xml b/zUtil_Conf/batch-dev-conf.xml index 1c8fd69ceb68eea2337149f616dc9906fc904c81..ee2084224625bb8690ede7a1f1e5c21eb0847320 100644 --- a/zUtil_Conf/batch-dev-conf.xml +++ b/zUtil_Conf/batch-dev-conf.xml @@ -47,9 +47,6 @@ <function name="gtReconstructGrains"> <path absolute="false">5_reconstruction/gtReconstructGrains.m</path> </function> - <function name="gtReconstructGrainTwinClusters"> - <path absolute="false">5_reconstruction/gtReconstructGrainTwinClusters.m</path> - </function> <function name="gtForwardSimulate_v2"> <path absolute="false">zUtil_ForwardSim/gtForwardSimulate_v2.m</path> </function>